From 6b78e2b5fc6c7e2b77265cd83703fb951e4e4225 Mon Sep 17 00:00:00 2001 From: fanluyan <754122931@qq.com> Date: Thu, 25 May 2023 20:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=A1=A8=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/setdevice.vue | 113 +++++------------- 1 file changed, 27 insertions(+), 86 deletions(-) diff --git a/src/views/devicePhotoSchedule/components/setdevice.vue b/src/views/devicePhotoSchedule/components/setdevice.vue index 0d5e938..1ca8caf 100644 --- a/src/views/devicePhotoSchedule/components/setdevice.vue +++ b/src/views/devicePhotoSchedule/components/setdevice.vue @@ -38,7 +38,7 @@ ref="tree" node-key="id" :default-expand-all="true" - @check="getCheckedNodes" + @check-change="getCheckedNodes" > {{ data.name }}--{{ data.id }} - 装置下发成功 - 装置下发中 - 装置下发失败装置下发中 + {{ data.name }} @@ -115,6 +120,11 @@ export default { zzsuccess: false, zzpending: false, zzerror: false, + + allCheckNode: [], //获取选中的节点 + + requestArr: [], //通过requestid获取状态 + termzzid: "", }; }, mounted() {}, @@ -157,72 +167,25 @@ export default { console.log(this.zzListCheck); }, - //获取所选值 + // //获取所选值 getCheckedNodes() { - this.parmsList = []; - const checkedNodes = this.$refs.tree.getCheckedNodes(false, true); //若节点可被选择,则返回目前被选中的节点所组成的数组 - //const checkedParam = []; //定义选中的数组 - let index = -1; - console.log(checkedNodes); - if (checkedNodes.length !== 0) { - checkedNodes.forEach((item) => { - if (item.list == undefined) { - console.log("1111111111111"); - console.log(item); - this.termidArr.push(item.id); - } - - // 父节点结构的情况 判断是否有list子节点,如果有定义数组结构 - // if (item.list !== undefined) { - // index++; - // this.parmsList[index] = { - // //name: item.name, - // termid: item.id, - // channelidlist: [], - // }; - // console.log(item); - // } else { - // console.log("aaaaaaaaaaaaaa"); - // //如果没有list 把子节点id push到 定义的数组channelidlist中 - // this.parmsList[index].channelidlist.push(item.id); - // } - //通过bsManufacturer 判断是否是 线路 获取线路id - // if (item.bsManufacturer !== undefined) { - // this.ruleid = item.id; - // console.log(this.ruleid); - // } - }); - } - // console.log(this.parmsList); - //遍历删除没有channelichilddlist的数据,只留下通道 - this.parmsList = this.parmsList - .filter((item) => item.channelidlist.length !== 0) - .map((item) => { - return { - termid: this.termidArr[0], - channelidlist: [this.checkedAisle], - }; - }); - - this.termidArr = Array.from(new Set(this.termidArr)); - console.log(this.termidArr); - console.log(this.parmsList); - return this.parmsList; + this.allCheckNode = this.$refs.tree.getCheckedNodes(); + console.log(this.allCheckNode); }, // 保存确定操作 submitForm() { - console.log(this.termidArr); + //console.log(this.termidArr); this.sureSum(); }, //时间表 sureSum() { - console.log(this.termidArr); + //console.log(this.termidArr); console.log(this.checkedAisle); var ruleBox = []; - for (var i = 0; i < this.termidArr.length; i++) { + for (var i = 0; i < this.allCheckNode.length; i++) { var parmsobj = { - termid: this.termidArr[i], + termid: this.allCheckNode[i].id, channelidlist: [this.checkedAisle], }; console.log(parmsobj); @@ -236,16 +199,7 @@ export default { .then((res) => { console.log(res); this.requestList = res.data.list; - console.log("0000000000000000"); this.requestTime(); - this.timer = window.setInterval(() => { - this.requestTime(); - this.i++; - }, 10000); - // this.$message({ - // showClose: true, - // message: '添加成功',type: 'success' - // }); }) .catch((err) => { this.$message({ @@ -261,26 +215,13 @@ export default { list: this.requestList, }) .then((res) => { - console.log("1111111111111111111111111111111"); - console.log("1111111111111111111111111111111"); - console.log("1111111111111111111111111111111"); - console.log("1111111111111111111111111111111"); console.log(res); - - if (res.data.list.length > 0) { - for (var j = 0; j < res.data.list.length; j++) { - if (res.data.list[j].status == 1) { - this.zzsuccess = true; - } else { - this.zzerror = true; - } + this.requestArr = res.data.list; + for (var i = 0; i < this.requestArr.length; i++) { + console.log(this.requestArr[i].status); + if (this.requestArr[i].status == 1) { + } else { } - clearInterval(this.timer); - this.timer = null; - } else if (this.i > 9) { - this.$message.warning("暂无响应,请稍后再试!"); - clearInterval(this.timer); - this.timer = null; } }) .catch((err) => {});