Commit 97e7eccb by 张杰

优化监控页面树形搜索

1 parent 91c1c062
......@@ -75,8 +75,9 @@
</div>
</div>
<div class="filter-dialog animated " :class="listDialogHidden?'fadeOut':'active fadeIn'">
<div class="filter-dialog-header">
监控列表({{monitorList.count}})
<div class="filter-dialog-header monitor_dialog_header">
<span>监控列表({{monitorList.count}})</span>
<i class="el-icon-close pull-right" @click.stop="listDialogHidden=true"></i>
</div>
<div class="filter-dialog-body">
......@@ -139,13 +140,14 @@
</div>
</div>
<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>
</div>
<div class="filter-dialog-body">
<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>
</div>
......@@ -227,6 +229,8 @@ export default {
checkedKeys: [],
autocompleteHide: true,
treeLoading: true,
currentMessage: "", //当前是否有提示语弹框
treeKey: "",
};
},
computed: {
......@@ -358,12 +362,11 @@ export default {
checkFlow(data, node) {
let action = MONITOR_SERVICE.getVehicleTreeUserIds;
let params = { oId: data.id };
if (data.origin.type === "u") {
action = MONITOR_SERVICE.getVehicleTreeUserList;
params = { uId: data.id };
}
params.termType = this.searchType;
params.term = this.searchText;
this.treeLoading = true;
......@@ -466,7 +469,11 @@ export default {
} else {
if (origin.type === "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 }) => {
if (data.length) {
data.map((item) => {
......@@ -491,25 +498,27 @@ export default {
return resolve(nodeData.children);
} else {
if (origin.type === "u") {
console.log("u");
MONITOR_SERVICE.getVehicleTreeUserList({ uId: nodeData.id }).then(
({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
});
return resolve(data);
}
return resolve([]);
console.log("进入此处");
let oParams = {};
oParams.uId = nodeData.id;
oParams.termType = this.searchType;
oParams.term = this.searchText;
MONITOR_SERVICE.getVehicleTreeUserList(oParams).then(({ data }) => {
if (data.length) {
data.map((item) => {
item.leaf = true;
});
return resolve(data);
}
);
return resolve([]);
});
return;
}
}
}
return resolve([]);
return resolve(nodeData);
if (node.level === 0) {
return resolve([{ name: "region1" }, { name: "region2" }]);
......@@ -807,6 +816,7 @@ export default {
// 添加监控
addMonitor(item) {
let _this = this;
if (this.monitorList.count === 100) {
this.$message({
type: "error",
......@@ -814,10 +824,15 @@ export default {
});
} else {
if (this.monitorList[item.sn]) {
this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
});
if (!_this.currentMessage) {
_this.currentMessage = this.$message({
type: "error",
message: "该列表中有设备正在监控中,请勿重复监控",
onClose: function () {
_this.currentMessage = "";
},
});
}
} else {
this.resetRefreshCount = true;
this.monitorList.count++;
......@@ -1070,6 +1085,15 @@ export default {
this.monitorList[item.sn].eLocateType = item.eLocateType;
//item.eLocateType = item.eLocateType==='gpsLocation'?'bsLocation':'gpsLocation'
},
// 重置树
restInitTree() {
this.searchText = "";
this.searchType = "2";
this.treeKey = Math.random();
this.expandedKeys = [];
this.checkedKeys = [];
},
},
created() {
if (window.AMap) {
......@@ -1150,4 +1174,12 @@ export default {
left: 0;
width: 100%;
}
.monitor_dialog_header {
display: flex;
align-items: center;
justify-content: space-between;
}
.monitor_dialog_header .i_refresh {
cursor: pointer;
}
</style>
\ 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!