Compare commits
2 Commits
master
...
test_rever
Author | SHA1 | Date | |
---|---|---|---|
|
63200d1a27 | ||
|
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,66 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getJoinedSimulation();
|
||||
this.loadInitData();
|
||||
this.initMapSystem();
|
||||
},
|
||||
methods: {
|
||||
// 获取用户已经加入的仿真
|
||||
getJoinedSimulation(system) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getSimulationJoined().then(res => {
|
||||
const data = res.data;
|
||||
if (data) {
|
||||
const h = this.$createElement;
|
||||
const msgData = [h('p', null, '存在未完成的仿真:'), h('p', null, `线路:${data.map.name}`), h('p', null, `功能:${data.mapFunctionVO.name}`)];
|
||||
this.$confirm('', '警告', {
|
||||
message: h('div', null, msgData),
|
||||
confirmButtonText: '继续仿真',
|
||||
cancelButtonText: system ? '退出并新建仿真' : '退出仿真',
|
||||
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);
|
||||
}
|
||||
if (system) {
|
||||
this.createNewSimulation(system);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
resolve(data);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
getAbilityList(list) {
|
||||
const arr = [];
|
||||
list && list.forEach(item => {
|
||||
@ -284,6 +341,13 @@ export default {
|
||||
}
|
||||
},
|
||||
enterSimulation(system) {
|
||||
this.getJoinedSimulation(system).then(res => {
|
||||
if (!res) {
|
||||
this.createNewSimulation(system);
|
||||
}
|
||||
});
|
||||
},
|
||||
createNewSimulation(system) {
|
||||
createSimulation(system.id).then(resp => {
|
||||
const query = {
|
||||
lineCode: this.$route.query.lineCode,
|
||||
|
Loading…
Reference in New Issue
Block a user