From 763d04d63055548ecc4e525394c69a72b17122d5 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 9 Jul 2020 15:09:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=A7=E6=9C=AC=E7=BC=96=E5=88=B6=20?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=A7=92=E8=89=B2=20=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=8E=89=E4=B8=8D=E5=9C=A8=E7=BA=BF=E7=9A=84=E5=8F=B8=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/map.js | 10 ++++-- .../display/tipScriptRecordNew.vue | 34 ++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/store/modules/map.js b/src/store/modules/map.js index 86abc5e2a..d48a23e90 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -223,6 +223,7 @@ const map = { mousemove: 0, // 实训战场图移动标识 version: '', // 地图版本, activeTrainListUpdate:0, // 当前按计划行车的列车列表更新标识 + activeTrainListChange:0, // 当前按计划行车的列车列表变化标识(只对列车的groupNumber进行了检测) activeTrainList:[], // 当前按计划行车的列车列表 runPlanStatus:false, // 是否正处于按计划行车 showCentralizedStationCode: '', // 现地分集中站显示(集中站code) @@ -853,10 +854,15 @@ const map = { let isExist = false; state.activeTrainList.forEach(elem => { if (elem == data.code) { - isExist = true; + if (data.dispose) { + state.activeTrainList.splice(state.activeTrainList.indexOf(data.code), 1); + state.activeTrainListChange += 1; + } else { + isExist = true; + } } }); - if (!isExist) { state.activeTrainList.push(data.code); } + if (!isExist) { state.activeTrainList.push(data.code); state.activeTrainListChange += 1; } } }, diff --git a/src/views/scriptManage/display/tipScriptRecordNew.vue b/src/views/scriptManage/display/tipScriptRecordNew.vue index c94cb0942..8ab369fb5 100644 --- a/src/views/scriptManage/display/tipScriptRecordNew.vue +++ b/src/views/scriptManage/display/tipScriptRecordNew.vue @@ -65,6 +65,7 @@ export default { autoSaveScript: null, isSavingScript: false, mapLocation:null, + allMemberList:[], memberList:[], size: { width: 300, @@ -91,8 +92,12 @@ export default { '$store.state.scriptRecord.simulationPause': function(val) { this.isPause = !(this.$store.state.scriptRecord.simulationPause); }, - '$store.state.map.runPlanStatus':function (val) { - this.$refs.getAction.loadInitData(); + // '$store.state.map.runPlanStatus':function (val) { + // // this.$refs.getAction.loadInitData(); + // this.changeRunPlanStatus(); + // }, + '$store.state.map.activeTrainListChange':function (val) { + this.changeRunPlanStatus(); } }, beforeDestroy() { @@ -106,18 +111,39 @@ export default { this.backDisabled = response.data.bgSet; this.mapLocation = response.data.mapLocation; this.$store.dispatch('scriptRecord/updateBgSet', response.data.bgSet); - if (response.data.bgSet) { this.$store.dispatch('map/setRunPlanStatus', true); } + // if (response.data.bgSet) { this.$store.dispatch('map/setRunPlanStatus', true); } }); }, methods:{ initData() { getSimulationMemberList(this.group).then(resp => { const lastData = JSON.stringify(resp.data); - this.memberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); + this.allMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); + this.changeRunPlanStatus(); }).catch(error => { this.$message(error.message); }); }, + changeRunPlanStatus() { + debugger; + this.memberList = []; + if (this.$store.state.map.runPlanStatus) { + const activeList = this.$store.state.map.activeTrainList; + this.allMemberList.forEach(allmember=>{ + if (allmember.type == '司机') { + if (activeList.length > 0 && activeList.includes(allmember.deviceCode)) { + this.memberList.push(allmember); + } + } else { + this.memberList.push(allmember); + } + }); + } else { + this.memberList = this.allMemberList.filter(member=>{ + return member.type != '司机'; + }); + } + }, minisize() { if (this.isShow) { this.isShow = false;