This commit is contained in:
fan 2020-11-26 09:09:45 +08:00
commit 78c04585a6
15 changed files with 123 additions and 244 deletions

View File

@ -28,11 +28,6 @@ export default {
loading: false
};
},
computed: {
path() {
return window.location.pathname;
}
},
watch: {
'$store.state.socket.simulationInvite': function (val) {
if (val.creator) {
@ -101,7 +96,8 @@ export default {
},
subscribe() {
const token = getToken();
if (token && this.$route.path != '/404' && !this.path.endsWith('login')) {
const path = window.location.pathname;
if (token && this.$route.path != '/404' && !path.endsWith('login')) {
const header = { group: '', 'X-Token': token };
this.$store.dispatch('subscribe', {header, type: getSessionStorage('project')});
}

View File

@ -61,6 +61,15 @@ export function getTrainingStepsDetailNew(trainingId, params) {
params: params
});
}
/** 仿真里加载实训 (新版地图) */
export function loadTrainingInSimulation(group, id) {
return request({
url: `/api/v1/training/${group}/${id}/loadTraining`,
method: 'put'
});
}
/** 查询实训列表(新版地图)*/
export function pageQueryTrainingNew(params) {
return request({

View File

@ -1,14 +1,5 @@
import request from '@/utils/request';
// 检查房间存在
export function checkRoomExistNew(params) {
return request({
url: `/api/simulationRoom`,
method: 'get',
params
});
}
// 设置人员角色
export function putUserRolesNew(data, group) {
return request({

View File

@ -140,7 +140,7 @@ export default {
operateType: 'Stand_Whole_Line_Cancel_Hold_Train',
skinCode: '02',
trainingName: '全线取消扣车({10}-{12}站台)',
trainingRemark: '全线取消扣车功能(默认上行全线/下行全线,不做选择)',
trainingRemark: '全线取消扣车功能(默认{12}全线,不做选择)',
trainingType: 'Stand',
productTypes: ['02'],
stepVOList: [
@ -153,8 +153,8 @@ export default {
minDuration: 8,
operateType: 'Stand_Whole_Line_Cancel_Hold_Train',
skinCode: '02',
trainingName: '全线取消扣车({10}-{12}站台)',
trainingRemark: '全线取消扣车功能(选择上/下行全线)',
trainingName: '全线取消扣车({10}-{12}站台 / 取消{14}全线)',
trainingRemark: '全线取消扣车功能(选择{14}全线)',
trainingType: 'Stand',
productTypes: ['02'],
stepVOList: [

View File

@ -101,7 +101,7 @@ export default {
trainingType: 'Stand',
productTypes: ['01', '02'],
stepVOList: [
{ deviceType: '06', orderNum: 1, operateCode: '504', tip: '鼠标右键菜单选择【扣车】' },
{ deviceType: '06', orderNum: 1, operateCode: '504', tip: '鼠标右键菜单选择【设置扣车】' },
{ deviceType: '06', orderNum: 2, operateCode: '504', tip: '鼠标左键点击【确定】按钮' }
]
},
@ -139,7 +139,7 @@ export default {
operateType: 'Stand_Whole_Line_Cancel_Hold_Train',
skinCode: '02',
trainingName: '全线取消扣车({10}-{12}站台)',
trainingRemark: '全线取消扣车功能(默认上行全线/下行全线,不做选择)',
trainingRemark: '全线取消扣车功能(默认{12}全线,不做选择)',
trainingType: 'Stand',
productTypes: ['02'],
stepVOList: [
@ -152,8 +152,8 @@ export default {
minDuration: 8,
operateType: 'Stand_Whole_Line_Cancel_Hold_Train',
skinCode: '02',
trainingName: '全线取消扣车({10}-{12}站台)',
trainingRemark: '全线取消扣车功能(选择上/下行全线)',
trainingName: '全线取消扣车({10}-{12}站台 / 取消{14}全线)',
trainingRemark: '全线取消扣车功能(选择{14}全线)',
trainingType: 'Stand',
productTypes: ['02'],
stepVOList: [

View File

@ -952,6 +952,7 @@ const map = {
},
updateMapDevices: ({ commit, state }, models) => {
return new Promise((resolve) => {
// debugger;
if (!(models instanceof Array)) {
models = [models];
}
@ -969,7 +970,7 @@ const map = {
});
const list = Object.values(dict);
handleOperation(state, list);
if (window.location.href.includes('/design/usermap/map/draw')) { handleOperation(state, list); }
commit('mapRender', list);
resolve(list);
});

View File

@ -2,8 +2,8 @@
<el-dialog
v-dialogDrag
v-dialogLoading="pageLoading"
:title="title"
:visible.sync="show"
:title="$t('global.synthesisTrainingTitle')"
:visible.sync="dialogShow"
width="600px"
:before-close="doClose"
:z-index="2000"
@ -17,7 +17,7 @@
class="filter-tree"
default-expand-all
:data="trainingList"
:props="defaultProps"
:props="{label: 'roomName'}"
:filter-node-method="filterNode"
:style="{height: height+'px'}"
>
@ -44,8 +44,6 @@
<script>
import { getSimulationListCantainUser } from '@/api/jointSimulation';
import { launchFullscreen } from '@/utils/screen';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
export default {
name: 'DeomonList',
@ -54,45 +52,16 @@ export default {
dialogShow: false,
height: 120,
trainingList: [],
defaultProps: {
label: 'roomName'
},
group: '',
loading: false,
pageLoading: false
};
},
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('global.synthesisTrainingTitle');
},
isWatch() {
return true;
},
isjoin() {
return true;
}
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
async subscribe(group) {
if (!this.$store.state.socket.roomIsSubscribe) {
this.clearSubscribe(group);
const header = { group: group || '', 'X-Token': getToken() };
creatSubscribe(`${roomTopic}\/${group}`, header);
await this.$store.dispatch('socket/setRoomSubscribe', true);
}
},
async clearSubscribe(group) {
clearSubscribe(`${roomTopic}\/${group}`);
await this.$store.dispatch('socket/setRoomSubscribe', false);
},
async doShow() {
try {
this.pageLoading = true;

View File

@ -1,8 +1,8 @@
<template>
<el-dialog
v-dialogDrag
:title="title"
:visible.sync="show"
:title="$t('global.synthesisTrainingTitle')"
:visible.sync="dialogShow"
width="600px"
:before-close="doClose"
:z-index="2000"
@ -20,8 +20,6 @@
<script>
import { launchFullscreen } from '@/utils/screen';
import { getPublishMapInfo } from '@/api/jmap/map';
import { getToken } from '@/utils/auth';
import { creatSubscribe, clearSubscribe, roomTopic} from '@/utils/stomp';
// 仿
export default {
name: 'DeomonList',
@ -30,47 +28,23 @@ export default {
dialogShow: false,
group: '',
roomName: '',
state: '',
mapId: '',
lineCode: '',
loading: false
};
},
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('global.synthesisTrainingTitle');
}
},
mounted() {
},
methods: {
doShow(data) {
this.roomName = data.creator.nickname;
this.group = data.group;
this.mapId = data.mapId || data.map.id;
this.lineCode = (data.map || {}).lineCode;
this.state = data.state;
this.dialogShow = true;
this.loading = false;
},
doClose() {
this.dialogShow = false;
},
async subscribe() {
if (!this.$store.state.socket.roomIsSubscribe) {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${roomTopic}\/${this.group}`, header);
await this.$store.dispatch('socket/setRoomSubscribe', true);
}
},
async clearSubscribe() {
clearSubscribe(`${roomTopic}\/${this.group}`);
await this.$store.dispatch('socket/setRoomSubscribe', false);
},
async handleJoin() {
try {
this.loading = true;

View File

@ -11,7 +11,7 @@
<p class="list-item">
<span class="list-label">{{ $t('global.permissionList') }}</span>
</p>
<limit-list :ref="`limit`" :course-model="courseModel" @initLoadPage="refresh" />
<limit-list ref="limit" :course-model="courseModel" @initLoadPage="refresh" />
</div>
<div class="btn-buy">
<el-button v-if="!isLocal" type="success" :disabled="disabled" @click="buy">{{ $t('global.buy') }}</el-button>
@ -31,7 +31,6 @@ import LimitList from '@/views/components/limits/index';
import { getSubSystemDetail } from '@/api/trainingPlatform';
import { getSessionStorage } from '@/utils/auth';
import localStore from 'storejs';
import { checkRoomExistNew } from '@/api/jointTraining';
export default {
name: 'ExamDetailList',
@ -45,9 +44,7 @@ export default {
tryUser: 0,
loading: true,
disabled: false,
currentLessonId: '',
currentPrdType: '',
productList: [],
courseModel: {
id: '',
name: '',
@ -57,8 +54,6 @@ export default {
prdType: '',
pmsList: []
},
jointShow: false,
jointGroup: '',
lineCode:'',
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts']
};
@ -109,7 +104,7 @@ export default {
try {
res = await getPublishMapInfo(this.mapId);
} catch (error) {
if (error.code == 30001) {
if (error.code == 30001 || error.code == 10007) {
const url = localStore.get('orignalTrainingPlatformRoute' + this.$store.state.user.id + this.project);
localStore.remove();
if (url) {
@ -168,20 +163,6 @@ export default {
refresh() {
this.loadInitData();
},
async getJointTrainingList() {
try {
if (this.mapId) {
const res = await checkRoomExistNew({mapId: this.mapId});
this.jointGroup = res.data;
this.jointShow = false;
if (res.data) {
this.jointShow = true;
}
}
} catch (error) {
console.error(error, '获取是否拥有综合演练房间');
}
},
async enterIntegratedSimulation() {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
@ -224,54 +205,30 @@ export default {
});
},
async start() {
if (this.courseModel.prdType == '05') {
this.jumpScheduling();
} else if (this.courseModel.prdType == '03') {
this.enterIntegratedSimulation();
} else if (this.courseModel.prdType == '06') {
this.enterISCS();
} else if (this.courseModel.prdType == '07') {
this.enterScreen();
} else {
this.jump();
}
const jumpFunc = ['jump', 'jump', 'enterIntegratedSimulation', 'jump', 'jumpScheduling', 'enterISCS', 'enterScreen'];
this[jumpFunc[parseInt(this.courseModel.prdType) - 1]]();
},
jumpSimulation() {
this.disabled = true;
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error=>{
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
},
jumpScheduling() {
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
try {
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser };
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
});
} catch (e) {
this.$messageBox(this.$t('error.createSimulationFailed') + e.message);
this.disabled = false;
}
}, 100);
this.jumpSimulation();
},
jump() {
this.disabled = true;
setTimeout(() => {
const data = { mapId: this.courseModel.mapId, prdType: this.currentPrdType };
createSimulationNew(data).then(resp => {
const query = { lineCode: this.courseModel.lineCode, group: resp.data, prdType: this.courseModel.prdType, mapId: this.courseModel.mapId, goodsId: this.goodsId, try: this.tryUser, project: this.project };
this.$store.dispatch('training/setPrdType', this.currentPrdType); // prdType
if (this.loadingProjectList.includes(this.project)) {
this.$store.dispatch('app/transitionAnimations');
}
this.$router.push({ path: `${UrlConfig.displayNew}/demon`, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
this.disabled = false;
});
}, 100);
this.jumpSimulation();
},
buy() {
// this.disabled = true;

View File

@ -163,6 +163,7 @@ export default {
beforeDestroy() {
this.destroy();
this.clearSubscribe();
this.$store.dispatch('runPlan/setPlanData', []);
},
methods: {
async subscribe() {

View File

@ -53,6 +53,10 @@ export default {
});
}
},
beforeDestroy() {
this.$store.dispatch('runPlan/setPlanData', []);
this.$store.dispatch('runPlan/setInitialPlanData', []);
},
mounted() {
// this.menus = this.$theme.loadPlanComponent(this.$route.query.lineCode);
},

View File

@ -24,7 +24,7 @@
</template>
<script>
import { getTrainingDetailNew } from '@/api/jmap/training';
// import { getTrainingDetailNew } from '@/api/jmap/training';
import TipTrainingDetail from './tipTrainingDetail';
import LeftSlider from './LeftSlider';
import { mapGetters } from 'vuex';
@ -33,7 +33,7 @@ import { startTrainingNew, endTrainingNew } from '@/api/jmap/training';
import { trainingNotifyNew } from '@/api/simulation';
import { TrainingMode, UrlConfig } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date';
import { getTrainingStepsDetailNew } from '@/api/jmap/training';
import { getTrainingStepsDetailNew, loadTrainingInSimulation } from '@/api/jmap/training';
import { EventBus } from '@/scripts/event-bus';
export default {
@ -117,14 +117,16 @@ export default {
this.tipInfo({ color: val.color, message: val.errMsg });
},
async $route() {
await this.initData();
await this.getTrainingData();
this.endViewLoading(true);
loadTrainingInSimulation(this.group, this.$route.query.trainingId).then(resp => {
this.setTrainingData(resp);
this.endViewLoading(true);
}).catch(error => {
this.endViewLoading(true);
this.$messageBox(`初始化实训内容失败: ${error.message}`);
});
this.resetTraining();
}
},
mounted() {
this.initData();
},
methods: {
tipInfo(opt) {
if (opt && opt.hasOwnProperty('color') && opt.hasOwnProperty('message')) {
@ -136,18 +138,14 @@ export default {
});
}
},
getTrainingData() {
if (this.$route.query.trainingId) {
//
getTrainingStepsDetailNew(this.$route.query.trainingId, { group: this.group }).then(resp => {
this.trainingObj = resp.data;
this.$store.dispatch('training/setTrainingData', this.trainingObj); //
const detail = resp.data;
this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
}
setTrainingData(resp) {
this.trainingObj = resp.data;
this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode);
this.$store.dispatch('training/setTrainingData', this.trainingObj); //
const detail = resp.data;
this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
},
resetTraining() {
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/reset');
this.$store.dispatch('training/emitTipFresh');
@ -155,9 +153,19 @@ export default {
this.$store.dispatch('training/setStopCountTime');
this.$store.dispatch('training/setScore', 0);
this.$store.dispatch('training/setTrainingStart', false);
this.isDisable = false;
},
getTrainingData() {
if (this.$route.query.trainingId) {
//
getTrainingStepsDetailNew(this.$route.query.trainingId, { group: this.group }).then(resp => {
this.setTrainingData(resp);
}).catch(error => {
this.$messageBox(`初始化实训内容失败: ${error.message}`);
});
}
this.resetTraining();
},
overallTranslation(flag) {
const panel = document.getElementById('leftSlider');
if (flag) {
@ -268,25 +276,6 @@ export default {
}
}
},
//
async initData() {
// this.$store.dispatch('training/end', null);
if (parseInt(this.$route.query.trainingId)) {
//
//
const resp = await getTrainingDetailNew(this.$route.query.trainingId);
this.$store.dispatch('exam/setCenter', resp.data.locateDeviceCode);
if (resp && resp.code == 200) {
// const detail = resp.data;
// await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
} else {
this.$messageBox(`获取实训步骤数据失败`);
this.endViewLoading();
}
} else {
this.endViewLoading();
}
},
//
endViewLoading(isSuccess) {
if (!isSuccess) {

View File

@ -385,43 +385,42 @@ export default {
},
//
onSelected(em) {
console.log(em);
console.log(em);
const path = window.location.href;
if (path.includes("/practiceDisplay")){
if(em.deviceType == "StationStand"){
if (path.includes('/practiceDisplay')) {
if (em.deviceType == 'StationStand') {
// console.log(em.deviceType );
const routeData = this.$router.resolve({
path:'/jlmap3d/trafficplan',
query:{
mapid:this.$route.query.mapId,
group:this.$route.query.group,
project: this.$route.query.project,
noPreLogout: true,
lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode,
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
if(em.deviceType == "Train"){
const routeData = this.$router.resolve({
path:'/jlmap3d/trafficplan',
query:{
mapid:this.$route.query.mapId,
group:this.$route.query.group,
project: this.$route.query.project,
noPreLogout: true,
lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
if (em.deviceType == 'Train') {
// console.log(em.deviceType );
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',
query:{
mapid:this.$route.query.mapId,
group:this.$route.query.group,
project: this.$route.query.project,
noPreLogout: true,
lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode,
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
}else{
this.$emit('onSelect', em);
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',
query:{
mapid:this.$route.query.mapId,
group:this.$route.query.group,
project: this.$route.query.project,
noPreLogout: true,
lineCode:this.$route.query.lineCode,
deviceCode:em.deviceCode
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
} else {
this.$emit('onSelect', em);
}
},

View File

@ -4,14 +4,14 @@
<span>{{ $t('global.mapList') }}</span>
</div>
<div class="left-map-list">
<filter-city v-if="!getMapByCode" ref="filerCity" filter-empty :local-param-name="localParamName" @filterSelectChange="refresh" />
<filter-city v-if="!getMapByCode" ref="filerCity" filter-empty local-param-name="training_cityCode" @filterSelectChange="refresh" />
<el-input v-if="!getMapByCode" v-model="filterText" :placeholder="this.$t('global.filteringKeywords')" clearable />
<div style="height: calc(100% - 76px); overflow: auto;">
<el-tree
ref="tree"
:data="treeList"
node-key="key"
:props="defaultProps"
:props="{children: 'children',label: 'name'}"
highlight-current
:span="22"
:filter-node-method="filterNode"
@ -52,20 +52,14 @@ export default {
data() {
return {
loading: true,
defaultShowKeys: [],
filterText: '',
treeList: [],
selected: {},
defaultProps: {
children: 'children',
label: 'name'
},
node: {
},
mapId: '',
expandList: [],
filterSelect: '',
localParamName: 'training_cityCode'
filterSelect: ''
};
},
computed: {

View File

@ -5,7 +5,7 @@
</div>
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<transition>
<router-view :product-list="productList" />
<router-view />
</transition>
</div>
</template>
@ -25,19 +25,12 @@ export default {
},
data() {
return {
widthLeft: 450,
productList: []
widthLeft: 450
};
},
computed: {
width() {
return this.$store.state.app.width;
},
userId() {
return this.$store.state.user.id;
},
project() {
return getSessionStorage('project');
}
},
mounted() {
@ -51,9 +44,11 @@ export default {
const againEnter = getSessionStorage('againEnter') || null;
if (!againEnter) {
launchFullscreen();
const path = localStore.get('trainingPlatformRoute' + this.userId + this.project);
const project = getSessionStorage('project');
const userId = this.$store.state.user.id;
const path = localStore.get('trainingPlatformRoute' + userId + project);
if (path && path.startsWith('/trainingPlatform')) {
localStore.set('orignalTrainingPlatformRoute' + this.userId + this.project, `/trainingPlatform/permission/${data[0].id}`);
localStore.set('orignalTrainingPlatformRoute' + userId + project, `/trainingPlatform/permission/${data[0].id}`);
this.$router.push(path);
} else if (data && data[0]) {
this.$router.push(`/trainingPlatform/permission/${data[0].id}`);