列车初始化时 重新解析数据 以清除残留状态

This commit is contained in:
fan 2021-09-29 10:12:49 +08:00
parent 01732b6b9a
commit 969a35eec1
5 changed files with 35 additions and 2 deletions

View File

@ -273,7 +273,13 @@ export function parser(data, skinCode, showConfig) {
return mapDevice;
}
// 初始化列车数据(仿真初始化时候,状态消息未初始化列车消息,前端暂时处理(临时解决方案))
export function parserTrainData(mapDevice, trainList, skinCode, showConfig) {
var propConvert = skinCode ? Vue.prototype.$theme.loadPropConvert(skinCode) : null;
zrUtil.each(trainList || [], elem => {
mapDevice[elem.code] = createDevice(deviceType.Train, elem, propConvert, showConfig);
}, this);
}
// 重置坐标点
function handleResetPoint(points) {
return (points[points.length - 1].x >= points[0].x);

View File

@ -107,6 +107,13 @@ export default {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
},
watch: {
'$store.state.training.started':function (val) {
if (val) {
this.setTrainDispaly();
}
}
},
mounted() {
this.$nextTick(() => {
this.setTrainDispaly();

View File

@ -107,6 +107,13 @@ export default {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
},
watch: {
'$store.state.training.started':function (val) {
if (val) {
this.setTrainDispaly();
}
}
},
mounted() {
this.$nextTick(() => {
this.setTrainDispaly();

View File

@ -107,6 +107,13 @@ export default {
return this.dialogShow ? OperationEvent.Command.close.confirm.domId : '';
}
},
watch: {
'$store.state.training.started':function (val) {
if (val) {
this.setTrainDispaly();
}
}
},
mounted() {
this.$nextTick(() => {
this.setTrainDispaly();

View File

@ -1209,9 +1209,15 @@ const map = {
commit('mapStateLoadedCountIncrenment');
},
clearJlmapTrainView: () => {
clearJlmapTrainView: ({ commit, state}) => {
if (Vue.prototype.$jlmap) {
Vue.prototype.$jlmap.clearTrainView();
let showConfig = {};
if (Vue.prototype.$jlmap && typeof Vue.prototype.$jlmap.getShowConfig === 'function') {
showConfig = Vue.prototype.$jlmap.getShowConfig();
}
const parser = parserFactory(ParserType.Graph.value);
parser.parserTrainData(state.mapDevice, state.map.trainList, state.map.skinVO.code, showConfig);
}
},