Commit 97e7eccb by 张杰

优化监控页面树形搜索

1 parent 91c1c062
...@@ -75,8 +75,9 @@ ...@@ -75,8 +75,9 @@
</div> </div>
</div> </div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'"> <div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header"> <div class="filter-dialog-header monitor_dialog_header">
监控列表({{monitorList.count}})
<span>监控列表({{monitorList.count}})</span>
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i> <i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div> </div>
<div class="filter-dialog-body"> <div class="filter-dialog-body">
...@@ -139,13 +140,14 @@ ...@@ -139,13 +140,14 @@
</div> </div>
</div> </div>
<div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'"> <div class="filter-dialog" :class="treeHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header"> <div class="filter-dialog-header monitor_dialog_header">
组织 <i class="el-icon-refresh i_refresh" title="重置组织" @click.stop="restInitTree"></i>
<span>组织</span>
<i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i> <i class="el-icon-close pull-right" @click.stop="treeHidden=true"></i>
</div> </div>
<div class="filter-dialog-body"> <div class="filter-dialog-body">
<div class="monitor-list"> <div class="monitor-list">
<el-tree ref="tree" :data="treeData" :props="treeProps" lazy :load="loadNode" show-checkbox node-key="id" :render-content="renderTreeContent" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys" @check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange"> <el-tree ref="tree" :key="treeKey" :data="treeData" :props="treeProps" lazy :load="loadNode" show-checkbox node-key="id" :render-content="renderTreeContent" :default-expanded-keys="expandedKeys" :default-checked-keys="checkedKeys" @check="handleCheck" v-loading="treeLoading" @check-change="handleCheckChange">
</el-tree> </el-tree>
</div> </div>
...@@ -227,6 +229,8 @@ export default { ...@@ -227,6 +229,8 @@ export default {
checkedKeys: [], checkedKeys: [],
autocompleteHide: true, autocompleteHide: true,
treeLoading: true, treeLoading: true,
currentMessage: "", //当前是否有提示语弹框
treeKey: "",
}; };
}, },
computed: { computed: {
...@@ -358,12 +362,11 @@ export default { ...@@ -358,12 +362,11 @@ export default {
checkFlow(data, node) { checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds; let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id }; let params = { oId: data.id };
if (data.origin.type === "u") { if (data.origin.type === "u") {
action = MONITOR_SERVICE.getVehicleTreeUserList; action = MONITOR_SERVICE.getVehicleTreeUserList;
params = { uId: data.id }; params = { uId: data.id };
} }
params.termType = this.searchType; params.termType = this.searchType;
params.term = this.searchText; params.term = this.searchText;
this.treeLoading = true; this.treeLoading = true;
...@@ -466,7 +469,11 @@ export default { ...@@ -466,7 +469,11 @@ export default {
} else { } else {
if (origin.type === "u") { if (origin.type === "u") {
console.log("u"); console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then( let oParams = {};
oParams.uId = nodeData.id;
oParams.termType = this.searchType;
oParams.term = this.searchText;
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(
({ data }) => { ({ data }) => {
if (data.length) { if (data.length) {
data.map((item) => { data.map((item) => {
...@@ -491,25 +498,27 @@ export default { ...@@ -491,25 +498,27 @@ export default {
return resolve(nodeData.children); return resolve(nodeData.children);
} else { } else {
if (origin.type === "u") { if (origin.type === "u") {
console.log("u"); console.log("进入此处");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then( let oParams = {};
({ data }) => { oParams.uId = nodeData.id;
if (data.length) { oParams.termType = this.searchType;
data.map((item) => { oParams.term = this.searchText;
item.leaf = true; MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(({ data }) => {
}); if (data.length) {
return resolve(data); data.map((item) => {
} item.leaf = true;
});
return resolve([]); return resolve(data);
} }
);
return resolve([]);
});
return; return;
} }
} }
} }
return resolve([]); return resolve(nodeData);
if (node.level === 0) { if (node.level === 0) {
return resolve([{ name: "region1" }, { name: "region2" }]); return resolve([{ name: "region1" }, { name: "region2" }]);
...@@ -807,6 +816,7 @@ export default { ...@@ -807,6 +816,7 @@ export default {
// 添加监控 // 添加监控
addMonitor(item) { addMonitor(item) {
let _this = this;
if (this.monitorList.count === 100) { if (this.monitorList.count === 100) {
this.$message({ this.$message({
type: "error", type: "error",
...@@ -814,10 +824,15 @@ export default { ...@@ -814,10 +824,15 @@ export default {
}); });
} else { } else {
if (this.monitorList[item.sn]) { if (this.monitorList[item.sn]) {
this.$message({ if (!_this.currentMessage) {
type: "error", _this.currentMessage = this.$message({
message: "该列表中有设备正在监控中,请勿重复监控", type: "error",
}); message: "该列表中有设备正在监控中,请勿重复监控",
onClose: function () {
_this.currentMessage = "";
},
});
}
} else { } else {
this.resetRefreshCount = true; this.resetRefreshCount = true;
this.monitorList.count++; this.monitorList.count++;
...@@ -1070,6 +1085,15 @@ export default { ...@@ -1070,6 +1085,15 @@ export default {
this.monitorList[item.sn].eLocateType = item.eLocateType; this.monitorList[item.sn].eLocateType = item.eLocateType;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation' //item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
}, },
// 重置树
restInitTree() {
this.searchText = "";
this.searchType = "2";
this.treeKey = Math.random();
this.expandedKeys = [];
this.checkedKeys = [];
},
}, },
created() { created() {
if (window.AMap) { if (window.AMap) {
...@@ -1150,4 +1174,12 @@ export default { ...@@ -1150,4 +1174,12 @@ export default {
left: 0; left: 0;
width: 100%; width: 100%;
} }
.monitor_dialog_header {
display: flex;
align-items: center;
justify-content: space-between;
}
.monitor_dialog_header .i_refresh {
cursor: pointer;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!