This commit is contained in:
sunzhenyu 2020-07-10 14:48:01 +08:00
commit b1f2f173b2
5 changed files with 86 additions and 87 deletions

View File

@ -179,16 +179,34 @@ export default {
let newMemberList = [];
if (res.code == 200) {
if (res.data.memberList && res.data.memberList.length > 0) {
// res.data.memberList
// newMemberList
const playerList = res.data.memberList.filter(item => item.hasPlay === true);
playerList.map(each=>{
if (!each.deviceName && each.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](each.deviceCode);
// const playerList = res.data.memberList.filter(item => item.hasPlay === true);
// playerList.map(each=>{
// if (!each.deviceName && each.deviceCode) {
// const device = this.$store.getters['map/getDeviceByCode'](each.deviceCode);
// if (device.name) {
// each.deviceName = device.name;
// } else {
// each.deviceName = each.deviceCode;
// }
// }
// });
const activeMemberList = [];
res.data.actionList.forEach((activeMember)=>{
if (!(activeMemberList.length > 0 && activeMemberList.includes(activeMember.memberId))) {
activeMemberList.push(activeMember.memberId);
}
});
const playerList = res.data.memberList.filter(member=>{
return activeMemberList.includes(member.id);
});
playerList.map(member=>{
if (!member.deviceName && member.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](member.deviceCode);
if (device.name) {
each.deviceName = device.name;
member.deviceName = device.name;
} else {
each.deviceName = each.deviceCode;
member.deviceName = member.deviceCode;
}
}
});
@ -199,6 +217,7 @@ export default {
this.mapLocation = res.data.mapLocation;
}
this.memberList = newMemberList || [];
debugger;
this.memberList.unshift({ id: '', name: this.$t('display.script.none'), role: 'no' });
}
this.roleShow = true;
@ -215,7 +234,6 @@ export default {
this.$emit('selectQuest', this.row, this.form.role, this.mapLocation, roleName.role);
this.doClose();
this.roleDoClose();
},
roleDoClose() {

View File

@ -5,7 +5,7 @@
<map-system-draft ref="mapCanvas" @back="back" />
</transition>
<menu-demon
<!-- <menu-demon
v-if="isDemon"
ref="menuDemon"
:offset="offset"
@ -14,7 +14,15 @@
@quitQuest="quitQuest"
@hidepanel="hidepanel"
@showScheduling="showScheduling"
/>
/> -->
<chat-box ref="chatbox" :group="group" :user-role="userRole" />
<div class="display-draft">
<template v-if="isscriptRun">
<el-button v-if="!dataError" type="danger" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
</template>
<el-button type="primary" @click="back">{{ $t('display.demon.back') }}</el-button>
</div>
<menu-schema
v-if="isDemon"
@ -34,23 +42,19 @@
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<fault-choose ref="faultChoose" :group="group" :offset="offset" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<!-- <add-quest ref="addQuest" @selectQuest="selectQuestNew" /> -->
</div>
</template>
<script>
import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import FaultChoose from './demon/faultChoose';
import ChatBox from '../jointTrainingNew/newChatView/chatBox';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import { quitScriptNew, scriptRePreview } from '@/api/simulation';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
// import AddQuest from './demon/addQuest';
import { mapGetters } from 'vuex';
import { setGoodsTryUse } from '@/api/management/goods';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
@ -58,6 +62,7 @@ import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import { Notification } from 'element-ui';
//
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
@ -69,14 +74,11 @@ export default {
components: {
RunPlanLoad,
RunPlanView,
FaultChoose,
// AddQuest,
ChatBox,
MapSystemDraft,
MenuDemon,
MenuSchema,
MenuSystemTime,
Jl3dDrive
// Scheduling
},
props: {
size: {
@ -99,10 +101,12 @@ export default {
mouseNumTime: 0,
mapBox: null,
mapBoxP: null,
dataError: false,
panelShow: true,
simulationShow: false,
drivingShow: false,
scriptId:0, // Id
isscriptRun:false, //
showStation: '',
stationList: [],
showSelectStation: false, // select
@ -113,6 +117,7 @@ export default {
'04': '02', // =>
'05': '' // => null
},
userRole:'ADMIN',
isDrive: this.prdType == '04'
};
},
@ -146,17 +151,6 @@ export default {
// return this.$route.query.prdType;
return this.$store.state.training.prdType;
},
userRole() {
if (this.prdType == '02') {
return 'DISPATCHER';
} else if (this.prdType == '01') {
return 'STATION_SUPERVISOR';
} else if (this.prdType == '04') {
return 'DRIVER';
} else {
return 'AUDIENCE';
}
},
isDemon() {
return this.mode === 'demon';
},
@ -264,10 +258,6 @@ export default {
mousemove(e) {
this.mouseNum = 1;
},
// 退
async quitQuest() {
this.scriptId = 0;
},
setPosition() {
this.$nextTick(() => {
let offset = 15;
@ -306,10 +296,13 @@ export default {
// 仿
async loadSimulationInfo() {
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200) {
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0;
this.scriptId = Number(resp.data.scriptId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true;
this.$messageBox('此地图数据正在维护中,无法运行!');
}
},
//
@ -339,21 +332,20 @@ export default {
this.endViewLoading();
}
},
//
async runQuestLoadShow() {
this.$refs.addQuest.doShow();
},
async runAddRolesLoadShow() {
// this.$refs.addQuest.doShow();
// const row={id: this.$route.query.scriptId};
const row = {group: this.$route.query.group, id: this.$route.query.scriptId};
this.$refs.addQuest.handleLoad(1, row);
},
// selectQuestNew(row, id, mapLocation, roleName) {
// this.$refs.
// },
async back() {
await clearSimulation(this.group);
this.$store.dispatch('training/over').then(() => {
history.go(-1);
Notification.closeAll();
});
},
//
async selectQuest(row) {
debugger;
this.scriptId = parseInt(row.id);
if (this.isDemon) {
this.$refs.menuDemon.initLoadPage();
@ -362,6 +354,24 @@ export default {
this.$refs.menuScript.initLoadPage();
}
},
// 退
handleQuitQuest() {
quitScriptNew(this.group).then(resp => {
scriptRePreview(this.group).then(resp=>{
getSimulationInfoNew(this.group).then(()=>{
this.scriptId = 0;
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
this.$refs.chatbox.clearAllData();
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
},
// id
async loadNewMapDataByGroup(group) {
@ -379,12 +389,6 @@ export default {
await clearSimulation(this.group);
await this.$store.dispatch('training/over');
},
// 仿退
async back() {
if (this.isDemon) {
await this.$refs.menuDemon.back();
}
},
// 使
async tryTime(param) {
const data = {
@ -409,9 +413,6 @@ export default {
this.$refs.Jl3dSimulation.show(this.mapId, this.group);
}
},
showScheduling() {
this.$refs.scheduling.doShow();
},
showpanel() {
this.panelShow = true;
this.simulationShow = false;
@ -426,9 +427,6 @@ export default {
runPlanLoadShow() {
this.$refs.runPlanLoad.doShow();
},
// faultChooseShow() {
// this.$refs.faultChoose.doShow();
// },
setWindowSize() {
this.$nextTick(() => {
const width = this.size ? this.size.width : this.width;

View File

@ -41,7 +41,7 @@ import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index';
import { quitScriptNew, scriptRePreview } from '@/api/simulation';
import { quitScriptNew } from '@/api/simulation';
import { setGoodsTryUse } from '@/api/management/goods';
export default {
@ -248,23 +248,6 @@ export default {
});
},
handleQuitQuest() {
if (this.$route.fullPath.includes('design/displayNew/demon') ) {
quitScriptNew(this.group).then(resp => {
scriptRePreview(this.group).then(resp=>{
getSimulationInfoNew(this.group).then(()=>{
this.quitQuest();
this.initLoadPage();
this.clearAllData();
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
} else {
quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then(()=>{
this.quitQuest();
@ -276,7 +259,6 @@ export default {
}).catch(() => {
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
}
},
quitQuest() {
this.$emit('quitQuest');

View File

@ -209,6 +209,7 @@ export default {
try {
let res;
if (this.isDesignPlatform) {
debugger;
res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group);
} else {
res = await loadScriptNew(row.id, id, this.group);

View File

@ -475,7 +475,7 @@ export default {
case 'STATION_SUPERVISOR': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); this.hideIbp(); this.drivingShow = false; break;
case 'AUDIENCE': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.hideIbp(); break;
case 'DRIVER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER'); break;
case 'MAINTAINER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER'); this.hideIbp(); break;
case 'MAINTAINER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'MAINTAINER'); this.hideIbp(); this.jl3dmaintainershow = true; break;
}
if (this.isAdmin && this.adminMode) {
this.$store.dispatch('training/setPrdType', swch || '02');