From 5d6a6058c4a783f54a5451482f07d81160a79aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?home=E5=AD=99?= <1162067978@qq.com> Date: Fri, 15 Dec 2023 10:31:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=94=E9=98=B2=E9=A1=B5=E9=9D=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=80=BB=E8=BE=91=E6=9B=B4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/setParamsControl.vue | 50 +- src/store/index.js | 2 +- src/utils/util.js | 2 + src/views/control.vue | 42 +- src/views/index.vue | 1 - src/views/wufang/downtake.vue | 585 +++++++++++--------- src/views/wufang/geothermalFan.vue | 41 +- src/views/wufang/rollByRoll.vue | 780 +++++++++++++++------------ src/views/wufang/snowRemoval.vue | 531 +++++++++--------- src/views/wufang/uptake.vue | 807 ++++++++++++++++------------ src/views/wufang/waterPump.vue | 44 +- 11 files changed, 1627 insertions(+), 1258 deletions(-) diff --git a/src/components/setParamsControl.vue b/src/components/setParamsControl.vue index 4279d6d..5cbeba2 100644 --- a/src/components/setParamsControl.vue +++ b/src/components/setParamsControl.vue @@ -78,6 +78,21 @@ export default { this.dataInit(); }, methods: { + countData(data) { + if (data) { + return (data - 400) / 10 + } else { + return 0 + } + }, + // 计算展示值 计算公式 x/10 + countData10(data) { + if (data) { + return data / 10 + } else { + return 0 + } + }, dataInit() { var store = this.$store.state; var data = store.equipmentList[store.equipmentIndex - 1].deviceId; @@ -112,7 +127,40 @@ export default { this.routerNow != "/rollByRoll" && this.routerNow != "/snowRemoval" ) { - this.$router.push({ path: `/waterPump` }); + //调取数据 + var store = this.$store.state; + var data = { + deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, + }; + this.api.readControl_fiveControl(data).then((res) => { + store.ControlData=res.data.data + //加热水泵数据处理waterPump + store.ControlData['21521'] = this.countData(store.ControlData['21521']) + store.ControlData['21522'] = this.countData10(store.ControlData['21522']) + store.ControlData['21523'] = this.countData(store.ControlData['21523']) + store.ControlData['21524'] = this.countData(store.ControlData['21524']) + + //下风口downtake + store.ControlData["21544"] = this.countData(store.ControlData["21544"]); + + //地热风机geothermalFan + store.ControlData['21527'] = this.countData(store.ControlData['21527']) + store.ControlData['21528'] = this.countData10(store.ControlData['21528']) + + //卷被rollByRoll + store.ControlData['21552'] = this.countData(store.ControlData['21552']) + store.ControlData['21550'] = this.countData10(store.ControlData['21550']) + + //除雪snowRemoval + store.ControlData['21544'] = this.countData(store.ControlData['21544']) + + //上风口 + store.ControlData['21532'] = this.countData(store.ControlData['21532']) + store.ControlData['21533'] = this.countData10(store.ControlData['21533']) + store.ControlData['21562'] = this.countData10(store.ControlData['21562']) + + this.$router.push({ path: `/waterPump` }); + }); } } diff --git a/src/store/index.js b/src/store/index.js index 1786a65..a967eea 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,7 +13,7 @@ export default new Vuex.Store({ equipmentName: null,//当前设备 小设备的各个名字 nameList: ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Elven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen'], formulaNum: [16, 48, 80, 112, 144, 176, 208, 240], - + ControlData:null,//控制器五方数据 activeNames:[],//组件内active //label是名称 //value是code码 diff --git a/src/utils/util.js b/src/utils/util.js index e69de29..fff8a50 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -0,0 +1,2 @@ +import Vue from 'vue'; +export const util = new Vue(); \ No newline at end of file diff --git a/src/views/control.vue b/src/views/control.vue index 6a233db..71b4eed 100644 --- a/src/views/control.vue +++ b/src/views/control.vue @@ -1,29 +1,31 @@ + + + // 当控制器整体页面关闭时 清楚控制器数据 + beforeDestroy() { + var store = this.$store.state; + store.ControlData = null; + }, + data() { + return {}; + }, + mounted() {}, + methods: {}, +}; + + diff --git a/src/views/index.vue b/src/views/index.vue index 3279e30..73aa793 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -143,7 +143,6 @@ export default { this.limitUserId = res.data.data; const foundObject = this.limitUserId.find(item => item.id == 3); const foundName = this.headerList.findIndex(item => item.name == '二维码追溯'); - console.log(foundObject,foundName,123456); if(foundObject){ if(foundName==-1){ this.headerList.push({ name: '二维码追溯', router: 'setsuyuan', index: 1, routerList: ['setsuyuan'], img: require('../assets/image/header-img4.png') }) diff --git a/src/views/wufang/downtake.vue b/src/views/wufang/downtake.vue index 09a7eeb..d203608 100644 --- a/src/views/wufang/downtake.vue +++ b/src/views/wufang/downtake.vue @@ -1,279 +1,334 @@ \ No newline at end of file diff --git a/src/views/wufang/geothermalFan.vue b/src/views/wufang/geothermalFan.vue index 1b2957a..6efa37d 100644 --- a/src/views/wufang/geothermalFan.vue +++ b/src/views/wufang/geothermalFan.vue @@ -57,8 +57,24 @@ export default { inputData: {}, } }, + //如果接口还未调通 跳转到页面后 监听到数据变化就触发数据读取 + watch: { + "$store.state.ControlData"(newVal) { + this.dataInit(); + }, + }, + // 当前页面关闭前将数据存入vuex + beforeDestroy() { + var store = this.$store.state; + this.inputData['21526']=this.openIndex + store.ControlData = this.inputData; + }, mounted() { - this.dataInit(); + var store = this.$store.state; + // this.dataInit(); + if(store.ControlData){ + this.dataInit(); + } //input获取焦点后全选 let inputList = document.querySelectorAll('input'); for (let index = 0; index < inputList.length; index++) { @@ -142,19 +158,20 @@ export default { }, dataInit() { var store = this.$store.state - var data = { - deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, - - }; - this.api.readControl_fiveControl(data).then(res => { - if(res.data.code==200){ - this.inputData = res.data.data + this.inputData = store.ControlData this.openIndex = this.inputData['21526'] - this.inputData['21527'] = this.countData(this.inputData['21527']) - this.inputData['21528'] = this.countData10(this.inputData['21528']) - } + // this.inputData['21527'] = this.countData(this.inputData['21527']) + // this.inputData['21528'] = this.countData10(this.inputData['21528']) + // var data = { + // deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, - }) + // }; + // this.api.readControl_fiveControl(data).then(res => { + // if(res.data.code==200){ + + // } + + // }) }, //全选文本 selectValue(e) { diff --git a/src/views/wufang/rollByRoll.vue b/src/views/wufang/rollByRoll.vue index a838a4c..55ad8a8 100644 --- a/src/views/wufang/rollByRoll.vue +++ b/src/views/wufang/rollByRoll.vue @@ -1,368 +1,464 @@ \ No newline at end of file diff --git a/src/views/wufang/snowRemoval.vue b/src/views/wufang/snowRemoval.vue index 6cd8109..edf235c 100644 --- a/src/views/wufang/snowRemoval.vue +++ b/src/views/wufang/snowRemoval.vue @@ -1,267 +1,306 @@ \ No newline at end of file diff --git a/src/views/wufang/uptake.vue b/src/views/wufang/uptake.vue index 7d600c0..0f6bf7d 100644 --- a/src/views/wufang/uptake.vue +++ b/src/views/wufang/uptake.vue @@ -1,372 +1,467 @@ \ No newline at end of file diff --git a/src/views/wufang/waterPump.vue b/src/views/wufang/waterPump.vue index 37e3ccf..2c57f2d 100644 --- a/src/views/wufang/waterPump.vue +++ b/src/views/wufang/waterPump.vue @@ -65,8 +65,24 @@ export default { inputData: {}, } }, + //如果接口还未调通 跳转到页面后 监听到数据变化就触发数据读取 + watch: { + "$store.state.ControlData"(newVal) { + this.dataInit(); + }, + }, + // 当前页面关闭前将数据存入vuex + beforeDestroy() { + var store = this.$store.state; + this.inputData['21520']= this.openIndex + store.ControlData = this.inputData; + }, mounted() { - this.dataInit(); + var store = this.$store.state; + // this.dataInit(); + if(store.ControlData){ + this.dataInit(); + } //input获取焦点后全选 let inputList = document.querySelectorAll('input'); for (let index = 0; index < inputList.length; index++) { @@ -150,22 +166,22 @@ export default { }, dataInit() { var store = this.$store.state - var data = { - deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, - - }; - this.api.readControl_fiveControl(data).then(res => { - if(res.data.code==200){ - this.inputData = res.data.data + this.inputData = store.ControlData this.openIndex = this.inputData['21520'] - this.inputData['21521'] = this.countData(this.inputData['21521']) - this.inputData['21522'] = this.countData10(this.inputData['21522']) - this.inputData['21523'] = this.countData(this.inputData['21523']) - this.inputData['21524'] = this.countData(this.inputData['21524']) - } + // this.inputData['21521'] = this.countData(this.inputData['21521']) + // this.inputData['21522'] = this.countData10(this.inputData['21522']) + // this.inputData['21523'] = this.countData(this.inputData['21523']) + // this.inputData['21524'] = this.countData(this.inputData['21524']) + // var data = { + // deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, + // }; + // this.api.readControl_fiveControl(data).then(res => { + // if(res.data.code==200){ + + // } - }) + // }) }, //全选文本 selectValue(e) { -- 2.40.1