This commit is contained in:
zyy 2020-06-30 11:19:58 +08:00
commit 82415903f5
16 changed files with 487 additions and 575 deletions

View File

@ -70,7 +70,7 @@ export default {
},
subscribeMessage(res) {
if (this.$refs.deomonTopic && !window.location.href.includes('trainroom')) {
if (getSessionStorage('project') != 'refereeJsxt' && getSessionStorage('project') != 'jsxt') {
if (getSessionStorage('project') != 'refereeJsxt' && getSessionStorage('project') != 'jsxt' && !(getSessionStorage('project').includes('design'))) {
this.$refs.deomonTopic.doShow(res);
}
this.$store.dispatch('socket/setRoomInvite');

View File

@ -18,6 +18,15 @@ export function setFailureMode(data, group) {
});
}
/** 设置自动故障(新版)*/
export function setFailureModeNew(data, group) {
return request({
url: `/simulation/${group}/faultMode`,
method: 'post',
data: data
});
}
/**
* 仿真系统按计划行车
*/

View File

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

View File

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

View File

@ -151,6 +151,7 @@ export default {
if (data == 'min') {
this.minimize = true;
this.$refs.chatSetting.doClose();
this.$refs.createGroup.doClose();
} else {
this.minimize = false;
}

View File

@ -17,7 +17,7 @@
</template>
<script>
import { getFailureGenerateRules, setFailureMode } from '@/api/simulation';
import { getFailureGenerateRules, setFailureModeNew } from '@/api/simulation';
import { FaultStatusEnum } from '@/scripts/FaultDic';
import ModelType from '@/jmap/constant/deviceType';
@ -138,7 +138,7 @@ export default {
handleConfirm() {
this.$nextTick(() => {
const faultModel = this.getFailureModel(this.auto);
setFailureMode(faultModel, this.group).then(() => {
setFailureModeNew(faultModel, this.group).then(() => {
this.$message.success(this.$t('display.faultChoose.setFaultSuccess'));
}).catch(() => {
this.$messageBox(this.$t('display.faultChoose.setFaultFail'));

View File

@ -10,12 +10,9 @@
ref="menuDemon"
:offset="offset"
:offset-bottom="offsetBottom"
:group="group"
:quest-id="questId"
:user-role="userRole"
@tryTime="tryTime"
@hidepanel="hidepanel"
:script-id="scriptId"
@quitQuest="quitQuest"
@hidepanel="hidepanel"
@showScheduling="showScheduling"
/>
@ -24,7 +21,6 @@
ref="menuSchema"
:offset="offset"
:offset-bottom="offsetBottom"
:group="group"
:show-station="showStation"
:station-list="stationList"
:show-select-station="showSelectStation"
@ -42,7 +38,7 @@
<fault-choose ref="faultChoose" :group="group" />
<run-plan-Load ref="runPlanLoad" :group="group" />
<run-plan-view ref="runPlanView" :group="group" />
<add-quest ref="addQuest" @selectQuest="selectQuest" />
<!-- <add-quest ref="addQuest" @selectQuest="selectQuestNew" /> -->
</div>
</template>
@ -54,16 +50,14 @@ import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import AddQuest from './demon/addQuest';
// import AddQuest from './demon/addQuest';
import { mapGetters } from 'vuex';
import { setGoodsTryUse } from '@/api/management/goods';
import { clearSimulation, getSimulationInfoNew, scriptExecuteNew } from '@/api/simulation';
import { clearSimulation, getSimulationInfoNew } 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 {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
//
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
@ -76,7 +70,7 @@ export default {
RunPlanLoad,
RunPlanView,
FaultChoose,
AddQuest,
// AddQuest,
MapSystemDraft,
MenuDemon,
MenuSchema,
@ -108,7 +102,7 @@ export default {
panelShow: true,
simulationShow: false,
drivingShow: false,
questId: 0, // Id
scriptId:0, // Id
showStation: '',
stationList: [],
showSelectStation: false, // select
@ -270,6 +264,10 @@ export default {
mousemove(e) {
this.mouseNum = 1;
},
// 退
async quitQuest() {
this.scriptId = 0;
},
setPosition() {
this.$nextTick(() => {
let offset = 15;
@ -351,41 +349,18 @@ export default {
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 selectQuest(row, id, mapLocation, roleName) {
try {
const res = this.drawWay ? await loadDraftScriptNew(id, this.group) : await loadDraftScript(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);
}
if (this.drawWay) {
scriptExecuteNew(this.group).then(data=>{
}).catch(error=>{
console.log(error);
});
}
// if (res.data && res.data.mapLocation) {
// const mapLocation={'offsetX': res.data.mapLocation.x, 'offsetY': res.data.mapLocation.y, 'scaleRate': res.data.mapLocation.scale};
// Vue.prototype.$jlmap.setOptions(mapLocation);
// }
}
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 selectQuest(row) {
this.scriptId = parseInt(row.id);
if (this.isDemon) {
this.$refs.menuDemon.initLoadPage();
}
if (this.isScript) {
this.$refs.menuScript.initLoadPage();
}
},
// 退
async quitQuest() {
this.questId = 0;
},
// id

View File

@ -1,24 +1,27 @@
<template>
<!-- -->
<div class="main" :style="{width: canvasWidth+'px'}">
<div v-show="panelShow" :panelShow="panelShow">
<transition name="el-zoom-in-bottom">
<map-system-draft ref="mapCanvas" @back="back" />
</transition>
<status-icon v-if="$route.query.lineCode == '11' || $route.query.lineCode == '10'" ref="statusIcon" />
<menu-exam
v-if="isExam"
ref="menuExam"
<!-- :group="group" -->
<!-- :show-station="showStation" -->
<menu-demon
v-if="isDemon"
ref="menuDemon"
:offset="offset"
:data-error="dataError"
:offset-bottom="offsetBottom"
:group="group"
:show-station="showStation"
:station-list="stationList"
:show-select-station="showSelectStation"
@switchStationMode="switchStationMode"
:data-error="dataError"
:script-id="scriptId"
@hidepanel="hidepanel"
@passflow="passflow"
@quitQuest="quitQuest"
@jl3dstation="jl3dstation"
@devicemodel="devicemodel"
@showScheduling="showScheduling"
/>
<!-- :training-obj="trainingObj" -->
<menu-lesson
v-if="isLesson"
ref="lessonMenu"
@ -26,39 +29,42 @@
:data-error="dataError"
:offset-bottom="offsetBottom"
:tip-bottom="tipBottom"
:group="group"
:training-obj="trainingObj"
:show-station="showStation"
: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"
:station-list="stationList"
:show-select-station="showSelectStation"
@switchStationMode="switchStationMode"
/>
<menu-demon
v-if="isDemon"
ref="menuDemon"
<menu-schema
v-if="isDemon || isScript "
ref="menuSchema"
:offset="offset"
:data-error="dataError"
:offset-bottom="offsetBottom"
:group="group"
:quest-id="questId"
:show-station="showStation"
:user-role="userRole"
@tryTime="tryTime"
@hidepanel="hidepanel"
@passflow="passflow"
@jl3dstation="jl3dstation"
@devicemodel="devicemodel"
@quitQuest="quitQuest"
@showScheduling="showScheduling"
:station-list="stationList"
:show-select-station="showSelectStation"
@switchMode="switchMode"
@selectQuest="selectQuest"
@switchStationMode="switchStationMode"
/>
<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
v-if="isPractice"
ref="menuPractice"
:group="group"
:offset="offset"
:offset-bottom="offsetBottom"
:show-station="showStation"
@ -71,27 +77,8 @@
<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" />
</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
v-if="deviceShow"
ref="Jl3dDevice"
@ -99,147 +86,129 @@
@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" />
<scheduling v-if="isShowScheduling" ref="scheduling" :group="group" />
</div>
</template>
<script>
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 MenuLesson from '@/views/newMap/displayNew/menuLesson';
import MenuDemon from '@/views/newMap/displayNew/menuDemon';
import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import MenuScript from '@/views/newMap/displayNew/menuScript';
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 Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
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 { loadNewMapDataByGroup } from '@/utils/loaddata';
import { timeFormat } from '@/utils/date';
import { getSessionStorage } from '@/utils/auth';
export default {
name: 'DisplayDraft',
components: {
MenuExam,
MenuLesson,
MapSystemDraft,
MenuDemon,
MenuScript,
MenuSchema,
StatusIcon,
MenuSystemTime,
MenuExam,
MenuLesson,
MenuSchema,
MenuTrainList,
MenuScript,
MenuPractice,
// Jl3dSimulation,
Jl3dDrive,
Jl3dDevice,
Scheduling,
LeftSlider,
StatusIcon
},
props: {
size: {
type: Object,
default() {
return null;
}
}
Scheduling
},
data() {
return {
mode: '',
trainingObj: {},
timeDemonNum: 0,
checkLine: null,
panelShow: true,
drivingShow: false,
deviceShow: false,
// simulationShow: false,
offset: 15,
offsetBottom: 15,
tipBottom: 0,
mouseNum: 1,
scriptId:0,
dataError: false,
group:'',
checkLine: null,
ierval: null,
mouseNumTime: 0,
// mapBox: null,
mapBoxP: null,
panelShow: true,
simulationShow: false,
drivingShow: false,
deviceShow: false,
questId: 0, // Id
showStation: '',
stationList: [],
grouper:'',
showSelectStation: false, // select
mouseNum: 1,
mouseNumTime: 0,
prdTypeMap: {
'01': '01', // =>
'02': '02', // =>
'04': '02', // =>
'05': '' // => null
},
dataError: false,
planRunning:false
};
},
computed: {
computed:{
...mapGetters([
'canvasWidth'
]),
...mapGetters('map', [
'map'
]),
...mapGetters('training', [
'offsetStationCode'
]),
...mapGetters('config', [
'canvasId'
]),
mode() {
return this.$route.params.mode;
},
isDemon() {
return this.mode === 'demon';
},
isExam() {
return this.mode === 'exam';
},
isLesson() {
return (this.mode === 'teach' || this.mode === 'manage');
},
isScript() {
return this.mode === 'script';
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
},
right() {
return this.$store.state.config.width / 2 - 55;
},
trainingId() {
return this.$route.query.trainingId;
},
...mapGetters('training', [
'offsetStationCode'
]),
...mapGetters('config', [
'canvasId'
]),
mapId() {
return this.$route.query.mapId;
},
prdType() {
return this.$route.query.prdType;
},
isLesson() {
return (this.mode === 'teach' || this.mode === 'manage');
project() {
return getSessionStorage('project');
},
isShowLeftSlider() {
return (this.mode === 'teach' || this.mode === 'manage') && (this.$route.query.lessonId != '0');
},
isExam() {
return this.mode === 'exam';
},
isDemon() {
return this.mode === 'demon';
},
isScript() {
return this.mode === 'script';
isShowScheduling() {
return this.$route.query.prdType == '05';
},
isPractice() {
return this.mode === 'practice';
@ -247,25 +216,11 @@ export default {
isDrive() {
return this.prdType == '04';
},
isShowScheduling() {
return this.$route.query.prdType == '05';
right() {
return this.$store.state.config.width / 2 - 55;
},
project() {
return getSessionStorage('project');
},
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';
}
trainingId() {
return this.$route.query.trainingId;
}
},
watch: {
@ -275,40 +230,9 @@ export default {
'$store.state.training.prdType': function (val) { //
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) {
this.mousemove();
},
'$store.state.socket.permissionOver': function () {
this.$alert('用户权限已被收回', '提示', {
confirmButtonText: '确定',
callback: action => {
this.back();
}
});
},
'size.width': function(val) {
this.setWindowSize();
},
@ -323,41 +247,178 @@ export default {
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) {
this.showSelectStation = val.skinVO.code === '06' && this.$store.state.training.prdType === '01';
this.showSelectStation && this.setStationList(val);
},
'group':function(group) {
this.grouper = group;
'$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');
}
this.switchStationMode(this.showStation);
}
},
async created() {
this.mode = this.$route.params.mode;
},
async mounted() {
this.grouper = this.group;
this.group = this.$route.query.group;
await this.setWindowSize();
await this.initLoadData();
},
beforeDestroy() {
this.quit(this.grouper);
this.quit(this.group);
this.clearAllTimer();
this.$store.dispatch('training/reset');
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() {
if (this.ierval) {
clearTimeout(this.ierval);
this.ierval = null;
}
if (this.checkLine) {
clearTimeout(this.checkLine);
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();
}
},
script3ddriveshow() {
this.panelShow = false;
this.drivingShow = true;
this.$refs.Jl3dDrive.show(this.mapId, this.group);
},
//
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() {
if (this.checkLine) {
@ -387,12 +448,112 @@ export default {
this.mapBoxP.style.cursor = 'none';
}
}
console.log(this.mapBoxP.style.cursor);
}, 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(row) {
this.scriptId = parseInt(row.id);
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();
}
},
// 退
async quitQuest() {
this.scriptId = 0;
},
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() {
this.$nextTick(() => {
let offset = 15;
@ -424,271 +585,6 @@ export default {
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) {
if (this.stationList.length > 0) {
if (val == null) {
@ -727,21 +623,6 @@ export default {
}
}
}
};
</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>
<div>
<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>
<span v-if="countTime" class="display-score">{{ $t('display.demon.trialTime') }} {{ countTime }}</span>
</el-row>
</div>
<div class="display-draft" :style="{bottom: offsetBottom + 'px'}">
<!-- :style="{bottom: offsetBottom + 'px'}" -->
<div class="display-draft">
<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="jl3dpassflow" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
@ -40,6 +42,7 @@ import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@
import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index';
import { quitScriptNew, scriptRePreview } from '@/api/simulation';
import { setGoodsTryUse } from '@/api/management/goods';
export default {
name: 'MenuDemon',
@ -48,10 +51,6 @@ export default {
ChatBox
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
@ -60,27 +59,17 @@ export default {
type: Number,
required: true
},
questId: {
scriptId: {
type: Number,
default() {
return 0;
}
},
showStation: {
type: String,
default() {
return '';
}
},
dataError: {
type: Boolean,
default() {
return false;
}
},
userRole: {
type: String,
required: true
}
},
data() {
@ -107,7 +96,7 @@ export default {
},
computed: {
isShowQuest() {
return this.questId;
return this.scriptId;
},
isShowScheduling() {
return this.$route.query.prdType == '05';
@ -117,6 +106,20 @@ export default {
},
isHebLine() {
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: {
@ -236,7 +239,7 @@ export default {
quitScriptNew(this.group).then(resp => {
scriptRePreview(this.group).then(resp=>{
getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest');
this.quitQuest();
this.initLoadPage();
this.clearAllData();
}).catch(()=>{
@ -251,7 +254,7 @@ export default {
} else {
quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then(()=>{
this.$emit('quitQuest');
this.quitQuest();
this.initLoadPage();
this.clearAllData();
}).catch(()=>{
@ -262,6 +265,10 @@ export default {
});
}
},
quitQuest() {
this.$emit('quitQuest');
this.$store.dispatch('scriptRecord/updateSimulationPause', false);
},
clearAllData() {
this.$refs.chatbox.clearAllData();
},
@ -289,7 +296,11 @@ export default {
},
setTryTime() {
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() {

View File

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

View File

@ -22,34 +22,28 @@
</el-button-group>
</div>
<tip-training-detail :training-obj="trainingObj" :offset-bottom="offsetBottom + tipBottom" />
<left-slider v-if="isShowLeftSlider" :offset-bottom="offsetBottom" @overallTranslation="overallTranslation" />
</div>
</template>
<script>
import TipTrainingDetail from './tipTrainingDetail';
import LeftSlider from '@/views/newMap/displayNew/LeftSlider';
import { mapGetters } from 'vuex';
import { Notification } from 'element-ui';
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';
export default {
name: 'MenuLesson',
components: {
TipTrainingDetail
TipTrainingDetail,
LeftSlider
},
props: {
group: {
type: String,
required: true
},
trainingObj: {
type: Object,
default() {
return null;
}
},
offset: {
type: Number,
required: true
@ -91,6 +85,7 @@ export default {
return {
timeInterval: null,
TrainingMode: TrainingMode,
trainingObj:{},
demoMode: TrainingMode.TEACH,
isDisable: false,
backDisable: false,
@ -104,11 +99,17 @@ export default {
'usedTime',
'basicInfo'
]),
group() {
return this.$route.query.group;
},
formatScore() {
return this.score;
},
formatUsedTime() {
return timeFormat(this.usedTime);
},
isShowLeftSlider() {
return this.$route.query.lessonId != '0';
}
},
watch: {
@ -121,6 +122,15 @@ export default {
this.isDisable = false;
},
'$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/reset');
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() {
//
this.$store.dispatch('menuOperation/setButtonOperation', null);
@ -231,14 +249,6 @@ export default {
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) {
this.$emit('switchStationMode', val);
}

View File

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

View File

@ -38,7 +38,9 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan';
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 {
@ -50,10 +52,6 @@ export default {
AddQuest
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
@ -102,6 +100,9 @@ export default {
...mapGetters('runPlan', [
'stations'
]),
group() {
return this.$route.query.group;
},
notScript() {
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};
this.$refs.addQuest.handleLoad(1, row);
},
selectQuest(row, id, mapLocation, roleName) {
this.$emit('selectQuest', row, id, mapLocation, roleName);
async 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', row);
} catch (error) {
this.$messageBox(error.message);
}
},
switchMode(swch) {
this.$emit('switchMode', swch);

View File

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

View File

@ -166,7 +166,7 @@ export default {
minDuration: res.data.minDuration,
updateTime: res.data.updateTime
};
this.$store.dispatch('exam/setCenter ', res.data.locateDeviceCode);
this.$store.dispatch('exam/setCenter', res.data.locateDeviceCode);
}).catch(error => {
this.$message.error(this.$t('display.exam.getTestInformation') + ':' + error.message);
});

View File

@ -129,6 +129,7 @@ export default {
if (data == 'min') {
this.minimize = true;
this.$refs.chatSetting.doClose();
this.$refs.createGroup.doClose();
} else {
this.minimize = false;
}