仿真代码调整

This commit is contained in:
joylink_cuiweidong 2020-06-29 15:55:31 +08:00
parent 6e542dcaf5
commit ccb976f078
11 changed files with 443 additions and 527 deletions

View File

@ -12,7 +12,7 @@ export function getFailureGenerateRules(params) {
/** 设置自动故障*/ /** 设置自动故障*/
export function setFailureMode(data, group) { export function setFailureMode(data, group) {
return request({ return request({
url: `/api/simulation/${group}/failureMode`, url: `/simulation/${group}/faultMode`,
method: 'post', method: 'post',
data: data data: data
}); });

View File

@ -106,6 +106,9 @@ const exam = {
countUsedTime({ commit }) { countUsedTime({ commit }) {
commit('countUsedTime'); commit('countUsedTime');
}, },
stopCountTime({ commit }) {
commit('stopCountTime');
},
setRuleList({ commit }, ruleList) { setRuleList({ commit }, ruleList) {
commit('setRuleList', ruleList); commit('setRuleList', ruleList);
}, },

View File

@ -6,8 +6,8 @@
</span> </span>
</div> </div>
<div class="handleShow"> <div class="handleShow">
<span v-if="show" class="el-icon-arrow-right" @click="handleSliderShow(true)">{{ $t('display.lesson.unfold') }}</span> <span v-if="show" class="el-icon-arrow-right" style="cursor:pointer" @click="handleSliderShow(true)">{{ $t('display.lesson.unfold') }}</span>
<span v-else class="el-icon-arrow-left" @click="handleSliderShow(false)">{{ $t('display.lesson.fold') }}</span> <span v-else class="el-icon-arrow-left" style="cursor:pointer" @click="handleSliderShow(false)">{{ $t('display.lesson.fold') }}</span>
</div> </div>
<div class="slider-tree"> <div class="slider-tree">
<el-scrollbar wrap-class="scrollbar-wrapper" style="background: #fff;"> <el-scrollbar wrap-class="scrollbar-wrapper" style="background: #fff;">

View File

@ -1,24 +1,26 @@
<template> <template>
<!-- -->
<div class="main" :style="{width: canvasWidth+'px'}"> <div class="main" :style="{width: canvasWidth+'px'}">
<div v-show="panelShow" :panelShow="panelShow"> <div v-show="panelShow" :panelShow="panelShow">
<transition name="el-zoom-in-bottom"> <transition name="el-zoom-in-bottom">
<map-system-draft ref="mapCanvas" @back="back" /> <map-system-draft ref="mapCanvas" @back="back" />
</transition> </transition>
<status-icon v-if="$route.query.lineCode == '11' || $route.query.lineCode == '10'" ref="statusIcon" /> <status-icon v-if="$route.query.lineCode == '11' || $route.query.lineCode == '10'" ref="statusIcon" />
<menu-exam <!-- :group="group" -->
v-if="isExam" <!-- :show-station="showStation" -->
ref="menuExam" <menu-demon
v-if="isDemon"
ref="menuDemon"
:offset="offset" :offset="offset"
:data-error="dataError"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:group="group" :data-error="dataError"
:show-station="showStation" :script-id="scriptId"
:station-list="stationList" @hidepanel="hidepanel"
:show-select-station="showSelectStation" @passflow="passflow"
@switchStationMode="switchStationMode" @jl3dstation="jl3dstation"
@devicemodel="devicemodel"
@showScheduling="showScheduling"
/> />
<!-- :training-obj="trainingObj" -->
<menu-lesson <menu-lesson
v-if="isLesson" v-if="isLesson"
ref="lessonMenu" ref="lessonMenu"
@ -26,39 +28,43 @@
:data-error="dataError" :data-error="dataError"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:tip-bottom="tipBottom" :tip-bottom="tipBottom"
:group="group" :show-station="showStation"
:training-obj="trainingObj" :station-list="stationList"
:show-select-station="showSelectStation"
@switchStationMode="switchStationMode"
/>
<menu-exam
v-if="isExam"
ref="menuExam"
:offset="offset"
:data-error="dataError"
:offset-bottom="offsetBottom"
:show-station="showStation" :show-station="showStation"
:station-list="stationList" :station-list="stationList"
:show-select-station="showSelectStation" :show-select-station="showSelectStation"
@switchStationMode="switchStationMode" @switchStationMode="switchStationMode"
/> />
<menu-demon <menu-schema
v-if="isDemon" v-if="isDemon || isScript "
ref="menuDemon" ref="menuSchema"
:offset="offset" :offset="offset"
:data-error="dataError" :data-error="dataError"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:group="group"
:quest-id="questId"
:show-station="showStation" :show-station="showStation"
:user-role="userRole" :station-list="stationList"
@tryTime="tryTime" :show-select-station="showSelectStation"
@hidepanel="hidepanel" @switchMode="switchMode"
@passflow="passflow" @selectQuest="selectQuest"
@jl3dstation="jl3dstation" @switchStationMode="switchStationMode"
@devicemodel="devicemodel"
@quitQuest="quitQuest"
@showScheduling="showScheduling"
/> />
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :group="group" :data-error="dataError" @script3ddriveshow="script3ddriveshow" /> <menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :data-error="dataError" @script3ddriveshow="script3ddriveshow" />
<menu-practice <menu-practice
v-if="isPractice" v-if="isPractice"
ref="menuPractice" ref="menuPractice"
:group="group"
:offset="offset" :offset="offset"
:offset-bottom="offsetBottom" :offset-bottom="offsetBottom"
:show-station="showStation" :show-station="showStation"
@ -71,27 +77,8 @@
<menu-train-list v-if="isDemon" @setCenter="setCenter" /> <menu-train-list v-if="isDemon" @setCenter="setCenter" />
<menu-schema
v-if="isDemon || isScript "
ref="menuSchema"
:offset="offset"
:data-error="dataError"
:offset-bottom="offsetBottom"
:group="group"
:show-station="showStation"
:station-list="stationList"
:show-select-station="showSelectStation"
@switchMode="switchMode"
@selectQuest="selectQuest"
@switchStationMode="switchStationMode"
/>
<menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" /> <menu-system-time ref="menuSystemTime" :offset="offset" :right="right" :group="group" />
</div> </div>
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<left-slider v-if="isShowLeftSlider" :offset-bottom="offsetBottom" @overallTranslation="overallTranslation" />
<Jl3d-Device <Jl3d-Device
v-if="deviceShow" v-if="deviceShow"
ref="Jl3dDevice" ref="Jl3dDevice"
@ -99,99 +86,84 @@
@closedevice3dview="devicemodel" @closedevice3dview="devicemodel"
/> />
<!-- <Jl3d-Simulation v-show="simulationShow" ref="Jl3dSimulation" :panel-show="simulationShow" @showpanel="showpanel" /> -->
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" /> <Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" /> <scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />
</div> </div>
</template> </template>
<script> <script>
import MapSystemDraft from '@/views/newMap/mapsystemNew/index'; import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import StatusIcon from '@/views/components/StatusIcon/statusIcon';
import MenuExam from '@/views/newMap/displayNew/menuExam'; import MenuExam from '@/views/newMap/displayNew/menuExam';
import MenuLesson from '@/views/newMap/displayNew/menuLesson'; import MenuLesson from '@/views/newMap/displayNew/menuLesson';
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime'; import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import MenuScript from '@/views/newMap/displayNew/menuScript'; import MenuScript from '@/views/newMap/displayNew/menuScript';
import MenuPractice from '@/views/newMap/displayNew/menuPractice'; import MenuPractice from '@/views/newMap/displayNew/menuPractice';
import Scheduling from './demon/scheduling';
import { mapGetters } from 'vuex';
import { getTrainingStepsDetailNew, getTrainingDetailNew } from '@/api/jmap/training';
import { setGoodsTryUse } from '@/api/management/goods';
import { clearSimulation, loadScriptNew, getSimulationInfoNew, scriptExecuteNew } from '@/api/simulation';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus';
import Vue from 'vue';
import LeftSlider from '@/views/newMap/displayNew/LeftSlider';
import { getSessionStorage } from '@/utils/auth';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import StatusIcon from '@/views/components/StatusIcon/statusIcon';
// //
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation'; // import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive'; import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice'; import Jl3dDevice from '@/views/jlmap3d/device/jl3ddevice';
import Scheduling from './demon/scheduling';
import { clearSimulation, getSimulationInfoNew} from '@/api/simulation';
import { getTrainingDetailNew } from '@/api/jmap/training';
// loadScriptNew, , scriptExecuteNew
import { mapGetters } from 'vuex';
import { checkLoginLine } from '@/api/login';
import { EventBus } from '@/scripts/event-bus';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { getSessionStorage } from '@/utils/auth';
export default { export default {
name: 'DisplayDraft', name: 'DisplayDraft',
components: { components: {
MenuExam,
MenuLesson,
MapSystemDraft, MapSystemDraft,
MenuDemon, MenuDemon,
MenuScript, StatusIcon,
MenuSchema,
MenuSystemTime, MenuSystemTime,
MenuExam,
MenuLesson,
MenuSchema,
MenuTrainList, MenuTrainList,
MenuScript,
MenuPractice, MenuPractice,
// Jl3dSimulation, // Jl3dSimulation,
Jl3dDrive, Jl3dDrive,
Jl3dDevice, Jl3dDevice,
Scheduling, Scheduling
LeftSlider,
StatusIcon
},
props: {
size: {
type: Object,
default() {
return null;
}
}
}, },
data() { data() {
return { return {
mode: '', panelShow: true,
trainingObj: {}, drivingShow: false,
timeDemonNum: 0, deviceShow: false,
checkLine: null, // simulationShow: false,
offset: 15, offset: 15,
offsetBottom: 15, offsetBottom: 15,
tipBottom: 0, tipBottom: 0,
mouseNum: 1, scriptId:0,
dataError: false,
group:'',
checkLine: null,
ierval: null, ierval: null,
mouseNumTime: 0,
// mapBox: null,
mapBoxP: null, mapBoxP: null,
panelShow: true,
simulationShow: false,
drivingShow: false,
deviceShow: false,
questId: 0, // Id
showStation: '', showStation: '',
stationList: [], stationList: [],
grouper:'',
showSelectStation: false, // select showSelectStation: false, // select
mouseNum: 1,
mouseNumTime: 0,
prdTypeMap: { prdTypeMap: {
'01': '01', // => '01': '01', // =>
'02': '02', // => '02': '02', // =>
'04': '02', // => '04': '02', // =>
'05': '' // => null '05': '' // => null
}, },
dataError: false,
planRunning:false planRunning:false
}; };
}, },
@ -199,47 +171,44 @@ export default {
...mapGetters([ ...mapGetters([
'canvasWidth' 'canvasWidth'
]), ]),
...mapGetters('map', [ mode() {
'map' return this.$route.params.mode;
]), },
...mapGetters('training', [ isDemon() {
'offsetStationCode' return this.mode === 'demon';
]), },
...mapGetters('config', [ isExam() {
'canvasId' return this.mode === 'exam';
]), },
isLesson() {
return (this.mode === 'teach' || this.mode === 'manage');
},
isScript() {
return this.mode === 'script';
},
width() { width() {
return this.$store.state.app.width; return this.$store.state.app.width;
}, },
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
}, },
right() { ...mapGetters('training', [
return this.$store.state.config.width / 2 - 55; 'offsetStationCode'
}, ]),
trainingId() { ...mapGetters('config', [
return this.$route.query.trainingId; 'canvasId'
}, ]),
mapId() { mapId() {
return this.$route.query.mapId; return this.$route.query.mapId;
}, },
prdType() { prdType() {
return this.$route.query.prdType; return this.$route.query.prdType;
}, },
isLesson() { project() {
return (this.mode === 'teach' || this.mode === 'manage'); return getSessionStorage('project');
}, },
isShowLeftSlider() { isShowScheduling() {
return (this.mode === 'teach' || this.mode === 'manage') && (this.$route.query.lessonId != '0'); return this.$route.query.prdType == '05';
},
isExam() {
return this.mode === 'exam';
},
isDemon() {
return this.mode === 'demon';
},
isScript() {
return this.mode === 'script';
}, },
isPractice() { isPractice() {
return this.mode === 'practice'; return this.mode === 'practice';
@ -247,25 +216,11 @@ export default {
isDrive() { isDrive() {
return this.prdType == '04'; return this.prdType == '04';
}, },
isShowScheduling() { right() {
return this.$route.query.prdType == '05'; return this.$store.state.config.width / 2 - 55;
}, },
project() { trainingId() {
return getSessionStorage('project'); return this.$route.query.trainingId;
},
group() {
return this.$route.query.group;
},
userRole() {
if (this.$route.query.prdType == '02') {
return 'DISPATCHER';
} else if (this.$route.query.prdType == '01') {
return 'STATION_SUPERVISOR';
} else if (this.$route.query.prdType == '04') {
return 'DRIVER';
} else {
return 'AUDIENCE';
}
} }
}, },
watch: { watch: {
@ -275,40 +230,9 @@ export default {
'$store.state.training.prdType': function (val) { // '$store.state.training.prdType': function (val) { //
this.setPosition(); this.setPosition();
}, },
'$store.state.map.mapViewLoadedCount': function (val) { //
this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = '';
// this.mapBox = document.getElementsByTagName('canvas');
if (this.planRunning) {
this.$store.dispatch('training/simulationStart');
}
if (this.trainingId) {
getTrainingStepsDetailNew(this.trainingId, { group: this.group }).then(resp => {
this.trainingObj = resp.data;
this.$store.dispatch('training/setTrainingData', this.trainingObj);
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
}
this.switchStationMode(this.showStation);
},
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.showStation = code;
}
},
'$store.state.map.mousemove': function (val) { '$store.state.map.mousemove': function (val) {
this.mousemove(); this.mousemove();
}, },
'$store.state.socket.permissionOver': function () {
this.$alert('用户权限已被收回', '提示', {
confirmButtonText: '确定',
callback: action => {
this.back();
}
});
},
'size.width': function(val) { 'size.width': function(val) {
this.setWindowSize(); this.setWindowSize();
}, },
@ -323,41 +247,173 @@ export default {
this.initLoadData(); this.initLoadData();
}); });
}, },
'$store.state.training.centerStationCode': function(code) {
if (code) {
this.showStation = code;
}
},
'$store.state.socket.permissionOver': function () {
this.$alert('用户权限已被收回', '提示', {
confirmButtonText: '确定',
callback: action => {
this.back();
}
});
},
'$store.state.map.map': function (val) { '$store.state.map.map': function (val) {
this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01'; this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01';
this.showSelectStation && this.setStationList(val); this.showSelectStation && this.setStationList(val);
}, },
'group':function(group) { '$store.state.map.mapViewLoadedCount': function (val) { //
this.grouper = group; this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = '';
// this.mapBox = document.getElementsByTagName('canvas');
if (this.planRunning) {
this.$store.dispatch('training/simulationStart');
}
this.switchStationMode(this.showStation);
} }
}, },
async created() {
this.mode = this.$route.params.mode;
},
async mounted() { async mounted() {
this.grouper = this.group; this.group = this.$route.query.group;
await this.setWindowSize(); await this.setWindowSize();
await this.initLoadData(); await this.initLoadData();
}, },
beforeDestroy() { beforeDestroy() {
this.quit(this.grouper); this.quit(this.group);
this.clearAllTimer(); this.clearAllTimer();
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
this.$store.dispatch('map/mapClear'); this.$store.dispatch('map/mapClear');
}, },
methods:{ methods:{
// 仿退
async back() {
if (this.isExam) {
await this.$refs.menuExam.back();
} else if (this.isLesson) {
await this.$refs.lessonMenu.back();
} else if (this.isDemon) {
await this.$refs.menuDemon.back();
} else if (this.isScript) {
await this.$refs.menuScript.back();
}
},
// 仿
quit(group) {
clearSimulation(group);
this.$store.dispatch('training/over');
},
// 线 // 线
clearAllTimer() { clearAllTimer() {
if (this.ierval) { if (this.ierval) {
clearTimeout(this.ierval); clearTimeout(this.ierval);
this.ierval = null; this.ierval = null;
} }
if (this.checkLine) { if (this.checkLine) {
clearTimeout(this.checkLine); clearTimeout(this.checkLine);
this.checkLine = null; this.checkLine = null;
} }
}, },
mousemove() {
this.mouseNum = 1;
},
//
setWindowSize() {
// this.size ? this.size.width :
const width = this.width;
// this.size ? this.size.height :
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
},
//
async initLoadData() {
this.$store.dispatch('training/reset');
try {
await this.loadSimulationInfo();
if (this.isDemon) {
await this.initLoadDemonData();
} else if (this.isScript) {
await this.initLoadScriptData();
} else if (this.isPractice) {
await this.initPracticeData();
} else {
await this.initLoadLessonOrExamData();
}
this.checkLoginLineTimer();
this.checkMouseStatusTimer();
} catch (error) {
this.$messageBox(`初始化失败: ${error.message}`);
this.endViewLoading();
}
},
//
async initLoadScriptData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.switchMode('01');
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
//
async initLoadLessonOrExamData() {
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (parseInt(this.trainingId)) {
//
//
const resp = await getTrainingDetailNew(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
await this.loadNewMapDataByGroup(this.group);
} else {
this.$messageBox(`获取实训步骤数据失败`);
this.endViewLoading();
}
} else {
this.endViewLoading();
}
},
//
async initPracticeData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.switchMode('01');
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
// 仿
async loadSimulationInfo() {
// this.dataError = false;
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data && !resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.scriptId = Number(resp.data.scriptId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.planRunning = resp.data.planRunning;
if (!resp.data.planRunning) {
this.$store.dispatch('training/over');
}
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
} else if (this.isScript) {
// this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
}
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true;
this.$messageBox('此地图数据正在维护中,无法运行!');
}
},
// 线 // 线
checkLoginLineTimer() { checkLoginLineTimer() {
if (this.checkLine) { if (this.checkLine) {
@ -387,12 +443,107 @@ export default {
this.mapBoxP.style.cursor = 'none'; this.mapBoxP.style.cursor = 'none';
} }
} }
console.log(this.mapBoxP.style.cursor);
}, 1000); }, 1000);
}, },
mousemove() { //
this.mouseNum = 1; endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
}, },
switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType);
},
//
selectQuest() {
if (this.isDemon) {
this.$refs.menuDemon.initLoadPage();
}
if (this.isScript) {
this.$refs.menuScript.initLoadPage();
}
},
// 仿
async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]);
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
// group
async loadNewMapDataByGroup(group) {
try {
await loadNewMapDataByGroup(group);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
hidepanel() {
if (this.isDrive) {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group);
} else {
const routeData = this.$router.resolve({
path:'/jlmap3d/sandbox',
query:{
mapid:this.mapId,
group:this.group,
token:getToken(),
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
},
passflow() {
const routeData = this.$router.resolve({
path:'/jlmap3d/passengerflow',
query:{
mapid:this.mapId,
group:this.group,
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
devicemodel() {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
jl3dstation() {
const routeData = this.$router.resolve({
path:'/jlmap3d/jl3dstation',
query:{
mapid:this.mapId,
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
showScheduling() {
this.$refs.scheduling.doShow();
},
showdriving() {
this.panelShow = true;
this.drivingShow = false;
},
// showpanel() {
// this.panelShow = true;
// this.simulationShow = false;
// }
setPosition() { setPosition() {
this.$nextTick(() => { this.$nextTick(() => {
let offset = 15; let offset = 15;
@ -424,271 +575,6 @@ export default {
setCenter(code) { setCenter(code) {
this.$refs.mapCanvas.setCenter(code); this.$refs.mapCanvas.setCenter(code);
}, },
//
endViewLoading(isSuccess) {
if (!isSuccess) {
this.$store.dispatch('map/mapClear');
}
this.$nextTick(() => {
EventBus.$emit('viewLoading', false);
});
},
// 仿
async loadSimulationInfo() {
this.dataError = false;
const resp = await getSimulationInfoNew(this.group);
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.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
if (resp.data.planRunning) {
this.planRunning = resp.data.planRunning;
} else {
this.$store.dispatch('training/over');
}
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
} else if (this.isScript) {
this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
}
} else if (resp && resp.code == 200 && resp.data && resp.data.dataError) {
this.dataError = true;
this.$messageBox('此地图数据正在维护中,无法运行!');
}
},
//
async initLoadData() {
this.$store.dispatch('training/reset');
try {
await this.loadSimulationInfo();
if (this.isDemon) {
await this.initLoadDemonData();
} else if (this.isScript) {
await this.initLoadTaskData();
} else if (this.isPractice) {
await this.initPracticeData();
} else {
await this.initLoadLessonOrExamData();
}
this.checkLoginLineTimer();
this.checkMouseStatusTimer();
} catch (error) {
this.$messageBox(`初始化失败: ${error.message}`);
this.endViewLoading();
}
},
//
async initLoadLessonOrExamData() {
this.$store.dispatch('training/end', null);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (parseInt(this.trainingId)) {
//
//
const resp = await getTrainingDetailNew(this.trainingId);
if (resp && resp.code == 200) {
const detail = resp.data;
await this.$store.dispatch('training/setPrdType', this.prdTypeMap[detail.prdType]);
await this.loadNewMapDataByGroup(this.group);
} else {
this.$messageBox(`获取实训步骤数据失败`);
this.endViewLoading();
}
} else {
this.endViewLoading();
}
},
// 仿
async initLoadDemonData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.$store.dispatch('training/setPrdType', this.prdTypeMap[this.prdType]);
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
//
async initLoadTaskData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.switchMode('01');
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
//
async initPracticeData() {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
this.switchMode('01');
if (parseInt(this.mapId)) {
await this.loadNewMapDataByGroup(this.group);
} else {
this.endViewLoading();
}
},
//
async selectQuest(row, id, mapLocation, roleName) {
try {
const res = await loadScriptNew(row.id, id, this.group);
if (res && res.code == 200) {
this.questId = parseInt(row.id);
if (mapLocation) {
const newMapLocation = {'offsetX': mapLocation.x, 'offsetY': mapLocation.y, 'scaleRate': mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation);
}
scriptExecuteNew(this.group).then(data=>{
}).catch(error=>{
console.log(error);
});
}
if (this.$refs.menuDemon) {
await this.$refs.menuDemon.initLoadPage();
}
if (this.$refs.menuScript) {
await this.$refs.menuScript.initLoadPage();
}
} catch (error) {
this.$messageBox(error.message);
}
},
// 退
async quitQuest() {
this.questId = 0;
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
},
// id
async loadNewMapDataByGroup(group) {
try {
await loadNewMapDataByGroup(group);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();
}
},
// 仿
quit(group) {
clearSimulation(group);
this.$store.dispatch('training/over');
},
// 仿退
async back() {
if (this.isExam) {
await this.$refs.menuExam.back();
} else if (this.isLesson) {
await this.$refs.lessonMenu.back();
} else if (this.isDemon) {
await this.$refs.menuDemon.back();
} else if (this.isScript) {
await this.$refs.menuScript.back();
}
},
// 使
async tryTime(param) {
const data = {
goodsId: param.goodsId,
time: param.time
};
if (data.goodsId) {
await setGoodsTryUse(data);
}
},
switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType);
},
hidepanel() {
if (this.isDrive) {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group);
} else {
const routeData = this.$router.resolve({
path:'/jlmap3d/sandbox',
query:{
mapid:this.mapId,
group:this.group,
token:getToken(),
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}
},
script3ddriveshow() {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group);
},
passflow() {
const routeData = this.$router.resolve({
path:'/jlmap3d/passengerflow',
query:{
mapid:this.mapId,
group:this.group,
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
jl3dstation() {
const routeData = this.$router.resolve({
path:'/jlmap3d/jl3dstation',
query:{
mapid:this.mapId,
project: this.project
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
devicemodel() {
if (this.deviceShow == false) {
this.deviceShow = true;
} else {
this.deviceShow = false;
}
},
showScheduling() {
this.$refs.scheduling.doShow();
},
showpanel() {
this.panelShow = true;
this.simulationShow = false;
},
showdriving() {
this.panelShow = true;
this.drivingShow = false;
},
setWindowSize() {
// this.$nextTick(() => {
const width = this.size ? this.size.width : this.width;
const height = this.size ? this.size.height : this.height;
this.$store.dispatch('config/resize', { width, height });
this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
// });
},
overallTranslation(flag) {
const panel = document.getElementById('leftSlider');
this.$refs.lessonMenu.handelGroupButtonTranslate(flag);
if (flag) {
panel.style.transform = 'translateX(400px)';
} else {
panel.style.transform = '';
}
},
switchStationMode(val) { switchStationMode(val) {
if (this.stationList.length > 0) { if (this.stationList.length > 0) {
if (val == null) { if (val == null) {
@ -727,21 +613,6 @@ export default {
} }
} }
} }
}; };
</script> </script>
<style>
.main {
z-index: 10;
display: block;
width: 100%;
height: 100%;
overflow: hidden;
-moz-user-select: none;
-o-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
</style>

View File

@ -1,12 +1,14 @@
<template> <template>
<div> <div>
<chat-box ref="chatbox" :group="group" :user-role="userRole" /> <chat-box ref="chatbox" :group="group" :user-role="userRole" />
<div class="display-card" :style="{top: offset+'px'}"> <!-- :style="{top: offset+'px'}" -->
<div class="display-card">
<el-row> <el-row>
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span> <span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
</el-row> </el-row>
</div> </div>
<div class="display-draft" :style="{bottom: offsetBottom + 'px'}"> <!-- :style="{bottom: offsetBottom + 'px'}" -->
<div class="display-draft">
<el-button-group> <el-button-group>
<el-button v-if="isShowScheduling && !dataError" type="primary" @click="jumpScheduling">{{ $t('display.demon.dispatchingPlan') }}</el-button> <el-button v-if="isShowScheduling && !dataError" type="primary" @click="jumpScheduling">{{ $t('display.demon.dispatchingPlan') }}</el-button>
<el-button v-if="!isShowScheduling && !dataError" type="jl3dpassflow" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button> <el-button v-if="!isShowScheduling && !dataError" type="jl3dpassflow" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
@ -40,6 +42,7 @@ import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@
import { PermissionType } from '@/scripts/ConstDic'; import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index'; import { getCountTime } from '@/utils/index';
import { quitScriptNew, scriptRePreview } from '@/api/simulation'; import { quitScriptNew, scriptRePreview } from '@/api/simulation';
import { setGoodsTryUse } from '@/api/management/goods';
export default { export default {
name: 'MenuDemon', name: 'MenuDemon',
@ -48,10 +51,6 @@ export default {
ChatBox ChatBox
}, },
props: { props: {
group: {
type: String,
required: true
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -60,27 +59,17 @@ export default {
type: Number, type: Number,
required: true required: true
}, },
questId: { scriptId: {
type: Number, type: Number,
default() { default() {
return 0; return 0;
} }
}, },
showStation: {
type: String,
default() {
return '';
}
},
dataError: { dataError: {
type: Boolean, type: Boolean,
default() { default() {
return false; return false;
} }
},
userRole: {
type: String,
required: true
} }
}, },
data() { data() {
@ -107,7 +96,7 @@ export default {
}, },
computed: { computed: {
isShowQuest() { isShowQuest() {
return this.questId; return this.scriptId;
}, },
isShowScheduling() { isShowScheduling() {
return this.$route.query.prdType == '05'; return this.$route.query.prdType == '05';
@ -117,6 +106,20 @@ export default {
}, },
isHebLine() { isHebLine() {
return this.$route.query.lineCode === '07'; return this.$route.query.lineCode === '07';
},
group() {
return this.$route.query.group;
},
userRole() {
if (this.$route.query.prdType == '02') {
return 'DISPATCHER';
} else if (this.$route.query.prdType == '01') {
return 'STATION_SUPERVISOR';
} else if (this.$route.query.prdType == '04') {
return 'DRIVER';
} else {
return 'AUDIENCE';
}
} }
}, },
watch: { watch: {
@ -236,7 +239,7 @@ export default {
quitScriptNew(this.group).then(resp => { quitScriptNew(this.group).then(resp => {
scriptRePreview(this.group).then(resp=>{ scriptRePreview(this.group).then(resp=>{
getSimulationInfoNew(this.group).then(()=>{ getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest'); this.quitQuest();
this.initLoadPage(); this.initLoadPage();
this.clearAllData(); this.clearAllData();
}).catch(()=>{ }).catch(()=>{
@ -251,7 +254,7 @@ export default {
} else { } else {
quitScriptNew(this.group).then(resp => { quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then(()=>{ getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest'); this.quitQuest();
this.initLoadPage(); this.initLoadPage();
this.clearAllData(); this.clearAllData();
}).catch(()=>{ }).catch(()=>{
@ -262,6 +265,10 @@ export default {
}); });
} }
}, },
quitQuest() {
this.scriptId = 0;
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
},
clearAllData() { clearAllData() {
this.$refs.chatbox.clearAllData(); this.$refs.chatbox.clearAllData();
}, },
@ -289,7 +296,11 @@ export default {
}, },
setTryTime() { setTryTime() {
if (this.try) { if (this.try) {
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId }); const data = { time: this.tryTime, goodsId: this.goodsId };
if (data.goodsId) {
setGoodsTryUse(data);
}
} }
}, },
change3dname() { change3dname() {

View File

@ -33,10 +33,6 @@ export default {
TipExamList TipExamList
}, },
props: { props: {
group: {
type: String,
required: true
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -82,6 +78,9 @@ export default {
}; };
}, },
computed: { computed: {
group() {
return this.$route.query.group;
},
formatUsedTime() { formatUsedTime() {
return timeFormat(this.$store.state.training.usedTime); return timeFormat(this.$store.state.training.usedTime);
} }

View File

@ -22,34 +22,28 @@
</el-button-group> </el-button-group>
</div> </div>
<tip-training-detail :training-obj="trainingObj" :offset-bottom="offsetBottom + tipBottom" /> <tip-training-detail :training-obj="trainingObj" :offset-bottom="offsetBottom + tipBottom" />
<left-slider v-if="isShowLeftSlider" :offset-bottom="offsetBottom" @overallTranslation="overallTranslation" />
</div> </div>
</template> </template>
<script> <script>
import TipTrainingDetail from './tipTrainingDetail'; import TipTrainingDetail from './tipTrainingDetail';
import LeftSlider from '@/views/newMap/displayNew/LeftSlider';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { startTrainingNew, endTrainingNew } from '@/api/jmap/training'; import { startTrainingNew, endTrainingNew } from '@/api/jmap/training';
import { trainingNotifyNew } from '@/api/simulation'; import { trainingNotifyNew } from '@/api/simulation';
import { TrainingMode, UrlConfig } from '@/scripts/ConstDic'; import { TrainingMode, UrlConfig } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import { getTrainingStepsDetailNew } from '@/api/jmap/training';
export default { export default {
name: 'MenuLesson', name: 'MenuLesson',
components: { components: {
TipTrainingDetail TipTrainingDetail,
LeftSlider
}, },
props: { props: {
group: {
type: String,
required: true
},
trainingObj: {
type: Object,
default() {
return null;
}
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -91,6 +85,7 @@ export default {
return { return {
timeInterval: null, timeInterval: null,
TrainingMode: TrainingMode, TrainingMode: TrainingMode,
trainingObj:{},
demoMode: TrainingMode.TEACH, demoMode: TrainingMode.TEACH,
isDisable: false, isDisable: false,
backDisable: false, backDisable: false,
@ -104,11 +99,17 @@ export default {
'usedTime', 'usedTime',
'basicInfo' 'basicInfo'
]), ]),
group() {
return this.$route.query.group;
},
formatScore() { formatScore() {
return this.score; return this.score;
}, },
formatUsedTime() { formatUsedTime() {
return timeFormat(this.usedTime); return timeFormat(this.usedTime);
},
isShowLeftSlider() {
return this.$route.query.lessonId != '0';
} }
}, },
watch: { watch: {
@ -121,6 +122,15 @@ export default {
this.isDisable = false; this.isDisable = false;
}, },
'$store.state.map.mapViewLoadedCount': function (val) { '$store.state.map.mapViewLoadedCount': function (val) {
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);
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
}
this.$store.dispatch('training/end', null); this.$store.dispatch('training/end', null);
this.$store.dispatch('training/reset'); this.$store.dispatch('training/reset');
this.$store.dispatch('training/emitTipFresh'); this.$store.dispatch('training/emitTipFresh');
@ -142,6 +152,14 @@ export default {
}); });
} }
}, },
overallTranslation(flag) {
const panel = document.getElementById('leftSlider');
if (flag) {
panel.style.transform = 'translateX(400px)';
} else {
panel.style.transform = '';
}
},
start() { start() {
// //
this.$store.dispatch('menuOperation/setButtonOperation', null); this.$store.dispatch('menuOperation/setButtonOperation', null);
@ -231,14 +249,6 @@ export default {
history.go(-1); history.go(-1);
} }
}, },
handelGroupButtonTranslate(flag) {
// const buttons = document.getElementById('teachGroupButton');
// if (flag) {
// buttons.style.transform = 'translateX(-400px)';
// } else {
// buttons.style.transform = 'translateX(0px)';
// }
},
switchStationMode(val) { switchStationMode(val) {
this.$emit('switchStationMode', val); this.$emit('switchStationMode', val);
} }

View File

@ -30,10 +30,6 @@ export default {
SetTime SetTime
}, },
props: { props: {
group: {
type: String,
required: true
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -78,6 +74,11 @@ export default {
] ]
}; };
}, },
computed:{
group() {
return this.$route.query.group;
}
},
watch:{ watch:{
'showStation':function(val) { 'showStation':function(val) {
this.showStationContent = this.showStation; this.showStationContent = this.showStation;

View File

@ -38,7 +38,9 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan'; // import { getStationList } from '@/api/runplan';
import { getByGroupStationList } from '@/api/jmap/map'; import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanNew } from '@/api/simulation'; import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import { getEveryDayRunPlanNew, loadScriptNew, scriptExecuteNew } from '@/api/simulation';
import Vue from 'vue';
// //
export default { export default {
@ -50,10 +52,6 @@ export default {
AddQuest AddQuest
}, },
props: { props: {
group: {
type: String,
required: true
},
offset: { offset: {
type: Number, type: Number,
required: true required: true
@ -102,6 +100,9 @@ export default {
...mapGetters('runPlan', [ ...mapGetters('runPlan', [
'stations' 'stations'
]), ]),
group() {
return this.$route.query.group;
},
notScript() { notScript() {
return this.$route.params.mode !== 'script'; return this.$route.params.mode !== 'script';
}, },
@ -197,8 +198,29 @@ export default {
const row = {id: this.$route.query.scriptId, group:this.$route.query.group, drawWay:this.$route.query.drawWay}; const row = {id: this.$route.query.scriptId, group:this.$route.query.group, drawWay:this.$route.query.drawWay};
this.$refs.addQuest.handleLoad(1, row); this.$refs.addQuest.handleLoad(1, row);
}, },
selectQuest(row, id, mapLocation, roleName) { async selectQuest(row, id, mapLocation, roleName) {
this.$emit('selectQuest', row, id, mapLocation, roleName); try {
let res;
if (this.isDesignPlatform) {
res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(row.id, id, this.group);
} else {
res = await loadScriptNew(row.id, id, this.group);
}
if (res && res.code == 200) {
this.questId = parseInt(row.id);
if (mapLocation) {
const newMapLocation = {'offsetX': mapLocation.x, 'offsetY': mapLocation.y, 'scaleRate': mapLocation.scale};
Vue.prototype.$jlmap.setOptions(newMapLocation);
}
scriptExecuteNew(this.group).then(data=>{
}).catch(error=>{
console.log(error);
});
}
this.$emit('selectQuest');
} catch (error) {
this.$messageBox(error.message);
}
}, },
switchMode(swch) { switchMode(swch) {
this.$emit('switchMode', swch); this.$emit('switchMode', swch);

View File

@ -38,10 +38,6 @@ export default {
TipScriptRecordNew TipScriptRecordNew
}, },
props: { props: {
group: {
type: String,
required: true
},
offsetBottom: { offsetBottom: {
type: Number, type: Number,
required: true required: true
@ -78,6 +74,9 @@ export default {
...mapGetters('map', [ ...mapGetters('map', [
'trainList' 'trainList'
]), ]),
group() {
return this.$route.query.group;
},
userRole() { userRole() {
if (this.$store.state.training.prdType == '02') { if (this.$store.state.training.prdType == '02') {
return 'DISPATCHER'; return 'DISPATCHER';