|
|
|
|
<template>
|
|
|
|
|
<basic-container>
|
|
|
|
|
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud"
|
|
|
|
|
:permission="permissionList" @search-change="searchChange" @search-reset="searchReset"
|
|
|
|
|
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
|
|
|
|
|
@refresh-change="refreshChange" @on-load="onLoad">
|
|
|
|
|
<template #menu-left="{}">
|
|
|
|
|
<el-button type="prmary" icon="el-icon-plus" size="small">新增</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #menu="{ row, index, size }">
|
|
|
|
|
<el-button type="text" :size="size" icon="el-icon-view" @click="$refs.crud.rowEdit(row, index)">详情</el-button>
|
|
|
|
|
<el-button type="text" :size="size" icon="el-icon-edit" @click="$refs.crud.rowEdit(row, index)">编辑</el-button>
|
|
|
|
|
<el-button type="text" :size="size" icon="el-icon-delete" @click="$refs.crud.rowDel(row, index)">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</avue-crud>
|
|
|
|
|
</basic-container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { bizLogin, bizDeviceList, bizDeviceStatus, bizNodeType } from "@/api/wirelessintrusion/wirelessintrusion";
|
|
|
|
|
import { mapGetters } from "vuex";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
form: {},
|
|
|
|
|
query: {},
|
|
|
|
|
loading: true,
|
|
|
|
|
page: {
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0
|
|
|
|
|
},
|
|
|
|
|
selectionList: [],
|
|
|
|
|
option: {
|
|
|
|
|
height: 'auto',
|
|
|
|
|
calcHeight: 30,
|
|
|
|
|
dialogWidth: 950,
|
|
|
|
|
tip: false,
|
|
|
|
|
searchShow: true,
|
|
|
|
|
searchMenuSpan: 6,
|
|
|
|
|
border: true,
|
|
|
|
|
index: false,
|
|
|
|
|
viewBtn: false,
|
|
|
|
|
editBtn: false,
|
|
|
|
|
delBtn: false,
|
|
|
|
|
addBtn: false,
|
|
|
|
|
dialogClickModal: false,
|
|
|
|
|
column: [
|
|
|
|
|
{
|
|
|
|
|
label: "报警点",
|
|
|
|
|
prop: "name",
|
|
|
|
|
search: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "所在区域",
|
|
|
|
|
prop: "remark",
|
|
|
|
|
search: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "经纬度",
|
|
|
|
|
prop: "name",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "关联摄像头",
|
|
|
|
|
prop: "node",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "关联手持终端",
|
|
|
|
|
prop: "nodeLabel",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "创建时间",
|
|
|
|
|
prop: "createTime",
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
}, {
|
|
|
|
|
label: "最后更新时间",
|
|
|
|
|
prop: "lastOnline",
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
data: [],
|
|
|
|
|
nodeType: [],//节点类型
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapGetters(["permission"]),
|
|
|
|
|
permissionList() {
|
|
|
|
|
return {
|
|
|
|
|
addBtn: this.vaildData(this.permission.notice_add, false),
|
|
|
|
|
viewBtn: this.vaildData(this.permission.notice_view, false),
|
|
|
|
|
delBtn: this.vaildData(this.permission.notice_delete, false),
|
|
|
|
|
editBtn: this.vaildData(this.permission.notice_edit, false)
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
ids() {
|
|
|
|
|
let ids = [];
|
|
|
|
|
this.selectionList.forEach(ele => {
|
|
|
|
|
ids.push(ele.id);
|
|
|
|
|
});
|
|
|
|
|
return ids.join(",");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//字典加载
|
|
|
|
|
loadDict() {
|
|
|
|
|
let token = window.sessionStorage.getItem('bizToken');
|
|
|
|
|
if (token == 'undefined' || !token) {
|
|
|
|
|
bizLogin({ appKey: 'Arf7bd4f26', appSecret: 'kb207044c8' }).then(res => {
|
|
|
|
|
window.sessionStorage.setItem('bizToken', res.data.data.token);
|
|
|
|
|
bizDeviceStatus(res.data.data.token).then(res => {
|
|
|
|
|
const column = this.findObject(this.option.column, "status");
|
|
|
|
|
column.dicData = res.data.data;
|
|
|
|
|
})
|
|
|
|
|
bizNodeType(res.data.data.token).then(res => {
|
|
|
|
|
const column = this.findObject(this.option.column, "node");
|
|
|
|
|
column.dicData = res.data.data;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
bizDeviceStatus(token).then(res => {
|
|
|
|
|
if (res.data.code == 401) {
|
|
|
|
|
window.sessionStorage.removeItem('bizToken');
|
|
|
|
|
this.loadDict();
|
|
|
|
|
}
|
|
|
|
|
else if (res.data.code == 200) {
|
|
|
|
|
const column = this.findObject(this.option.column, "status");
|
|
|
|
|
column.dicData = res.data.data;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
bizNodeType(token).then(res => {
|
|
|
|
|
const column = this.findObject(this.option.column, "node");
|
|
|
|
|
column.dicData = res.data.data;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//节点类型转换
|
|
|
|
|
renderLabel(node, col) {
|
|
|
|
|
const column = this.findObject(this.option.column, col);
|
|
|
|
|
let idx = column.dicData.findIndex(item => item.dictValue == node);
|
|
|
|
|
return idx > -1 ? column.dicData[idx].dictLabel : '';
|
|
|
|
|
},
|
|
|
|
|
// rowSave(row, done, loading) {
|
|
|
|
|
// add(row).then(() => {
|
|
|
|
|
// this.onLoad(this.page);
|
|
|
|
|
// this.$message({
|
|
|
|
|
// type: "success",
|
|
|
|
|
// message: "操作成功!"
|
|
|
|
|
// });
|
|
|
|
|
// done();
|
|
|
|
|
// }, error => {
|
|
|
|
|
// window.console.log(error);
|
|
|
|
|
// loading();
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// rowUpdate(row, index, done, loading) {
|
|
|
|
|
// update(row).then(() => {
|
|
|
|
|
// this.onLoad(this.page);
|
|
|
|
|
// this.$message({
|
|
|
|
|
// type: "success",
|
|
|
|
|
// message: "操作成功!"
|
|
|
|
|
// });
|
|
|
|
|
// done();
|
|
|
|
|
// }, error => {
|
|
|
|
|
// window.console.log(error);
|
|
|
|
|
// loading();
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// rowDel(row) {
|
|
|
|
|
// this.$confirm("确定将选择数据删除?", {
|
|
|
|
|
// confirmButtonText: "确定",
|
|
|
|
|
// cancelButtonText: "取消",
|
|
|
|
|
// type: "warning"
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// return remove(row.id);
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// this.onLoad(this.page);
|
|
|
|
|
// this.$message({
|
|
|
|
|
// type: "success",
|
|
|
|
|
// message: "操作成功!"
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
searchReset() {
|
|
|
|
|
this.query = {};
|
|
|
|
|
this.onLoad(this.page);
|
|
|
|
|
},
|
|
|
|
|
searchChange(params, done) {
|
|
|
|
|
this.query = params;
|
|
|
|
|
this.page.currentPage = 1;
|
|
|
|
|
this.onLoad(this.page, params);
|
|
|
|
|
done();
|
|
|
|
|
},
|
|
|
|
|
selectionChange(list) {
|
|
|
|
|
this.selectionList = list;
|
|
|
|
|
},
|
|
|
|
|
selectionClear() {
|
|
|
|
|
this.selectionList = [];
|
|
|
|
|
this.$refs.crud.toggleSelection();
|
|
|
|
|
},
|
|
|
|
|
// handleDelete() {
|
|
|
|
|
// if (this.selectionList.length === 0) {
|
|
|
|
|
// this.$message.warning("请选择至少一条数据");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// this.$confirm("确定将选择数据删除?", {
|
|
|
|
|
// confirmButtonText: "确定",
|
|
|
|
|
// cancelButtonText: "取消",
|
|
|
|
|
// type: "warning"
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// return remove(this.ids);
|
|
|
|
|
// })
|
|
|
|
|
// .then(() => {
|
|
|
|
|
// this.onLoad(this.page);
|
|
|
|
|
// this.$message({
|
|
|
|
|
// type: "success",
|
|
|
|
|
// message: "操作成功!"
|
|
|
|
|
// });
|
|
|
|
|
// this.$refs.crud.toggleSelection();
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
beforeOpen(done, type) {
|
|
|
|
|
console.log(this.form)
|
|
|
|
|
if (["edit", "view"].includes(type)) {
|
|
|
|
|
// let token = window.sessionStorage.getItem('bizToken');
|
|
|
|
|
// if (token == 'undefined') {
|
|
|
|
|
// bizDeviceDetail(this.form.id).then(res => {
|
|
|
|
|
// this.form = res.data.data;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
done();
|
|
|
|
|
},
|
|
|
|
|
currentChange(currentPage) {
|
|
|
|
|
this.page.currentPage = currentPage;
|
|
|
|
|
},
|
|
|
|
|
sizeChange(pageSize) {
|
|
|
|
|
this.page.pageSize = pageSize;
|
|
|
|
|
},
|
|
|
|
|
refreshChange() {
|
|
|
|
|
this.onLoad(this.page, this.query);
|
|
|
|
|
},
|
|
|
|
|
onLoad(page, params = {}) {
|
|
|
|
|
let values = {
|
|
|
|
|
...params,
|
|
|
|
|
...this.query,
|
|
|
|
|
pid: 98
|
|
|
|
|
};
|
|
|
|
|
let token = window.sessionStorage.getItem('bizToken');
|
|
|
|
|
if (token == 'undefined' || !token) {
|
|
|
|
|
bizLogin({ appKey: 'Arf7bd4f26', appSecret: 'kb207044c8' }).then(res => {
|
|
|
|
|
window.sessionStorage.setItem('bizToken', res.data.data.token);
|
|
|
|
|
this.loading = true;
|
|
|
|
|
bizDeviceList(res.data.data.token, { ...values, pageSize: page.pageSize, pageNo: page.currentPage }).then(res2 => {
|
|
|
|
|
const data = res2.data;
|
|
|
|
|
this.page.total = data.total;
|
|
|
|
|
this.data = data.records;
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.selectionClear();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
bizDeviceList(token, { ...values, pageSize: page.pageSize, pageNo: page.currentPage }).then(res2 => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.selectionClear();
|
|
|
|
|
if (res2.data.code == 401) {
|
|
|
|
|
console.log(res2.data.code)
|
|
|
|
|
window.sessionStorage.removeItem('bizToken');
|
|
|
|
|
this.onLoad();
|
|
|
|
|
}
|
|
|
|
|
else if (res2.data.code == 200) {
|
|
|
|
|
const data = res2.data;
|
|
|
|
|
this.page.total = data.total;
|
|
|
|
|
data.rows.map(item => {
|
|
|
|
|
item.node = item.bizProduct.node;
|
|
|
|
|
// item.nodeLabel = this.renderLabel(item.node,'node');
|
|
|
|
|
// item.statusLabel = this.renderLabel(item.status,'status')
|
|
|
|
|
})
|
|
|
|
|
this.data = data.rows;
|
|
|
|
|
}
|
|
|
|
|
}, err => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.selectionClear();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style></style>
|