From c15a9d9aaa3e962c2ba51d29bfbe05f3a0414d98 Mon Sep 17 00:00:00 2001 From: fanluyan <754122931@qq.com> Date: Wed, 13 Sep 2023 13:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AE=E5=B7=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/setschedule.vue | 186 +++++++----------- vue.config.js | 6 +- 2 files changed, 69 insertions(+), 123 deletions(-) diff --git a/src/views/realTimeMonitor/components/setschedule.vue b/src/views/realTimeMonitor/components/setschedule.vue index 69d73ec..aabcf05 100644 --- a/src/views/realTimeMonitor/components/setschedule.vue +++ b/src/views/realTimeMonitor/components/setschedule.vue @@ -58,15 +58,7 @@ >{{ val.substring(val.length - 5) }} {{ val.substring(val.length - 5) }} { - //console.log(res); + console.log(res); this.requestId = res.data.requestId; - // this.realNewtime(); + this.realNewtime(); this.timer = window.setInterval(() => { + //console.log(this.requestList); this.realNewtime(); - console.log("时间", this.timernum); - console.log("时间间隔", this.intervalNum); this.timernum++; - }, this.intervalNum); + }, 3000); }) .catch((err) => { this.$message.error("查询失败"); @@ -666,8 +631,8 @@ export default { this.compareloading = false; this.newshedulenr = res.data.list; this.offsetnum = res.data.offset; - // console.log("qqqqqqqqqqqqqqqqqqqqqq"); - // console.log(this.offsetnum); + console.log("qqqqqqqqqqqqqqqqqqqqqq"); + console.log(this.offsetnum); //湖南规约 if (this.timeProtocol == "65283") { console.log("湖南规约"); @@ -711,7 +676,7 @@ export default { } } console.log("222222222222222222"); - // console.log(hnarr); + console.log(hnarr); console.log("22222222222222222222222"); let dayArr = []; //根据开始时间结束时间生产数组 @@ -741,19 +706,14 @@ export default { // this.$moment(new Date(endDay)).format("YYYY-MM-DD HH:mm") // ); - //console.log(dayArr); + console.log(dayArr); this.newshedulenr = dayArr; } } //河南规约 if ( this.timeProtocol == "65286" || - this.timeProtocol == "65282" || - this.timeProtocol == "65280" || - this.timeProtocol == "65296" || - this.timeProtocol == "65281" || - this.timeProtocol == "65284" || - this.timeProtocol == "65285" + this.timeProtocol == "65282" ) { console.log("河南规约"); var hnarr = []; @@ -766,7 +726,7 @@ export default { console.log(timeDate); hnarr.push(timeDate); } - // console.log(hnarr); + console.log(hnarr); this.newshedulenr = hnarr; } this.timernum = 0; @@ -1083,62 +1043,52 @@ export default { console.log(timearr); } - ////判断河南规约 - if ( - this.deviceListData.zzprotocol == "65286" || - this.deviceListData.zzprotocol == "65282" || - this.deviceListData.zzprotocol == "65280" || - this.deviceListData.zzprotocol == "65296" || - this.deviceListData.zzprotocol == "65281" || - this.deviceListData.zzprotocol == "65284" || - this.deviceListData.zzprotocol == "65285" - ) { - console.log("河南规约"); - //偏移时间 - //this.getDayArr(startDay, endDay); - let startDay = Stime; - let endDay = Etime; - var lastendDay = lastETime; - console.log(startDay, endDay); - let startVal = this.$moment(new Date(startDay)).format( - "YYYY-MM-DD HH:mm" - ); - console.log(startVal); + } - while (this.$moment(startVal).isBefore(endDay)) { - dayArr.push(startVal); - // 自增 - startVal = this.$moment(new Date(startVal)) - .add(spanTime, "minute") - .format("YYYY-MM-DD HH:mm"); - console.log(startVal); - } + ////判断河南规约 + if ( + this.deviceListData.zzprotocol == "65286" || + this.timeProtocol == "65282" + ) { + console.log("河南规约"); + //偏移时间 + //this.getDayArr(startDay, endDay); + let startDay = Stime; + let endDay = Etime; + var lastendDay = lastETime; + console.log(startDay, endDay); + let startVal = this.$moment(new Date(startDay)).format( + "YYYY-MM-DD HH:mm" + ); + console.log(startVal); - // // 将结束日期的天放进数组 - if (!moment().isSame(moment(endDay), "day")) { - console.log("dayArr最后一天啊"); - console.log(dayArr); - console.log( - lastETime, - this.$moment(new Date(lastETime)).format("YYYY-MM-DD HH:mm") - ); - // dayArr.push( - // this.$moment(new Date(lastETime)).format("YYYY-MM-DD HH:mm") - // ); - } + while (this.$moment(startVal).isBefore(endDay)) { + dayArr.push(startVal); + // 自增 + startVal = this.$moment(new Date(startVal)) + .add(spanTime, "minute") + .format("YYYY-MM-DD HH:mm"); + console.log(startVal); + } - // return dayArr; + // // 将结束日期的天放进数组 + if (!moment().isSame(moment(endDay), "day")) { + dayArr.push( + this.$moment(new Date(lastETime)).format("YYYY-MM-DD HH:mm") + ); } + console.log(dayArr); + for (var k = 0; k < dayArr.length; k++) { + //console.log(moment(dayArr[k]).hour()); + timearr.push({ + hour: moment(dayArr[k]).hour(), + minute: moment(dayArr[k]).minute(), + preset: 255, + }); + } + // return dayArr; } - console.log(dayArr); - for (var k = 0; k < dayArr.length; k++) { - //console.log(moment(dayArr[k]).hour()); - timearr.push({ - hour: moment(dayArr[k]).hour(), - minute: moment(dayArr[k]).minute(), - preset: 255, - }); - } + var parmsobj = { termid: this.deviceListData.zzid, channelid: this.checkList, @@ -1209,7 +1159,7 @@ export default { clearInterval(this.timers); this.timers = null; } else if (this.i > 9) { - //this.isShowset = false; + this.isShowset = false; this.sureloading = false; this.i = 0; this.$message.warning("下发失败,请稍后再试!"); @@ -1225,7 +1175,7 @@ export default { this.checkList = ""; // this.setNum = this.offsetnum; this.deviceList(); - this.sureloading = false; + clearInterval(this.timers); this.timers = null; }, @@ -1238,14 +1188,10 @@ export default { handleclose() { this.newshedulenr = []; this.shedulenr = []; - this.sureloading = false; - this.compareloading = false; - clearInterval(this.timer); + console.log("关闭轮询"); clearInterval(this.timers); this.timers = null; - this.timer = null; - console.log("关闭轮询", "loading"); }, }, }; diff --git a/vue.config.js b/vue.config.js index 0c32024..040028d 100644 --- a/vue.config.js +++ b/vue.config.js @@ -29,11 +29,11 @@ module.exports = defineConfig({ proxy: { "/api": { //表示拦截以/api开头的请求路径 - // target: "http://47.96.238.157:8093", //阿里云服务器环境 - target: "http://180.166.218.222:40080", //dell + target: "http://47.96.238.157:8093", //阿里云服务器环境 + //target: "http://180.166.218.222:40080", //dell changOrigin: true, //是否开启跨域 pathRewrite: { - "^/api": "/api", //重写api,把api变成空字符,因为我们真正请求的路径是没有api的 + "^/api": "", //重写api,把api变成空字符,因为我们真正请求的路径是没有api的 }, }, },