调度命令调整

This commit is contained in:
dong 2023-01-17 18:27:18 +08:00
parent 6d9ae082ec
commit d921acf107
7 changed files with 16 additions and 5 deletions

View File

@ -210,7 +210,7 @@ export default {
}
},
dispatchCommandState(obj) {
Object.values(obj.cpStateMap).forEach(item => {
obj && Object.values(obj.cpStateMap).forEach(item => {
if (item.cpId) {
if (!this.queryResData.companyStateMap) {
this.queryResData.companyStateMap = {};
@ -218,6 +218,9 @@ export default {
this.$set(this.queryResData.companyStateMap, item.cpId, item);
}
});
},
'$store.state.socket.simulationReset':function(val) {
this.cmdTableData = [];
}
},
beforeDestroy() {},

View File

@ -604,6 +604,9 @@ const socket = {
setDispatchCommandMsg: ({ commit }, data) => {
commit('setDispatchCommandMsg', data);
},
clearDispatchCommandMsg: ({ commit }, data) => {
commit('clearDispatchCommandMsg');
},
setDispatchCommandState: ({ commit }, data) => {
commit('setDispatchCommandState', data);
},

View File

@ -79,10 +79,12 @@ export function creatSubscribe(topic, header, callbackFun) {
if (!Vue.prototype.$stomp) {
Vue.prototype.$stomp = new StompClient();
}
if (!Vue.prototype.$stomp.subscribeMap[topic]) {
if (!Vue.prototype.$stomp.subscribeMap.has(topic)) {
Vue.prototype.$stomp.subscribe(topic, callbackFun || callback, header);
} else {
Vue.prototype.$stomp.subscribeMap[topic].count++;
// Vue.prototype.$stomp.subscribeMap[topic].count++;
const obj = Vue.prototype.$stomp.subscribeMap.get(topic);
obj.count++;
}
} catch (error) {
console.error('websocket订阅失败', error, topic, header);

View File

@ -636,7 +636,7 @@ export default {
this.DisStationId = obj.deviceCode ? obj.deviceCode : 'DisStation1986';
},
dispatchCommandState(obj) {
Object.values(obj.cpStateMap).forEach(item => {
obj && Object.values(obj.cpStateMap).forEach(item => {
if (item.cpId) {
if (!this.queryResData.companyStateMap) {
this.queryResData.companyStateMap = {};

View File

@ -111,6 +111,7 @@ export default {
exitSimulation(this.group);
}
this.$store.dispatch('socket/resetRailCtcRunplanInitMsg'); //
this.$store.dispatch('socket/clearDispatchCommandMsg'); //
},
methods:{
overallTranslation(flag) {

View File

@ -224,6 +224,7 @@ export default {
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/setTrainWindowShow', false);
this.$store.dispatch('map/initSimulationButton');
this.$store.dispatch('socket/clearDispatchCommandMsg'); //
});
}).catch(() => {
this.loading = false;

View File

@ -620,7 +620,7 @@ export default {
this.allographRow = null;
},
dispatchCommandState(obj) {
Object.values(obj.cpStateMap).forEach(item => {
obj && Object.values(obj.cpStateMap).forEach(item => {
if (item.cpId) {
if (!this.queryResData.companyStateMap) {
this.queryResData.companyStateMap = {};
@ -636,6 +636,7 @@ export default {
},
'$store.state.socket.simulationReset': function (val) {
this.queryResData = {};
this.$store.dispatch('socket/setDispatchCommandState', null);
}
},
beforeDestroy() {},