diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/parameterSetDialog.vue b/src/views/management/monitoringEquipment/photographicDevice/components/parameterSetDialog.vue index f581dc6..21c090e 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/parameterSetDialog.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/parameterSetDialog.vue @@ -400,7 +400,7 @@ export default { tabsActive: "first", rowData: {}, requestid: "", - timer: null, + uptimer: null, i: 0, }; }, @@ -430,14 +430,23 @@ export default { //采样参数重置数据 samphandleClick() { this.samplingForm = {}; + this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; }, //上位机重置数据 uphandleClick() { this.upperComputer = {}; + this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; }, //id重置数据 idhandleClick() { this.idParameter = {}; + this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; }, //采样参数查询 // -act=sampling [0xA4 ] --flag=[Request Set Flag, default is set=1, 0: request] --rf=[Request Flag] --reqtype=[Request Type] --maintime=[Main Time] --samplecount=[Sample Count] --samplingfreq=[Sample Frequency] --heartbeat=[Heartbeat Time] @@ -452,14 +461,14 @@ export default { name: "flag", value: 0, }, - { - name: "rf", - value: 15, - }, - { - name: "reqtype", - value: "0xA4", - }, + // { + // name: "rf", + // value: 15, + // }, + // { + // name: "reqtype", + // value: "0xA4", + // }, { name: "maintime", value: "", @@ -504,14 +513,14 @@ export default { name: "flag", value: 1, }, - { - name: "rf", - value: 15, - }, - { - name: "reqtype", - value: "0xA4", - }, + // { + // name: "rf", + // value: 15, + // }, + // { + // name: "reqtype", + // value: "0xA4", + // }, { name: "maintime", value: this.samplingForm.mainTime, @@ -710,7 +719,7 @@ export default { console.log(res); this.requestid = res.data.requestId; this.getinfo(); - this.timer = window.setInterval(() => { + this.uptimer = window.setInterval(() => { this.getinfo(); this.i++; }, 1000); @@ -721,29 +730,49 @@ export default { getTermCameraRequest({ requestid: this.requestid }) .then((res) => { if (res.data.success == 1) { + this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; + console.log("终止轮询"); // && res.data.result == 255 console.log(JSON.parse(res.data.data)); this.samplingForm = JSON.parse(res.data.data); + console.log(this.tabsActive); this.upperComputer = JSON.parse(res.data.data); + console.log(this.upperComputer); + let hexArray = this.upperComputer.ip + .toString(16) + .match(/.{1,2}/g) + .reverse(); + console.log(hexArray); + + for (let i = 0; i < hexArray.length; i++) { + console.log(hexArray[i]); + console.log(parseInt(hexArray[i], 16)); + hexArray[i] = parseInt(hexArray[i], 16); + } + console.log(hexArray); + this.upperComputer.ip = hexArray.join("."); + this.idParameter = JSON.parse(res.data.data); - this.i = 0; + this.$message({ duration: 1500, showClose: true, message: "信息已更新", type: "success", }); - clearInterval(this.timer); } else if (this.i > 9) { this.loading = false; this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; this.$message({ duration: 1500, showClose: true, message: "暂未获取到信息,请稍后再试!!", type: "warning", }); - clearInterval(this.timer); } }) .catch(); @@ -816,7 +845,13 @@ export default { this.isShow = false; this.activeName = "2"; this.tabsActive = "first"; + this.samplingForm = {}; + this.upperComputer = {}; + this.idParameter = {}; this.gpsForm = {}; + this.i = 0; + clearInterval(this.uptimer); + this.uptimer = null; }, }, };