退出iscs工作站清理仿真

This commit is contained in:
fan 2020-08-13 09:22:31 +08:00
parent f4f1b8792d
commit 066340930f

View File

@ -35,6 +35,7 @@ import merge from 'webpack-merge';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getSessionStorage } from '@/utils/auth'; import { getSessionStorage } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp'; import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import { clearSimulation } from '@/api/simulation';
export default { export default {
data() { data() {
return { return {
@ -268,7 +269,8 @@ export default {
] ]
} }
], ],
stationList: [] stationList: [],
firstBack: false
}; };
}, },
computed: { computed: {
@ -283,12 +285,12 @@ export default {
'$store.state.socket.simulationRoleList':function(val) { '$store.state.socket.simulationRoleList':function(val) {
(val || []).forEach(item => { (val || []).forEach(item => {
if (item.messageType === 'KICK_OUT' && item.userId == this.$store.state.user.id) { if (item.messageType === 'KICK_OUT' && item.userId == this.$store.state.user.id) {
this.back(); !this.firstBack && this.back();
} }
}); });
}, },
'$store.state.socket.simulationOver':function(val) { '$store.state.socket.simulationOver':function(val) {
this.back(); !this.firstBack && this.back();
} }
}, },
async created () { async created () {
@ -388,12 +390,17 @@ export default {
this.$router.push({ path: `/displayIscs/system/config/${this.type}`, query: query }); this.$router.push({ path: `/displayIscs/system/config/${this.type}`, query: query });
}, },
back() { back() {
this.firstBack = true;
if (this.projectDevice) { if (this.projectDevice) {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.reload(); location.reload();
}); });
} else { } else {
this.$router.push({ path: `/trainingPlatform` }); clearSimulation(this.$route.query.group).then(resp => {
this.$router.push({ path: `/trainingPlatform` });
}).catch(()=> {
this.$message.error('清除仿真失败!');
});
} }
}, },
changeCurrentSystem() { changeCurrentSystem() {