personmove
This commit is contained in:
parent
25e0cb4b13
commit
54ea10290c
|
@ -12,6 +12,26 @@ export default {
|
|||
);
|
||||
}
|
||||
},
|
||||
bltBind: {
|
||||
name: "绑定/解绑定位卡",
|
||||
req: async function(data){
|
||||
return await http.post(
|
||||
`${config.API_URL}/third/tdevice/blt_bind/`,
|
||||
data
|
||||
);
|
||||
}
|
||||
},
|
||||
bltSync: {
|
||||
name: "同步标签mac至平台",
|
||||
req: async function(data){
|
||||
return await http.post(
|
||||
`${config.API_URL}/third/tdevice/blt_sync/`,
|
||||
data
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
blt:{
|
||||
|
|
|
@ -903,6 +903,7 @@
|
|||
mark: '1',
|
||||
},
|
||||
LBType: '1',
|
||||
userMarker:{},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -1062,13 +1063,6 @@
|
|||
} else {
|
||||
}
|
||||
});
|
||||
/*
|
||||
* <div class="v_title" style="width: 327px;height: 45px;padding: 10px 0;font-size: 16px;font-weight: 700;color: #fff;position: relative;padding-left: 8px;display: flex;justify-content: space-between">
|
||||
<div>`+event.markers[0].text+`</div><div style="width: 16px;height: 16px;background: url(.//public/img/close.png) no-repeat;background-size: 100% 100%;" @click="closeVideo"></div>
|
||||
</div>
|
||||
<div class="v_masker" style="width: 327px;height: 183px;background: url(.//public/img/v_mask.png) no-repeat;background-size: 100% 100%;" @click="playVideo()"></div>
|
||||
<div id="`+event.markers[0].id+`"></div>
|
||||
* */
|
||||
//左侧数据统计
|
||||
this.getManCount();//人员统计$$
|
||||
this.getWarnings();//报警统计$$
|
||||
|
@ -1082,9 +1076,7 @@
|
|||
this.getAllMen();//人员
|
||||
this.getAllPost();//岗位
|
||||
setInterval(function () {
|
||||
/*this.getManCount();//人员统计$$
|
||||
this.getWarnings();//报警统计$$
|
||||
this.getAreas();//区域*/
|
||||
|
||||
},3000)
|
||||
|
||||
},
|
||||
|
@ -1181,13 +1173,14 @@
|
|||
},
|
||||
//获取人员列表(全部在线标签列表信息)
|
||||
getAllMen() {
|
||||
this.$API.third.blt.all.req().then(res => {
|
||||
let that = this;
|
||||
that.$API.third.blt.all.req().then(res => {
|
||||
if (res.err_msg) {
|
||||
} else {
|
||||
this.userList = res.filter(item => {
|
||||
that.userList = res.filter(item => {
|
||||
return item.my_info.employee
|
||||
});
|
||||
// console.log(this.userList)
|
||||
that.showUserMarkers();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
@ -1299,6 +1292,7 @@
|
|||
show: false
|
||||
});
|
||||
window.map.addLayer(that.userMaskerLayer);
|
||||
that.getAllMen();
|
||||
},
|
||||
//喇叭layer
|
||||
speakersMaskerLayers() {//消防物资
|
||||
|
@ -1427,10 +1421,13 @@
|
|||
let that = this;
|
||||
let iconTextMarker = null;
|
||||
if(that.userList.length>0){
|
||||
let lng = [114.62923138539462,114.6315404372349];//经度
|
||||
let i=0;
|
||||
iconTextMarker = that.userList[0].mac+'userMarker';
|
||||
let employee_ = that.userList[0].my_info.employee_;
|
||||
iconTextMarker = new jsmap.JSIconTextMarker({
|
||||
that.userMarker[iconTextMarker] = new jsmap.JSIconTextMarker({
|
||||
id: that.userList[0].my_info.code,
|
||||
position: {x: 114.6315404372349, y: 38.813557855009435, z: 0}, //坐标
|
||||
position: {x: 114.62923138539462, y: 38.8133418942645, z: 0}, //坐标
|
||||
floorId: 1, //楼层id,默认为1(地面)
|
||||
image: "/img/user.png",
|
||||
text: employee_.name,
|
||||
|
@ -1450,66 +1447,16 @@
|
|||
properties: {
|
||||
employee: employee_
|
||||
},
|
||||
callback: (marker) => {
|
||||
return employee_
|
||||
}
|
||||
});
|
||||
|
||||
that.userMaskerLayer.addMarker(iconTextMarker);
|
||||
setTimeout(function () {
|
||||
console.log(that.userMaskerLayer);
|
||||
that.userMaskerLayer.updateMarkerPosition(iconTextMarker,{
|
||||
that.userMaskerLayer.addMarker(that.userMarker[iconTextMarker]);
|
||||
setInterval(function () {
|
||||
i=(i+1)%2;
|
||||
that.userMaskerLayer.updateMarkerPosition(that.userMarker[iconTextMarker],{
|
||||
floorId:1,
|
||||
position: {x:114.62923138539462, y:38.8133418942642, z:0},
|
||||
animate: true
|
||||
position: {x:lng[i], y:38.8133418942642, z:0},
|
||||
animate: {duration: 8000,}
|
||||
});//动画效果,持续时间一秒
|
||||
},3000);
|
||||
setTimeout(function () {
|
||||
console.log(that.userMaskerLayer);
|
||||
that.userMaskerLayer.updateMarkerPosition(iconTextMarker,{
|
||||
floorId:1,
|
||||
position: {x:114.6315404372349, y: 38.813557855009435, z:0},
|
||||
animate: true
|
||||
});//动画效果,持续时间一秒
|
||||
},6000);
|
||||
debugger;
|
||||
/*let employee_1 = that.userList[1].my_info.employee_;
|
||||
iconTextMarker1 = new jsmap.JSIconTextMarker({
|
||||
id: that.userList[1].my_info.code,
|
||||
position: {x: 114.62923138539462, y: 38.8133418942642, z: 0}, //坐标
|
||||
floorId: 1, //楼层id,默认为1(地面)
|
||||
image: "/img/user.png",
|
||||
text: employee_1.name,
|
||||
font: '10px sans-serif',
|
||||
fontColor: '#ffffff',
|
||||
imageHeight: 25,
|
||||
imageWidth: 25,
|
||||
backgroundColor: 'rgba(0,0,0,0.3)',
|
||||
backgroundRadius: 1,
|
||||
backgroundStrokeColor: 'rgba(0,0,0,0.3)',
|
||||
backgroundStrokeWidth: 1,
|
||||
iconTextType: jsmap.JSIconTextType.TOPTEXT_BOTTOMICON,
|
||||
allowPicking: true,
|
||||
displayCondition: new jsmap.JSDisplayCondition(0.0, 1000),
|
||||
nearFarScale: new jsmap.JSNearFarScale(0.0, 1, 500, 1),
|
||||
show: true,
|
||||
properties: {
|
||||
employee: employee_1
|
||||
},
|
||||
callback: (marker) => {
|
||||
return employee_1
|
||||
}
|
||||
});
|
||||
that.userMaskerLayer.addMarker(iconTextMarker1);
|
||||
setTimeout(function () {
|
||||
that.userMaskerLayer.updateMarkerPosition(jsmap.JSIconTextMarker,{
|
||||
floorId:1,
|
||||
position: {x:114.6315404372349, y:38.813557855009435, z:0},
|
||||
animate: true
|
||||
});//动画效果,持续时间一秒
|
||||
|
||||
},3000)*/
|
||||
}else{
|
||||
},8500)
|
||||
}
|
||||
/*that.userList.forEach(item => {
|
||||
if (item.my_info.code) {
|
||||
|
@ -1737,17 +1684,7 @@
|
|||
that.riskMarkerLayer.show = false;
|
||||
}
|
||||
if (that.markList[6]) {
|
||||
that.$API.third.blt.all.req().then(res => {
|
||||
if (res.err_msg) {
|
||||
} else {
|
||||
that.userMaskerLayer.show = true;
|
||||
that.userList = res.filter(item=>{
|
||||
return item.my_info.code
|
||||
});
|
||||
// this.showUserMarkers();
|
||||
that.showUserMarkers();
|
||||
}
|
||||
})
|
||||
that.userMaskerLayer.show = true;
|
||||
} else {
|
||||
that.userMaskerLayer.show = false;
|
||||
}
|
||||
|
|
|
@ -1,247 +1,326 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="handleForm('add')"
|
||||
></el-button>
|
||||
<!--
|
||||
<el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
||||
<el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> -->
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<div class="right-panel-search">
|
||||
<el-input
|
||||
v-model="search.keyword"
|
||||
placeholder="姓名/手机号"
|
||||
clearable
|
||||
@click="upsearch"
|
||||
></el-input>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="upsearch"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:apiObj="apiObj"
|
||||
row-key="id"
|
||||
@selection-change="selectionChange"
|
||||
stripe
|
||||
@resetQuery="resetQuery"
|
||||
>
|
||||
<el-table-column type="selection" width="50"></el-table-column>
|
||||
<el-table-column label="#" type="index" width="50"></el-table-column>
|
||||
<el-table-column label="姓名" prop="name" width="150"></el-table-column>
|
||||
<el-table-column label="证件照" prop="photo" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="手机号"
|
||||
prop="phone"
|
||||
width="120"
|
||||
></el-table-column>
|
||||
<el-table-column label="部门" prop="belong_dept" width="180">
|
||||
<template #default="scope">
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="handleForm('add')"
|
||||
></el-button>
|
||||
<!--
|
||||
<el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
||||
<el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> -->
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<div class="right-panel-search">
|
||||
<el-input
|
||||
v-model="search.keyword"
|
||||
placeholder="姓名/手机号"
|
||||
clearable
|
||||
@click="upsearch"
|
||||
></el-input>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="upsearch"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable
|
||||
ref="table"
|
||||
:apiObj="apiObj"
|
||||
row-key="id"
|
||||
@selection-change="selectionChange"
|
||||
stripe
|
||||
@resetQuery="resetQuery"
|
||||
>
|
||||
<el-table-column type="selection" width="50"></el-table-column>
|
||||
<el-table-column label="#" type="index" width="50"></el-table-column>
|
||||
<el-table-column label="姓名" prop="name" width="150"></el-table-column>
|
||||
<el-table-column label="证件照" prop="photo" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="手机号"
|
||||
prop="phone"
|
||||
width="120"
|
||||
></el-table-column>
|
||||
<el-table-column label="部门" prop="belong_dept" width="180">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.belong_dept_">{{
|
||||
scope.row.belong_dept_.name
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="create_time"
|
||||
width="180"
|
||||
></el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="left" width="170">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="Addcertificate(scope.row)"
|
||||
>绑定证书</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleForm('show', scope.row)"
|
||||
>查看</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="handleForm('edit', scope.row)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<!-- <el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button text type="danger" size="small">删除</el-button>
|
||||
</template>
|
||||
</el-popconfirm> -->
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
prop="create_time"
|
||||
width="180"
|
||||
></el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="left" width="170">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="Addcertificate(scope.row)"
|
||||
>绑定证书
|
||||
</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
type="success"
|
||||
size="small"
|
||||
@click="handleForm('show', scope.row)"
|
||||
>查看
|
||||
</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="handleForm('edit', scope.row)"
|
||||
>编辑
|
||||
</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="scope.row.third_info.id"
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleBindBlt(20, scope.row)"
|
||||
>解绑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
text
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleBindBlt(10, scope.row)"
|
||||
>绑定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
<el-Dialog
|
||||
title="绑定定位卡"
|
||||
v-model="showBindBlt"
|
||||
destroy-on-close
|
||||
@closed="closeDrawer"
|
||||
>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="姓名">
|
||||
{{bindBltName}}
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定卡号">
|
||||
<el-select v-model="form.blt" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in bltList"
|
||||
:key="item.id"
|
||||
:label="item.id"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button v-if="form.type===10" type="primary" @click="submitBindBlt">绑定</el-button>
|
||||
<el-button v-if="form.type===20" type="primary" @click="submitBindBlt">解绑</el-button>
|
||||
<el-button @click="showBindBlt = false">取消</el-button>
|
||||
</template>
|
||||
</el-Dialog>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./ep_form.vue";
|
||||
export default {
|
||||
name: "employee",
|
||||
components: {
|
||||
saveDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: {
|
||||
save: false,
|
||||
permission: false,
|
||||
},
|
||||
apiObj: this.$API.hrm.employee.list,
|
||||
query: {},
|
||||
selection: [],
|
||||
search: {
|
||||
keyword: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//人员证书添加
|
||||
Addcertificate(row) {
|
||||
this.$router.push({
|
||||
name: "certificate",
|
||||
query: {
|
||||
id: row.id,
|
||||
},
|
||||
});
|
||||
},
|
||||
//添加
|
||||
handleForm(type, row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
if (type === "add") {
|
||||
this.$refs.saveDialog.open(type);
|
||||
} else {
|
||||
this.$refs.saveDialog.open(type).setData(row);
|
||||
}
|
||||
});
|
||||
},
|
||||
<script>
|
||||
import saveDialog from "./ep_form.vue";
|
||||
|
||||
/*//添加
|
||||
add(){
|
||||
this.dialog.save = true
|
||||
export default {
|
||||
name: "employee",
|
||||
components: {
|
||||
saveDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialog: {
|
||||
save: false,
|
||||
permission: false,
|
||||
},
|
||||
apiObj: this.$API.hrm.employee.list,
|
||||
query: {},
|
||||
selection: [],
|
||||
search: {
|
||||
keyword: null,
|
||||
},
|
||||
showBindBlt: false,
|
||||
bltList:[],
|
||||
bindBltName:'',
|
||||
form:{
|
||||
type: 10,
|
||||
blt:'',
|
||||
employee:'',
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
this.getBltList();
|
||||
},
|
||||
methods: {
|
||||
//人员证书添加
|
||||
Addcertificate(row) {
|
||||
this.$router.push({
|
||||
name: "certificate",
|
||||
query: {
|
||||
id: row.id,
|
||||
},
|
||||
});
|
||||
},
|
||||
//添加
|
||||
handleForm(type, row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('add')
|
||||
if (type === "add") {
|
||||
this.$refs.saveDialog.open(type);
|
||||
} else {
|
||||
this.$refs.saveDialog.open(type).setData(row);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/*//添加
|
||||
add(){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('add')
|
||||
})
|
||||
},
|
||||
//编辑
|
||||
table_edit(row){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('edit').setData(row)
|
||||
})
|
||||
},
|
||||
//查看
|
||||
table_show(row){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('show').setData(row)
|
||||
})
|
||||
},*/
|
||||
//权限设置
|
||||
permission() {
|
||||
this.dialog.permission = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.permissionDialog.open();
|
||||
});
|
||||
},
|
||||
//删除
|
||||
async table_del(row) {
|
||||
await this.$API.hrm.employee.create.req(row.id).then((res) => {
|
||||
if (res.err_msg) {
|
||||
this.$message.error(res.err_msg);
|
||||
} else {
|
||||
this.$refs.table.refresh();
|
||||
this.$message.success("删除成功");
|
||||
}
|
||||
});
|
||||
},
|
||||
//批量删除
|
||||
async batch_del() {
|
||||
this.$confirm(
|
||||
`确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`,
|
||||
"提示",
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
const loading = this.$loading();
|
||||
this.$refs.table.refresh();
|
||||
loading.close();
|
||||
this.$message.success("操作成功");
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection) {
|
||||
this.selection = selection;
|
||||
},
|
||||
//表格内开关
|
||||
changeSwitch(val, row) {
|
||||
row.status = row.status == "1" ? "0" : "1";
|
||||
row.$switch_status = true;
|
||||
setTimeout(() => {
|
||||
delete row.$switch_status;
|
||||
row.status = val;
|
||||
this.$message.success("操作成功");
|
||||
}, 500);
|
||||
},
|
||||
//搜索
|
||||
upsearch() {
|
||||
},
|
||||
//根据ID获取树结构
|
||||
filterTree(id) {
|
||||
var target = null;
|
||||
|
||||
function filter(tree) {
|
||||
tree.forEach((item) => {
|
||||
if (item.id == id) {
|
||||
target = item;
|
||||
}
|
||||
if (item.children) {
|
||||
filter(item.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
filter(this.$refs.table.tableData);
|
||||
return target;
|
||||
},
|
||||
//本地更新数据
|
||||
handleSaveSuccess(data, mode) {
|
||||
if (mode == "add") {
|
||||
this.$refs.table.refresh();
|
||||
} else if (mode == "edit") {
|
||||
this.$refs.table.refresh();
|
||||
}
|
||||
},
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
getBltList(){
|
||||
this.$API.third.tdevice.list.req({type:30,page:0}).then(res=>{
|
||||
this.bltList = res/*.filter(item=>{
|
||||
return item.my_info.code === undefined
|
||||
})*/
|
||||
})
|
||||
},
|
||||
//编辑
|
||||
table_edit(row){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('edit').setData(row)
|
||||
handleBindBlt(type,row) {
|
||||
this.bindBltName = row.name;
|
||||
this.form.type = type;
|
||||
this.form.employee = row.id;
|
||||
this.showBindBlt = true;
|
||||
},
|
||||
submitBindBlt(){
|
||||
this.$API.third.tdevice.bltBind.req(this.form).then(res=>{
|
||||
this.bltList = res.filter(item=>{
|
||||
|
||||
})
|
||||
})
|
||||
},
|
||||
//查看
|
||||
table_show(row){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('show').setData(row)
|
||||
})
|
||||
},*/
|
||||
//权限设置
|
||||
permission() {
|
||||
this.dialog.permission = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.permissionDialog.open();
|
||||
});
|
||||
},
|
||||
//删除
|
||||
async table_del(row) {
|
||||
await this.$API.hrm.employee.create.req(row.id).then((res) => {
|
||||
if (res.err_msg) {
|
||||
this.$message.error(res.err_msg);
|
||||
} else {
|
||||
this.$refs.table.refresh();
|
||||
this.$message.success("删除成功");
|
||||
}
|
||||
});
|
||||
},
|
||||
//批量删除
|
||||
async batch_del() {
|
||||
this.$confirm(
|
||||
`确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`,
|
||||
"提示",
|
||||
{
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
const loading = this.$loading();
|
||||
this.$refs.table.refresh();
|
||||
loading.close();
|
||||
this.$message.success("操作成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection) {
|
||||
this.selection = selection;
|
||||
},
|
||||
//表格内开关
|
||||
changeSwitch(val, row) {
|
||||
row.status = row.status == "1" ? "0" : "1";
|
||||
row.$switch_status = true;
|
||||
setTimeout(() => {
|
||||
delete row.$switch_status;
|
||||
row.status = val;
|
||||
this.$message.success("操作成功");
|
||||
}, 500);
|
||||
},
|
||||
//搜索
|
||||
upsearch() {},
|
||||
//根据ID获取树结构
|
||||
filterTree(id) {
|
||||
var target = null;
|
||||
function filter(tree) {
|
||||
tree.forEach((item) => {
|
||||
if (item.id == id) {
|
||||
target = item;
|
||||
}
|
||||
if (item.children) {
|
||||
filter(item.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
filter(this.$refs.table.tableData);
|
||||
return target;
|
||||
},
|
||||
//本地更新数据
|
||||
handleSaveSuccess(data, mode) {
|
||||
if (mode == "add") {
|
||||
this.$refs.table.refresh();
|
||||
} else if (mode == "edit") {
|
||||
this.$refs.table.refresh();
|
||||
}
|
||||
},
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue