调整:校验实训联动道岔判断调整

This commit is contained in:
fan 2023-02-10 17:09:40 +08:00
parent 09f27b7bfa
commit 296594bc8e
3 changed files with 34 additions and 3 deletions

View File

@ -22,6 +22,28 @@ class ValidateHandler {
valid = false; valid = false;
} return valid; } 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) { judgeTraining(operate) {
let stepOperation = {}; let stepOperation = {};
@ -36,7 +58,7 @@ class ValidateHandler {
valid = (cmd === stepOperation.operationType) && valid; valid = (cmd === stepOperation.operationType) && valid;
} }
if (operate.code || stepOperation.deviceCode) { if (operate.code || stepOperation.deviceCode) {
valid = (operate.code === stepOperation.deviceCode) && valid; valid = this.checkDeviceCodeConsistent(operate.code, stepOperation.deviceCode) && valid;
} }
if (stepOperation.subType) { if (stepOperation.subType) {
valid = (operate.subType === stepOperation.subType) && valid; valid = (operate.subType === stepOperation.subType) && valid;
@ -54,7 +76,7 @@ class ValidateHandler {
const opParam = operate.param === undefined ? {} : operate.param; const opParam = operate.param === undefined ? {} : operate.param;
if ((opParam || stepOperation.params) && !opParam.hasOwnProperty('fileBase64Str')) { 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) { if (valid && store.state.trainingNew.voiceStepIndex > -1) {

View File

@ -259,7 +259,8 @@ const map = {
pictureDeviceMap: {}, // 画面设备修正map pictureDeviceMap: {}, // 画面设备修正map
picture:'', // 当前的客户端 picture:'', // 当前的客户端
domConfig: null, // 仿真配置 domConfig: null, // 仿真配置
initClient: '' // 仿真初始客户端 initClient: '', // 仿真初始客户端
linkSwitchMap: {} // 联动道岔数据
}, },
getters: { getters: {
@ -1147,6 +1148,9 @@ const map = {
}, },
setPicture: (state, picture) => { setPicture: (state, picture) => {
state.picture = picture; state.picture = picture;
},
setLinkSwitchMap: (state, linkSwitchMap) => {
state.linkSwitchMap = linkSwitchMap;
} }
}, },
@ -1429,6 +1433,9 @@ const map = {
}, },
setPicture: ({ commit }, picture) => { setPicture: ({ commit }, picture) => {
commit('setPicture', picture); commit('setPicture', picture);
},
setLinkSwitchMap: ({ commit }, linkSwitchMap) => {
commit('setLinkSwitchMap', linkSwitchMap);
} }
} }
}; };

View File

@ -115,6 +115,7 @@ export default {
} }
this.$store.dispatch('socket/resetRailCtcRunplanInitMsg'); // this.$store.dispatch('socket/resetRailCtcRunplanInitMsg'); //
this.$store.dispatch('socket/clearDispatchCommandMsg'); // this.$store.dispatch('socket/clearDispatchCommandMsg'); //
this.$store.dispatch('map/setLinkSwitchMap', {});
}, },
methods:{ methods:{
overallTranslation(flag) { overallTranslation(flag) {
@ -133,6 +134,7 @@ export default {
if (resp && resp.data && !resp.data.dataError) { if (resp && resp.data && !resp.data.dataError) {
this.$store.dispatch('runPlan/setRunPlanInfo', resp.data.runPlan); 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('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'); loadMapDataById(this.mapId, 'simulation');
if (this.simType === 'METRO') { if (this.simType === 'METRO') {
this.loadRunPlan(); this.loadRunPlan();