大客流订阅调整

This commit is contained in:
fan 2022-11-07 18:00:26 +08:00
parent 2caebf5d20
commit fe68d15acf
5 changed files with 27 additions and 16 deletions

View File

@ -63,7 +63,6 @@ function handleRoute(to, next, loginPath) {
// 除没有动态改变权限的需求可直接next() 删下方权限判断
if (to.path === '/404' && to.redirectedFrom === '/') {
const project = getSessionStorage('project');
console.log(localStore.get('trainingPlatformRoute' + store.getters.id + project, '-------------'));
next(localStore.get('trainingPlatformRoute' + store.getters.id + project) || '/trainingPlatform');
} else {
next();

View File

@ -56,6 +56,9 @@ export function getTopic(type, group, param) {
case 'COMMON':
topic = `/user/queue/simulation/${group}`;
break;
case 'LPF':
topic = `/user/queue/simulation/passenger/${group}`;
break;
}
return topic;

View File

@ -138,16 +138,19 @@ export default {
this.flowDataShow = true;
this.isDisabled = true;
const simulationWorkParam = this.$store.state.socket.simulationWorkParam;
if (simulationWorkParam && simulationWorkParam.itemMap && simulationWorkParam.itemMap.LPF) {
const currentFlowData = this.flowDataList.find(each=>{ return each.id == simulationWorkParam.itemMap.LPF; });
if (currentFlowData) {
this.currentFlowDataId = currentFlowData.id;
this.currentFlowDataName = currentFlowData.name;
}
} else {
if (this.currentFlowDataName) {
const currentFlowData = this.flowDataList.find(each=>{ return each.name == this.currentFlowDataName; });
if (currentFlowData) { this.currentFlowDataId = currentFlowData.id; }
} else {
if (simulationWorkParam && simulationWorkParam.itemMap && simulationWorkParam.itemMap.LPF) {
const currentFlowData = this.flowDataList.find(each=>{ return each.id == simulationWorkParam.itemMap.LPF; });
if (currentFlowData) {
this.currentFlowDataId = currentFlowData.id;
this.currentFlowDataName = currentFlowData.name;
}
}
}
}
},
clearSubscribe() {

View File

@ -165,6 +165,9 @@ export default {
case 'CTC':
creatSubscribe(getTopic(type, this.group), header, defaultCallback);
break;
case 'LPF':
creatSubscribe(getTopic(type, this.group), header, defaultCallback);
break;
}
// creatSubscribe(`${displayTopic}\/${this.group}`, header, defaultCallback);
// creatSubscribe(getTopic('STATE', this.group), header, stateCallback);
@ -191,6 +194,8 @@ export default {
this.$nextTick(() => { this.$refs.jl3dDrive.show(this.mapId, this.group); this.mapViewLoaded(true); });
} else if (val === 'trafficTerminal') {
this.$nextTick(() => { this.subscribe('CTC'); });
} else if (val === 'largePassengerView') {
this.$nextTick(() => { this.subscribe('LPF'); });
}
this.$nextTick(() => { this.loading = false; });
},

View File

@ -56,8 +56,8 @@
import echarts from 'echarts';
import { mapGetters } from 'vuex';
// import { clearSimulation } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, LPFTopic} from '@/utils/stomp';
import { getToken } from '@/utils/auth';
import { clearSubscribe, LPFTopic} from '@/utils/stomp';
// import { getToken } from '@/utils/auth';
import { loadMapDataById } from '@/utils/loaddata';
export default {
name:'BigLPFStrategy',
@ -167,7 +167,7 @@ export default {
}
});
this.loadInitData();
this.subscribe();
// this.subscribe();
},
'$store.state.socket.standPfiNum':function(val) {
if (val) {
@ -199,11 +199,12 @@ export default {
loadMapDataById(this.$route.query.mapId, 'parse');
},
methods:{
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
},
// async subscribe() {
// this.clearSubscribe();
// const header = { group: this.group || '', 'X-Token': getToken() };
// creatSubscribe(`${LPFTopic}\/${this.$route.query.group}`, header);
// console.log('----------------');
// },
clearSubscribe() {
clearSubscribe(`${LPFTopic}\/${this.group}`);
},