diff --git a/src/scripts/cmdPlugin/newValidateHandler.js b/src/scripts/cmdPlugin/newValidateHandler.js index 3c05a3f13..460d15065 100644 --- a/src/scripts/cmdPlugin/newValidateHandler.js +++ b/src/scripts/cmdPlugin/newValidateHandler.js @@ -22,6 +22,28 @@ class ValidateHandler { valid = false; } return valid; } + checkDeviceCodeConsistent(deviceCode1, deviceCode2) { + const linkDeviceCode1 = store.state.map.linkSwitchMap[deviceCode1]; + console.log(deviceCode1, deviceCode2, linkDeviceCode1, linkDeviceCode1 === deviceCode2); + return deviceCode1 === deviceCode2 || linkDeviceCode1 === deviceCode2; + } + checkParamConsistent(param1, param2) { + const linkParam = {}; + let linkDataFlag = false; + for (const key in param1) { + linkParam[key] = param1[key]; + if (store.state.map.linkSwitchMap[param1[key]]) { + linkDataFlag = true; + linkParam[key] = store.state.map.linkSwitchMap[param1[key]]; + } + } + console.log(linkDataFlag, linkParam, param2, objectIsEqual(linkParam, param2)); + if (linkDataFlag) { + return objectIsEqual(param1, param2) || objectIsEqual(linkParam, param2); + } else { + return objectIsEqual(param1, param2); + } + } // 判断实训操作正确性 judgeTraining(operate) { let stepOperation = {}; @@ -36,7 +58,7 @@ class ValidateHandler { valid = (cmd === stepOperation.operationType) && valid; } if (operate.code || stepOperation.deviceCode) { - valid = (operate.code === stepOperation.deviceCode) && valid; + valid = this.checkDeviceCodeConsistent(operate.code, stepOperation.deviceCode) && valid; } if (stepOperation.subType) { valid = (operate.subType === stepOperation.subType) && valid; @@ -54,7 +76,7 @@ class ValidateHandler { const opParam = operate.param === undefined ? {} : operate.param; if ((opParam || stepOperation.params) && !opParam.hasOwnProperty('fileBase64Str')) { - valid = objectIsEqual(opParam, stepOperation.params) && valid; + valid = this.checkParamConsistent(opParam, stepOperation.params) && valid; } if (valid && store.state.trainingNew.voiceStepIndex > -1) { diff --git a/src/store/modules/map.js b/src/store/modules/map.js index d3b1cb5c3..4c20295aa 100644 --- a/src/store/modules/map.js +++ b/src/store/modules/map.js @@ -259,7 +259,8 @@ const map = { pictureDeviceMap: {}, // 画面设备修正map picture:'', // 当前的客户端 domConfig: null, // 仿真配置 - initClient: '' // 仿真初始客户端 + initClient: '', // 仿真初始客户端 + linkSwitchMap: {} // 联动道岔数据 }, getters: { @@ -1147,6 +1148,9 @@ const map = { }, setPicture: (state, picture) => { state.picture = picture; + }, + setLinkSwitchMap: (state, linkSwitchMap) => { + state.linkSwitchMap = linkSwitchMap; } }, @@ -1429,6 +1433,9 @@ const map = { }, setPicture: ({ commit }, picture) => { commit('setPicture', picture); + }, + setLinkSwitchMap: ({ commit }, linkSwitchMap) => { + commit('setLinkSwitchMap', linkSwitchMap); } } }; diff --git a/src/views/newMap/display/index.vue b/src/views/newMap/display/index.vue index f5e39329c..03ce0b51f 100644 --- a/src/views/newMap/display/index.vue +++ b/src/views/newMap/display/index.vue @@ -115,6 +115,7 @@ export default { } this.$store.dispatch('socket/resetRailCtcRunplanInitMsg'); // 清除阶段计划 this.$store.dispatch('socket/clearDispatchCommandMsg'); // 清除调度命令 + this.$store.dispatch('map/setLinkSwitchMap', {}); }, methods:{ overallTranslation(flag) { @@ -133,6 +134,7 @@ export default { if (resp && resp.data && !resp.data.dataError) { this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan); this.$store.dispatch('training/setDomConfig', resp.data.paramVO && resp.data.paramVO.domConfig ? resp.data.paramVO.domConfig : {}); + this.$store.dispatch('map/setLinkSwitchMap', resp.data.linkSwitchMap || {}); loadMapDataById(this.mapId, 'simulation'); if (this.simType === 'METRO') { this.loadRunPlan();