diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue index 6397444..51022f9 100644 --- a/src/views/realTimeMonitor/index.vue +++ b/src/views/realTimeMonitor/index.vue @@ -274,6 +274,7 @@ export default { type: "", //选中的类型 lineTreeData: [], filterText: "", + searchName: "", defaultProps: { //指定参数格式回显数据 children: "list", @@ -348,6 +349,7 @@ export default { // }, //点击当前选中的treenode handleNodeClick(data) { + this.clearfun(); console.log(data); this.selectData = data; this.zztermId = data.id; @@ -394,12 +396,17 @@ export default { }); }, //树状图搜索 - filterNode(value, data) { - console.log(value, data); - if (!value) return true; - console.log(data.name); + filterNode(value, data, node) { + console.log(value, data, node); - return data.name.indexOf(value) !== -1; + // 如果什么都没填全部匹配全部返回 + if (!value) return true; + this.searchName = data.name + data.cmdid; + console.log(this.searchName); + // 如果传入的value和data中的label相同,匹配成功 + if (this.searchName.indexOf(value) !== -1) { + return true; + } }, //获取左侧树结构 getLineTreeList() { @@ -509,6 +516,7 @@ export default { }, //获取图片 getTerminalPhotoList(id, date, termId) { + this.clearfun(); this.terminalPhoto = []; console.log(id, date, termId); this.swiperLoading = true; @@ -628,9 +636,10 @@ export default { this.requestId = res.data.requestId; //获取requestid 判断装置是否下发 this.picTime = res.data.taketime; //获取时间 判断获取最新图片 console.log(this.requestId); + console.log(this.picTime); this.btnpicloading = true; this.statusTimer = window.setInterval(() => { - this.getTakePicStatus(this.requestId); + this.getTakePicStatus(res.data); this.statusNum++; }, 2000); }) @@ -650,6 +659,7 @@ export default { //主动拍视频 handleCommandvideo(command) { console.log(command); + this.clearfun(); getTermStatus({ termId: this.zztermId }).then((res) => { console.log(res); if (res.data.isonline) { @@ -689,12 +699,14 @@ export default { getTakePicStatus(data) { console.log(data); getTakePicStatusJoggle({ - requestid: data, + requestid: data.requestId, + termId: this.zztermId, + photoTime: new Date(data.taketime).getTime(), }) .then((res) => { console.log(res); //res.data 0 状态未知 1 成功 2失败 - if (res.data == 0 && this.statusNum >= 5) { + if (res.data.cmaStatus == 0 && this.statusNum >= 5) { this.statusNum = 0; clearInterval(this.statusTimer); this.statusTimer = null; @@ -706,7 +718,7 @@ export default { message: "下发指令超时,请重试!", type: "warning", }); - } else if (res.data == 1) { + } else if (res.data.cmaStatus == 1) { this.statusNum = 0; this.btnpicloading = false; this.btnvideoloading = false; @@ -722,7 +734,7 @@ export default { this.newPicApi(); this.i++; }, 8000); - } else if (res.data == 2) { + } else if (res.data.cmaStatus == 2) { this.statusNum = 0; this.btnpicloading = false; this.btnvideoloading = false; @@ -745,6 +757,7 @@ export default { getTakePicPhotoStatusJoggle({ photoTime: new Date(this.picTime).getTime(), termId: this.zztermId, + requestid: this.requestId, }).then((res) => { console.log(res.data); // // console.log(this.i); @@ -789,6 +802,7 @@ export default { handleWarn(val) { console.log("声光报警"); console.log(this.zztermId); + this.clearfun(); getTermStatus({ termId: this.zztermId }).then((res) => { console.log(res); if (res.data.isonline) { @@ -837,12 +851,14 @@ export default { }, //设置时间表 handleSetSchedule() { + this.clearfun(); this.$refs.setschedule_ref.display(); this.$refs.setschedule_ref.getSingleAccess(this.zztermId, this.zzCmdid); this.$refs.setschedule_ref.deviceList(); }, //线缆显示 handleCommandLine(command) { + this.clearfun(); switch (command) { case "open": //开启 this.$refs.carouselpic.openline(); @@ -854,6 +870,7 @@ export default { }, //装置信息handleShowInfo handleShowInfo() { + this.clearfun(); getTermStatus({ termId: this.zztermId }).then((res) => { console.log(res); if (res.data.isonline) { @@ -872,6 +889,7 @@ export default { }, //获取GPS位置 handleShowGPS() { + this.clearfun(); this.$refs.gpsdialog_ref.display(this.zzCmdid, this.zztermId); this.$refs.gpsdialog_ref.getgpssql(); }, @@ -888,6 +906,7 @@ export default { }, changeGPS(val, cmdid) { console.log(val, cmdid); + this.clearfun(); setTermGPSJoggle({ gpsstatus: val, cmdId: cmdid }) .then((res) => { console.log(res); @@ -942,6 +961,7 @@ export default { }, }); // sessionStorage.setItem("keyPath", " realTimeSearch"); + this.clearfun(); }, //拖拽 dragControllerDiv() { @@ -985,6 +1005,19 @@ export default { }; } }, + clearfun() { + console.log("清除轮询"); + this.statusNum = 0; + this.i = 0; + //销毁主动拍照 + clearInterval(this.statusTimer); + this.statusTimer = null; + if (this.timer) { + console.log(this.timer); + clearInterval(this.timer); + this.timer = null; + } //利用vue的生命周期函数 + }, }, destroyed() { @@ -994,23 +1027,12 @@ export default { //销毁主动拍照 clearInterval(this.statusTimer); this.statusTimer = null; - //离开页面是销毁 if (this.timer) { console.log(this.timer); clearInterval(this.timer); this.timer = null; } //利用vue的生命周期函数 }, - beforeRouteLeave(to, from, next) { - // 路由跳转前,清除轮询 - - next(); - if (this.timer) { - console.log(this.timer); - clearInterval(this.timer); - this.timer = null; - } - }, }; diff --git a/src/views/stritl/index.vue b/src/views/stritl/index.vue index 8b12f2f..bb28980 100644 --- a/src/views/stritl/index.vue +++ b/src/views/stritl/index.vue @@ -142,7 +142,7 @@ export default { // 隐患分类统计 changedate2() { console.log(this.dateValue2.getTime()); - this.dateValue = this.dateValue2.getTime(); + this.dateValue2 = this.dateValue2.getTime(); this.getTodayAlarmStatistics(); }, //获取当前时间