Squashed commit of the following:
commit 4af4e7ea9c440cdf1a7dba0f6ed6b4774910b2ee Author: dong <58670809@qq.com> Date: Sat May 6 18:11:16 2023 +0800 登录时判断用户已经加入的仿真
This commit is contained in:
parent
1318ecb97a
commit
527d16a6df
@ -101,7 +101,7 @@ export function getOrgList() {
|
||||
return request({
|
||||
url: '/api/orgProject/list',
|
||||
method: 'get'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,5 +111,15 @@ export function selectOrgnization(orgId) {
|
||||
return request({
|
||||
url: `/api/orgProject/signIn/${orgId}`,
|
||||
method: 'put'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户已经加入的仿真
|
||||
*/
|
||||
export function getSimulationJoined() {
|
||||
return request({
|
||||
url: '/simulation/joined/by/me',
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ export default {
|
||||
this.$store.dispatch('trainingNew/clearStepOverCount');
|
||||
this.$store.dispatch('trainingNew/trainingEnd');
|
||||
this.$store.dispatch('trainingNew/changeTeachMode', '');
|
||||
if (this.$store.state.training.simulationCreator) {
|
||||
destroySimulationByAdmin(this.group);
|
||||
} else {
|
||||
exitSimulation(this.group);
|
||||
}
|
||||
// if (this.$store.state.training.simulationCreator) {
|
||||
// destroySimulationByAdmin(this.group);
|
||||
// } else {
|
||||
// exitSimulation(this.group);
|
||||
// }
|
||||
this.$store.dispatch('socket/resetRailCtcRunplanInitMsg'); // 清除阶段计划
|
||||
this.$store.dispatch('socket/clearDispatchCommandMsg'); // 清除调度命令
|
||||
this.$store.dispatch('map/setLinkSwitchMap', {});
|
||||
|
@ -32,7 +32,7 @@ import ExamPanel from '../exam/examPanel';
|
||||
import getErrorTip from '@/scripts/errorTip';
|
||||
import DeviceManage from './deviceManage';
|
||||
import { SimulationUserType } from '@/scripts/ConstDic';
|
||||
import { destroySimulationByAdmin, ranAsPlan} from '@/api/simulation';
|
||||
import { destroySimulationByAdmin, exitSimulation, ranAsPlan} from '@/api/simulation';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import SimulationControl from './simulationControl';
|
||||
import SimulationId from '../simulationId';
|
||||
@ -193,10 +193,15 @@ export default {
|
||||
});
|
||||
},
|
||||
back() {
|
||||
if (this.$store.state.training.simulationCreator) {
|
||||
destroySimulationByAdmin(this.group);
|
||||
} else {
|
||||
exitSimulation(this.group);
|
||||
}
|
||||
if (this.projectDevice && this.$store.state.training.simulationCreator) {
|
||||
destroySimulationByAdmin(this.group).then(() => {
|
||||
this.logout();
|
||||
});
|
||||
// destroySimulationByAdmin(this.group).then(() => {
|
||||
this.logout();
|
||||
// });
|
||||
} else if (this.$route.query.third) {
|
||||
if (this.$route.query.project === 'cgy' || this.$route.query.project === 'drts') {
|
||||
window.parent.postMessage('back', '*');
|
||||
|
@ -55,9 +55,10 @@ import { getMapIdPermisson } from '@/api/userRulesManage';
|
||||
import { queryMapFunctionList } from '@/api/trainingPlatform';
|
||||
import selectRole from './selectRole/list';
|
||||
import { launchFullscreen } from '@/utils/screen';
|
||||
import { createSimulation } from '@/api/simulation';
|
||||
import { createSimulation, destroySimulationByAdmin, exitSimulation } from '@/api/simulation';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { jointSimulationByPermission } from '@/api/jointSimulation';
|
||||
import { getSimulationJoined } from '@/api/login';
|
||||
export default {
|
||||
name: 'Simulation',
|
||||
components: {
|
||||
@ -233,10 +234,60 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getJoinedSimulation();
|
||||
this.loadInitData();
|
||||
this.initMapSystem();
|
||||
},
|
||||
methods: {
|
||||
// 获取用户已经加入的仿真
|
||||
getJoinedSimulation() {
|
||||
return new Promise((resolve, reject) => {
|
||||
getSimulationJoined().then(res => {
|
||||
const data = res.data;
|
||||
if (data) {
|
||||
this.$confirm('存在未完成的仿真', '警告', {
|
||||
confirmButtonText: '继续仿真',
|
||||
cancelButtonText: '退出仿真',
|
||||
type: 'warning',
|
||||
// showClose: false, // 是否显示右上角x
|
||||
distinguishCancelAndClose: true, // close和cancel执行的方法是否有区别
|
||||
closeOnClickModal: false // 是否可以点击空白处关闭弹窗
|
||||
}).then(() => {
|
||||
const path = '/display/demon';
|
||||
const query = {
|
||||
lineCode: data.map.lineCode,
|
||||
group: data.group,
|
||||
mapId: data.map.id,
|
||||
simType: data.paramVO.type,
|
||||
project: this.$route.query.project || 'login'
|
||||
};
|
||||
if (data.paramVO && data.paramVO.domConfig && data.paramVO.domConfig.client) {
|
||||
query.client = data.paramVO.domConfig.client;
|
||||
}
|
||||
if (data.paramVO && data.paramVO.domConfig && data.paramVO.domConfig.singleClient) {
|
||||
query.singleClient = data.paramVO.domConfig.singleClient;
|
||||
}
|
||||
if (this.loadingProjectList.includes(query.project)) {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
}
|
||||
this.$router.push({ path, query });
|
||||
launchFullscreen();
|
||||
}).catch((e) => {
|
||||
if (e == 'cancel') {
|
||||
if (data.creator.id == this.$store.state.user.id) {
|
||||
destroySimulationByAdmin(data.group);
|
||||
} else {
|
||||
exitSimulation(data.group);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
resolve(data);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
getAbilityList(list) {
|
||||
const arr = [];
|
||||
list && list.forEach(item => {
|
||||
@ -284,32 +335,36 @@ export default {
|
||||
}
|
||||
},
|
||||
enterSimulation(system) {
|
||||
createSimulation(system.id).then(resp => {
|
||||
const query = {
|
||||
lineCode: this.$route.query.lineCode,
|
||||
group: resp.data,
|
||||
mapId: system.mapId,
|
||||
simType: system.simType,
|
||||
project: this.project
|
||||
};
|
||||
if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.client) {
|
||||
query.client = system.paramVO.domConfig.client;
|
||||
this.getJoinedSimulation().then(data => {
|
||||
if (!data) {
|
||||
createSimulation(system.id).then(resp => {
|
||||
const query = {
|
||||
lineCode: this.$route.query.lineCode,
|
||||
group: resp.data,
|
||||
mapId: system.mapId,
|
||||
simType: system.simType,
|
||||
project: this.project
|
||||
};
|
||||
if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.client) {
|
||||
query.client = system.paramVO.domConfig.client;
|
||||
}
|
||||
if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.singleClient) {
|
||||
query.singleClient = system.paramVO.domConfig.singleClient;
|
||||
}
|
||||
if (this.loadingProjectList.includes(this.project)) {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
}
|
||||
this.$router.push({ path: `/display/demon`, query: query });
|
||||
launchFullscreen();
|
||||
}).catch(error=>{
|
||||
if (error.code == 10003) {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
||||
}
|
||||
this.disabled = false;
|
||||
});
|
||||
}
|
||||
if (system.paramVO && system.paramVO.domConfig && system.paramVO.domConfig.singleClient) {
|
||||
query.singleClient = system.paramVO.domConfig.singleClient;
|
||||
}
|
||||
if (this.loadingProjectList.includes(this.project)) {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
}
|
||||
this.$router.push({ path: `/display/demon`, query: query });
|
||||
launchFullscreen();
|
||||
}).catch(error=>{
|
||||
if (error.code == 10003) {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + ':您的仿真权限不足!');
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
||||
}
|
||||
this.disabled = false;
|
||||
});
|
||||
},
|
||||
async joinSimulation() {
|
||||
|
Loading…
Reference in New Issue
Block a user