From 9b8079a7ea194a024004e8acb3a3874b95ec4229 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 17 Feb 2020 10:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=97=E4=BA=AC=E4=B8=80=E5=8F=B7=E7=BA=BF?= =?UTF-8?q?=20=E6=96=B0=E7=89=88=20=E6=8C=87=E4=BB=A4=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menus/dialog/routeHandControl.vue | 91 +++++++------------ 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/src/jmapNew/theme/beijing_01/menus/dialog/routeHandControl.vue b/src/jmapNew/theme/beijing_01/menus/dialog/routeHandControl.vue index 105eed899..8d399ef84 100644 --- a/src/jmapNew/theme/beijing_01/menus/dialog/routeHandControl.vue +++ b/src/jmapNew/theme/beijing_01/menus/dialog/routeHandControl.vue @@ -36,12 +36,13 @@ @@ -100,7 +101,9 @@ export default { selection: [], stationName: '', signalName: '', - allSelect: false + allSelect: false, + changeList:[], + commitDisabled: true }; }, computed: { @@ -136,22 +139,8 @@ export default { return ''; } }, - commitDisabled() { - let disabled = true; - if (this.selection && this.selection.length) { - disabled = false; - } - return disabled; - } }, watch: { - // 深度数据状态 - // tempData: { - // handler(val, oldVal) { - // this.checkTableDataSelction(val); - // }, - // deep: true - // } }, mounted() { this.$nextTick(() => { @@ -161,7 +150,8 @@ export default { methods: { doShow(operate, selected, tempData) { this.selected = selected; - this.allSelect=false; + this.allSelect = false; + this.changeList = []; // 如果不是断点激活,而是第一次显示则初始化 if (!this.dialogShow) { this.signalName = ''; @@ -204,58 +194,43 @@ export default { this.$store.dispatch('training/emitTipFresh'); mouseCancelState(this.selected); }, - changeCheck(check,code){ - if(check){ + changeCheck(check, code) { + if (check) { this.selection.push(code); - }else{ - this.selection.splice(this.selection.indexOf(code),1); + } else { + this.selection.splice(this.selection.indexOf(code), 1); } - if(this.selection.length>=this.tempData.length){ - this.allSelect=true; - }else{ - this.allSelect=false; + if (this.selection.length >= this.tempData.length) { + this.allSelect = true; + } else { + this.allSelect = false; + } + if (this.selection.length > 0) { + this.commitDisabled = false; + } else { + this.commitDisabled = true; } }, - // checkTableDataSelction(data) { - // const selection = []; - // if (data && data.length > 0) { - // data.forEach(row => { - // if (row.check && !row.disabled) { - // selection.push(row); - // } - // }); - // } - - // if (JSON.stringify(selection) !== JSON.stringify(this.selection)) { - // this.handleChooseChange(selection); - // this.selection = selection; - // } - // let num = 0; - // this.allSelect = false; - // this.tempData.forEach(item => { - // if (item.check) { - // num++; - // if (num == this.tempData.length) { - // this.allSelect = true; - // } - // } - // }); - // }, allSelectChange() { + this.changeList = []; if (this.allSelect) { - this.tempData.forEach(item => { + this.tempData.forEach((item, index)=> { if (!item.disabled) { - item.check = true; - this.changeCheck(true,item.code); + this.changeList.push(true); + this.selection.push(item.code); } }); + this.allSelect = true; + this.commitDisabled = false; } else { - this.tempData.forEach(item => { + this.tempData.forEach((item, index) => { if (!item.disabled) { - item.check = false; - this.changeCheck(false,item.code); + this.changeList.push(false); + this.selection.splice(this.selection.indexOf(item.code), 1); } }); + this.allSelect = false; + this.commitDisabled = true; } }, serializeCodeListWithSeparator(sep) {