实训调整

This commit is contained in:
fan 2022-08-29 14:37:13 +08:00
parent 3fe6e2076c
commit 13d463570a
3 changed files with 46 additions and 2 deletions

View File

@ -148,11 +148,12 @@ export default {
break;
}
case 'trainingPreview': {
const data = { mapId: obj.mapId, prdType: '01' };
const data = { mapId: obj.mapId };
createSimulationNew(data).then(resp => {
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$store.dispatch('training/setPrdType', '02');
const query = { ...data, group: resp.data, scriptId: obj.id, lineCode:obj.lineCode};
this.$router.push({ path: `/trainingPreview`, query });
}).catch(error => {

View File

@ -37,6 +37,14 @@ export default {
reset: true,
show:false
},
prdTypeMap: {
DISPATCHER: '02',
STATION_SUPERVISOR: '01',
STATION_ASSISTANT: '01',
DEPOT_DISPATCHER: '09',
DRIVER: '04',
RAIL_CTC: '10'
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
@ -112,10 +120,17 @@ export default {
try {
const detailResp = await getPublishTrainingDetail(data.id);
this.training = detailResp.data;
const mapLocation = JSON.parse(detailResp.data.mapLocationJson);
const playerId = JSON.parse(detailResp.data.playerIdJson)[0];
const member = this.$store.state.training.memberData[playerId];
this.$store.dispatch('training/setPrdType', this.prdTypeMap[member.type]);
this.$store.dispatch('training/setRoles', member.type);
this.$jlmap.updateTransform(mapLocation.scale, {x:mapLocation.x, y:mapLocation.y});
this.$store.dispatch('trainingNew/setTrainingDetail', detailResp.data);
await loadPublishTraining(this.group, data.id, {mode: this.teachMode});
this.$message.success('加载实训成功!');
} catch (e) {
console.error('ceshi', e);
this.$message.error('加载实训失败!');
}
},

View File

@ -31,6 +31,8 @@ import TrainingTip from './trainingTip';
import deviceType from '@/jmapNew/constant/deviceType.js';
import { EventBus } from '@/scripts/event-bus';
import { getDeviceMenuByDeviceType, MouseEvent } from '@/scripts/ConstDic';
import { getSimulationMemberList, getAllSimulationUser } from '@/api/simulation';
import { getMemberListCommon, getUserListCommon } from '@/api/rtSimulation';
export default {
name: 'TrainingDesign',
components: {
@ -127,6 +129,7 @@ export default {
this.menus = this.$theme.loadMenuComponent(lineCode);
// this.$store.commit('training/notifyGetCommandDefinition', lineCode);
}
this.initMemberUserInfo(true);
}
},
async beforeDestroy() {
@ -135,7 +138,6 @@ export default {
this.$store.dispatch('socket/clearTrainingOverCount');
},
mounted() {
this.$store.dispatch('training/setPrdType', '01');
this.setWindowSize();
this.initLoadData();
},
@ -382,6 +384,32 @@ export default {
}
return device;
},
initMemberUserInfo(isFirst = false) {
if (this.$route.query.newApi + '' === 'true') {
getMemberListCommon(this.$route.query.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
getUserListCommon(this.$route.query.group).then(res => {
this.$store.dispatch('training/setSimulationUserList', res.data);
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
} else {
// 仿
getSimulationMemberList(this.group).then(resp => {
this.$store.dispatch('training/setMemberList', { memberList: resp.data, userId: this.$store.state.user.id });
getAllSimulationUser(this.group).then(res => {
this.$store.dispatch('training/setSimulationUserList', res.data);
}).catch(() => {
this.$messageBox('获取所有仿真用户失败!');
});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
});
}
}
}
};