diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/imageCapture.vue b/src/views/management/monitoringEquipment/photographicDevice/components/imageCapture.vue index 24bee10..1164e6e 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/imageCapture.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/imageCapture.vue @@ -5,6 +5,7 @@ :visible.sync="isShow" :close-on-click-modal="false" width="60%" + @close="handleclose" > @@ -185,6 +186,7 @@ export default { ], }, timer: null, + i: 0, seltermid: "", //装置id selcmdId: "", //cmdId requestId: "", @@ -232,6 +234,7 @@ export default { this.inquirenr(); this.timer = window.setInterval(() => { this.inquirenr(); + this.i++; }, 10000); } else { this.$message.error(res.code.msg); @@ -249,12 +252,15 @@ export default { .then((res) => { this.loading = false; if (res.code == 200) { + this.capturenr = res.data; if (res.data.isNew == true) { this.$message.success("查询已更新"); - this.capturenr = res.data; clearInterval(this.timer); - } else { - this.capturenr = res.data; + this.timer = null; + } else if(this.i > 9) { + this.$message.warning("暂无响应,请稍后再试!"); + clearInterval(this.timer); + this.timer = null; } } else { this.$message.error(res.code.msg); @@ -291,6 +297,10 @@ export default { hide() { this.isShow = false; }, + handleclose() { + clearInterval(this.timer); + this.timer = null; + }, }, }; diff --git a/src/views/realTimeMonitor/components/infoDialog.vue b/src/views/realTimeMonitor/components/infoDialog.vue index 392b4fe..b1d8312 100644 --- a/src/views/realTimeMonitor/components/infoDialog.vue +++ b/src/views/realTimeMonitor/components/infoDialog.vue @@ -65,6 +65,7 @@ export default { isShow: false, infornr: {}, //装置信息内容 timer: null, + i: 0, queryTime: "", //查询ID cmdid: "", }; @@ -83,30 +84,32 @@ export default { this.getNewListData(val); this.timer = window.setInterval(() => { this.getNewListData(val); + this.i++; }, 10000); - this.loading = false; }) .catch((err) => {}); }, //最新数据 getNewListData(val) { - //this.loading = true; getNewDeviceList({ queryTime: this.queryTime, termId: val, }) .then((res) => { - if (res.data.isNew == true) { + this.loading = false; + if (res.code == 200) { this.infornr = res.data; - this.$message({ - message: "装置信息已更新", - type: "success", - }); - clearInterval(this.timer); + if (res.data.isNew == true) { + this.$message.success("装置信息已更新"); + clearInterval(this.timer); + } else if(this.i > 9) { + this.$message.warning("暂无响应,请稍后再试!"); + clearInterval(this.timer); + } } else { - this.infornr = res.data; + this.$message.error(res.code.msg); } - //this.loading = false; + }) .catch((err) => {}); },