This commit is contained in:
zyy 2020-07-10 17:23:31 +08:00
commit e6e0bb6d51
9 changed files with 169 additions and 108 deletions

View File

@ -8,14 +8,6 @@ export function getSimulationMembersNew(group) {
});
}
// 获取仿真成员(新版地图)
export function getSimulationMemberNew(group) {
return request({
url: `/simulation/${group}/member`,
method: 'get'
});
}
// 获取仿真会话消息列表(新版地图)
export function getSimulationContextListNew(group, conversationId) {
return request({

View File

@ -228,6 +228,18 @@ const training = {
setSimulationUserList: (state, simulationUserList) => {
state.simulationUserList = simulationUserList;
},
updateMemberListInScript:(state, {oldMemberId, newMemberId, userId}) => {
if (oldMemberId) {
// 重置旧数据
state.memberData[oldMemberId].trust = false;
delete state.memberData[oldMemberId].userId;
state.memberData[oldMemberId].disabled = false;
}
// 更新新数据
state.memberData[newMemberId].userId = userId;
state.memberData[newMemberId].disabled = true;
state.memberData[newMemberId].trust = true;
},
updateMemberAndUser: (state, {simulationUserList, userId}) => {
simulationUserList.forEach(item => {
let memberIndex = -1;
@ -667,6 +679,10 @@ const training = {
/** 更新综合演练仿真成员和用户列表 */
updateMemberAndUser: ({ commit }, data) => {
commit('updateMemberAndUser', data);
},
/** 更新剧本所有成员列表 */
updateMemberListInScript:({ commit }, data) => {
commit('updateMemberListInScript', data);
}
}
};

View File

@ -56,7 +56,7 @@
import StompClient from '@/utils/sock';
import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
import { bindSimulationTrain,getSimulationTrainlistNew,getSimulationMemberNew,trainSimulationEb,trainSimulationForce,trainSimulationGear} from '@/jlmap3d/jl3ddrive/drivecontrol/simulation.js';
import { bindSimulationTrain,getSimulationTrainlistNew,getSimulationMembersNew,trainSimulationEb,trainSimulationForce,trainSimulationGear} from '@/jlmap3d/jl3ddrive/drivecontrol/simulation.js';
import { getSimulationInfoNew } from '@/api/simulation';
import { tuoguan3ddrive } from '@/api/jlmap3d/load3ddata';
@ -92,6 +92,14 @@ import axios from 'axios';
}
},
watch: {
'$store.state.training.memberData':{
handler(val){
if(this.tuoguanbutton == true){
console.log(val);
}
},
deep:true //true
}
},
onLoad(e) {
@ -160,6 +168,7 @@ import axios from 'axios';
posttrust = true;
}
tuoguan3ddrive(this.$route.query.group,posttrust,{}).then(netdata => {
// this.$store.dispatch('training/updateMemberListInScript', {oldMemberId:this.oldMemberId, newMemberId:role, userId:this.userId});
this.tuoguanstatus = posttrust;
if(this.tuoguanstatus){
this.tuoguanbuttonmsg = "取消托管";
@ -167,6 +176,7 @@ import axios from 'axios';
this.tuoguanbuttonmsg = "托管";
}
}).catch((error) => {
});
},
updatetrainlist(){
@ -226,17 +236,57 @@ import axios from 'axios';
});
//
if(this.tuoguanbutton == true){
getSimulationMemberNew(this.group).then(netdata => {
this.userrole = netdata.data.role;
if(netdata.data.trust){
this.tuoguanstatus = netdata.data.trust;
if(this.tuoguanstatus){
this.tuoguanbuttonmsg = "取消托管";
}else{
this.tuoguanbuttonmsg = "托管";
}
let netdata = this.$store.state.training.memberData;
console.log(netdata);
for(let k in netdata){
if(netdata[k].userId == this.userId){
console.log(this.$store.state.scriptRecord.userRole);
this.userrole = this.$store.state.scriptRecord.userRole;
console.log(netdata[k].trust);
if(netdata[k].trust){
this.tuoguanstatus = netdata[k].trust;
if(this.tuoguanstatus){
this.tuoguanbuttonmsg = "取消托管";
}else{
this.tuoguanbuttonmsg = "托管";
}
}
break;
}
});
}
// getSimulationMembersNew(this.group).then(netdata => {
// for(let i=0,leni=netdata.data.length;i<leni;i++){
// if(netdata.data[i].userId){
// if(netdata.data[i].userId == this.userId){
// this.userrole = netdata.data[i].role;
// if(netdata.data[i].trust){
// this.tuoguanstatus = netdata.data[i].trust;
// if(this.tuoguanstatus){
// this.tuoguanbuttonmsg = "";
// }else{
// this.tuoguanbuttonmsg = "";
// }
// }
// i=leni;
// }
// }
// }
// this.userrole = netdata.data.role;
// if(netdata.data.trust){
// this.tuoguanstatus = netdata.data.trust;
// if(this.tuoguanstatus){
// this.tuoguanbuttonmsg = "";
// }else{
// this.tuoguanbuttonmsg = "";
// }
// }
// });
}
}

View File

@ -169,7 +169,7 @@ export default {
lastData.forEach(each=>{
const name = each.name == undefined ? '' : '-' + each.name;
const deviceName = each.deviceName == undefined ? '' : '-' + each.deviceName;
each.name = each.role + deviceName + name;
each.name = each.type + deviceName + name;
});
return lastData;
},
@ -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;
}
}
});
@ -215,7 +233,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,35 +248,17 @@ 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(() => {
quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then(()=>{
this.quitQuest();
this.initLoadPage();
this.clearAllData();
}).catch(()=>{
this.$messageBox(this.$t('display.demon.exitTaskFail'));
});
} else {
quitScriptNew(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'));
});
},
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');

View File

@ -58,6 +58,7 @@ export default {
return {
isShow:true,
language:'',
oldMemberId:'',
memberId:'',
isPause:false,
executeDisabled: false,
@ -102,6 +103,7 @@ export default {
},
beforeDestroy() {
// this.clearAutoSave();
this.$store.dispatch('training/setMemberList', {memberList:[], userId:this.$store.state.user.id});
this.$store.dispatch('map/resetActiveTrainList');
this.$store.dispatch('scriptRecord/updateBgSet', false);
this.$store.dispatch('scriptRecord/updateRole', null);
@ -118,6 +120,7 @@ export default {
initData() {
getSimulationMemberList(this.group).then(resp => {
const lastData = JSON.stringify(resp.data);
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId:this.$store.state.user.id});
this.allMemberList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
this.changeRunPlanStatus();
}).catch(error => {
@ -173,6 +176,8 @@ export default {
prdType = '';
}
}
this.$store.dispatch('training/updateMemberListInScript', {oldMemberId:this.oldMemberId, newMemberId:role, userId:this.$store.state.user.id});
this.oldMemberId = role;
this.$store.dispatch('training/setPrdType', prdType);
ConstConfig.ConstSelect.roleTypeNew.forEach(each=>{
if (each.label == memberInfo.type) {
@ -297,7 +302,7 @@ export default {
dumpScriptDataNew(group).then(resp => {
this.$parent.resetBeginTime();
this.$refs['getAction'].loadInitData();
this.initData();
this.changeRunPlanStatus();
this.memberId = '';
this.$store.dispatch('map/setRunPlanStatus', false);
this.$store.dispatch('training/setPrdType', '01');