调整地图绘制流程

This commit is contained in:
zyy 2020-07-31 15:24:44 +08:00
parent ea333e6c6d
commit d15328de57
16 changed files with 83 additions and 147 deletions

View File

@ -16,7 +16,7 @@ import { checkLoginLine } from '@/api/login';
import { EventBus } from '@/scripts/event-bus';
import MenuReplay from './menuReplay';
import { getToken } from '@/utils/auth';
import { DeviceMenu, getDeviceMenuByDeviceType } from '@/scripts/ConstDic';
import { getDeviceMenuByDeviceType } from '@/scripts/ConstDic';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
export default {
name:'RefereeDisplay',
@ -151,7 +151,6 @@ export default {
async initLoadData() {
this.$store.dispatch('training/reset');
try {
// await this.loadSimulationInfo();
await this.initLoadRecordData();
this.checkLoginLineTimer();
} catch (error) {
@ -219,29 +218,6 @@ export default {
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.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(',');
// }
// },
setWindowSize() {
this.$nextTick(() => {
const width = this.width;

View File

@ -141,10 +141,6 @@ export default {
}
},
watch:{
// $store.state.config.menuBarLoadedCount
// 'offset': function (val) {
// this.dialogShow && this.dragEvent();
// },
'$store.state.socket.autoFaultTrigger':function(val) {
this.dialogShow && this.getSimulationFaultRules();
}

View File

@ -52,7 +52,7 @@ import Cookies from 'js-cookie';
//
// import Jl3dSimulation from '@/views/jlmap3d/simulation/jl3dsimulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
// import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { timeFormat } from '@/utils/date';
export default {
@ -63,8 +63,8 @@ export default {
ScriptPreviewChat,
MapSystemDraft,
MenuSchema,
MenuSystemTime,
Jl3dDrive
MenuSystemTime
// Jl3dDrive
},
data() {
return {
@ -100,8 +100,8 @@ export default {
'canvasHeight'
]),
...mapGetters('map', [
'map',
'stationList'
'map',
'stationList'
]),
// ...mapGetters('training', [
// 'offsetStationCode'
@ -146,8 +146,8 @@ export default {
}
},
'$store.state.training.prdType':function(val) {
this.setPosition();
this.setMode();
this.setPosition();
this.setMode();
},
// '$store.state.training.prdType': function(val) {
// debugger;
@ -160,7 +160,7 @@ export default {
},
'stationList': function () {
this.setStationList();
},
},
$route() {
// this.$nextTick(() => {
this.initLoadData();
@ -246,11 +246,11 @@ export default {
},
setPosition() {
this.$nextTick(() => {
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
const menuBottom = document.getElementById('menuButton');
this.offset = 15 + (menuBar ? menuBar.offsetHeight || 0 : 0) + (menuTool ? menuTool.offsetHeight || 0 : 0);
this.offsetBottom = 15 + (menuBottom ? menuBottom.offsetHeight || 0 : 0);
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
const menuBottom = document.getElementById('menuButton');
this.offset = 15 + (menuBar ? menuBar.offsetHeight || 0 : 0) + (menuTool ? menuTool.offsetHeight || 0 : 0);
this.offsetBottom = 15 + (menuBottom ? menuBottom.offsetHeight || 0 : 0);
});
},
async back() {
@ -295,8 +295,8 @@ export default {
lastData = Object.values(lastData);
const lastMemberList = [];
const dispatcherList = [];
const electricDispatcherList = [];
const depotDispatcherList = [];
// const electricDispatcherList = [];
// const depotDispatcherList = [];
const stationSupervisorList = [];
const driverList = [];
const maintainerList = [];
@ -386,10 +386,10 @@ export default {
},
switchMode(prdType) {
this.$store.dispatch('training/setPrdType', prdType);
},
setMode() {
this.showSelectStation = this.$store.state.map.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
},
},
setMode() {
this.showSelectStation = this.$store.state.map.map.skinVO.code === '06' && this.$store.state.training.prdType === '01';
},
// hidepanel() {
// if (this.isDrive) {
// this.panelShow = false;

View File

@ -12,12 +12,14 @@
:offset-bottom="offsetBottom"
:data-error="dataError"
:script-id="scriptId"
:show-station="showStation"
@hidepanel="hidepanel"
@passflow="passflow"
@quitQuest="quitQuest"
@jl3dstation="jl3dstation"
@devicemodel="devicemodel"
@showScheduling="showScheduling"
@switchStationMode="switchStationMode"
/>
<menu-lesson
v-if="isLesson"
@ -142,7 +144,7 @@ export default {
offset: 15,
offsetBottom: 15,
tipBottom: 0,
scriptId:0,
scriptId: 0,
dataError: false,
group:'',
showStation: '',
@ -212,7 +214,7 @@ export default {
}
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
'$store.state.config.menuBarLoadedCount': function (val) { // menuBar
this.setPosition();
},
'$store.state.training.prdType': function (val) { //
@ -356,10 +358,9 @@ export default {
this.endViewLoading();
}
},
// 仿
// 仿group仿
async loadSimulationInfo() {
// 仿
getSimulationMemberList(this.$route.query.group).then(resp => {
getSimulationMemberList(this.$route.query.group).then(resp => { // 仿
this.$store.dispatch('training/setMemberList', {memberList:resp.data, userId: this.$store.state.user.id});
}).catch(() => {
this.$messageBox('获取仿真成员列表失败!');
@ -372,11 +373,11 @@ export default {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.planRunning = resp.data.planRunning;
this.$store.dispatch('map/setRunPlanStatus', this.planRunning);
if (!resp.data.planRunning) {
if (!this.planRunning) {
this.$store.dispatch('training/over');
}
if (this.isDemon) {
this.$refs.menuDemon.initPlannedDriving(resp.data.planRunning);
this.$refs.menuDemon.initPlannedDriving(this.planRunning); //
} else if (this.isScript) {
// this.$refs.menuScript.initPlannedDriving(resp.data.planRunning);
}

View File

@ -11,12 +11,11 @@
<el-button type="primary" size="small" @click="back">{{ projectDevice?'退出':$t('display.demon.back') }}</el-button>
<template v-if="!dataError">
<template v-if="isShowQuest">
<!-- && !isDesignPlatform -->
<el-button v-if="!isDesignPlatform" type="danger" size="small" @click="handleQuitQuest">{{ $t('display.demon.exitScript') }}</el-button>
<el-button v-if="!isDesignPlatform" type="danger" size="small" @click="handleQuitQuest">退出剧本</el-button>
</template>
<template v-else-if="!projectDevice">
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
<el-button type="success" :disabled="isDisable || dataError" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
</template>
<!-- 设备视图 -->
<el-button v-if="isShow3dmodel && !isShowScheduling" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
@ -67,6 +66,12 @@ export default {
return 0;
}
},
showStation: {
type: String,
default() {
return '';
}
},
dataError: {
type: Boolean,
default() {
@ -129,13 +134,6 @@ export default {
'$store.state.training.subscribeCount': function () {
this.group && this.initLoadPage();
},
'$store.state.socket.tipOperateCount': function (val) {
this.$alert(this.$t('display.demon.taskOperateSuccess'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
callback: action => {
}
});
},
'$store.state.socket.simulationRoleList':function(val) {
(val || []).forEach(item => {
if (item.messageType === 'KICK_OUT' && item.userId == this.$store.state.user.id) {
@ -192,7 +190,7 @@ export default {
selectBeginTime() {
this.$refs.setTime.doShow();
},
start(model) {
start(model) { // 仿
this.isDisable = true;
const data = {
time: model.initTime
@ -205,6 +203,9 @@ export default {
this.$store.dispatch('map/setRunPlanStatus', true);
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
this.$store.dispatch('map/setShowCentralizedStationNum');
if (this.$route.query.lineCode == '06') {
this.$emit('switchStationMode', this.showStation); // 线
}
});
}).catch(error => {
this.isDisable = false;
@ -249,7 +250,7 @@ export default {
},
handleQuitQuest() {
quitScriptNew(this.group).then(resp => {
getSimulationInfoNew(this.group).then(()=>{
getSimulationInfoNew(this.group).then((res)=>{
this.quitQuest();
this.initLoadPage();
this.clearAllData();

View File

@ -10,8 +10,6 @@
</div>
<div class="practice-bottom" :style="{bottom: offsetBottom + 'px'}">
<el-button-group>
<!-- v-if="!isScriptCommand" -->
<!-- v-if="!isScriptCommand" -->
<el-button type="success" :disabled="isDisable || dataError" @click="selectBeginTime">按计划行车</el-button>
<el-button type="danger" :disabled="dataError" @click="end">初始化</el-button>
<el-button type="primary" @click="back">返回</el-button>
@ -98,14 +96,7 @@ export default {
this.isDisable = true;
const data = {
time: model.initTime
// loadNumber:this.trainList.length
};
// const data = {
// time: model.initTime
// };
// if (this.$route.query.prdType === '04') {
// data.loadNumber = model.loadNum;
// }
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('map/setRunPlanStatus', true);

View File

@ -1,28 +1,27 @@
<template>
<div>
<div class="schema" :style="{top: offset+'px'}">
<!-- (isScript&&!isScriptCommand) || -->
<el-select v-if="isDesignPlatform" v-model="swch" size="small" :placeholder="$t('display.schema.selectProduct')" @change="switchMode">
<el-option v-for="item in swchList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<!-- showSelectStation&&((!isScriptCommand&&swch=='01')||(isScriptCommand && isLocalStation)) -->
<el-select v-if="showSelectStation && isLocalStation && !isScript" v-model="showStationContent" style="width: 100px;" size="small" @change="switchStationModeInfo">
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
<el-button-group>
<el-button v-if="isDemon && isDesignPlatform && !dataError" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<!-- 加载剧本 -->
<el-button v-if="isDemon && !isDesignPlatform && !isScheduling && !dataError" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<!-- 运行图加载 -->
<el-button v-if="notScript && runing && !dataError" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="!runing && notScript && !dataError" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="mode==OperateMode.FAULT && !dataError" size="small" type="danger" @click="setFault">自动故障设置</el-button>
</el-button-group>
<el-radio-group v-if="!isScheduling && !dataError" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">故障模式</el-radio-button>
</el-radio-group>
<template v-if="!dataError">
<el-button-group>
<el-button v-if="isDemon && isDesignPlatform" size="small" :disabled="viewDisabled" type="success" @click="viewScriptRoles">{{ $t('display.schema.selectRoles') }}</el-button>
<!-- 加载剧本 -->
<el-button v-if="isDemon && !isDesignPlatform && !isScheduling" size="small" :disabled="viewDisabled" type="success" @click="viewRunQuest">{{ $t('display.schema.loadScript') }}</el-button>
<!-- 运行图加载 -->
<el-button v-if="notScript && runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('display.schema.previewRunDiagram') }}</el-button>
<el-button v-if="notScript && !runing" size="small" type="warning" @click="loadRunPlan">{{ $t('display.schema.loadRunDiagram') }}</el-button>
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">自动故障设置</el-button>
</el-button-group>
<el-radio-group v-if="!isScheduling" v-model="mode" size="small" @change="changeOperateMode(mode)">
<el-radio-button class="mode" :label="OperateMode.NORMAL">{{ $t('display.schema.normalOperation') }}</el-radio-button>
<el-radio-button class="mode" :label="OperateMode.FAULT">故障模式</el-radio-button>
</el-radio-group>
</template>
</div>
<fault-choose v-if="isDemon || isScript" ref="faultChoose" :group="group" :offset="offset" />
<run-plan-Load ref="runPlanLoad" :group="group" />
@ -36,9 +35,7 @@ import RunPlanLoad from './demon/runPlanLoad';
import RunPlanView from './demon/runPlanView';
import FaultChoose from './demon/faultChoose';
import AddQuest from './demon/addQuest';
import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan';
import { getByGroupStationList } from '@/api/jmap/map';
import {loadDraftScript, loadDraftScriptNew} from '@/api/designPlatform';
import { getEveryDayRunPlanNew, loadScriptNew } from '@/api/simulation';
@ -99,9 +96,6 @@ export default {
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
group() {
return this.$route.query.group;
},
@ -134,9 +128,8 @@ export default {
},
'$store.state.training.switchcount': async function () {
if (this.group) {
const started = this.$store.state.training.started;
if (started) {
await this.loadRunData(this.$route.query);
if (this.$store.state.training.started) {
await this.loadRunData();
}
}
},
@ -154,17 +147,17 @@ export default {
}
},
async mounted() {
await this.loadRunData(this.$route.query);
await this.loadRunData();
},
methods: {
loadRunData(opt) {
loadRunData() {
this.$store.dispatch('runPlan/clear').then(() => {
if (opt && opt.mapId) {
if (this.group) {
this.viewDisabled = true;
getByGroupStationList(this.$route.query.group).then(response => {
// getStationList(opt.mapId).then(response => {
//
getByGroupStationList(this.group).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
getEveryDayRunPlanNew(this.group).then(resp => {
getEveryDayRunPlanNew(this.group).then(resp => { // 仿
this.$store.dispatch('runPlan/setPlanData', resp.data);
this.$store.dispatch('runPlan/setInitialPlanData', resp.data);
this.viewDisabled = false;

View File

@ -46,7 +46,6 @@ export default {
return {
isDisable: false,
isScriptCommand:false
// isSaveStage: true,
};
},
computed: {
@ -91,14 +90,7 @@ export default {
this.isDisable = true;
const data = {
time: model.initTime
// loadNumber:this.trainList.length
};
// const data = {
// time: model.initTime
// };
// if (this.$route.query.prdType === '04') {
// data.loadNumber = model.loadNum;
// }
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('map/setRunPlanStatus', true);

View File

@ -270,7 +270,6 @@ export default {
resetSize() {
this.$nextTick(() => {
this.$jlmap && this.$jlmap.resize({ width: this.width, height: this.height });
// this.$store.dispatch('training/updateOffsetStationCode', { offsetStationCode: this.offsetStationCode });
setTimeout(() => {
this.$store.dispatch('config/resetCanvasOffset');
this.$store.dispatch('training/emitTipFresh');

View File

@ -30,9 +30,7 @@ export default {
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
this.$nextTick(() => {
this.setPosition();
});
this.setPosition();
},
'$route' () {
this.setOffsetX();

View File

@ -28,9 +28,7 @@ export default {
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
this.$nextTick(() => {
this.setPosition();
});
this.setPosition();
},
'$route' () {
this.setOffsetX();

View File

@ -38,26 +38,22 @@ export default {
methods: {
setPosition() {
this.$nextTick(() => {
let offset = (this.$route.path.includes('displayNew') || this.$route.path.includes('scriptDisplayNew')) && (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) ? 73 : 15;
const offset = (this.$route.path.includes('displayNew') || this.$route.path.includes('scriptDisplayNew')) && (this.$route.query.lineCode == 10 || this.$route.query.lineCode == 11) ? 73 : 15;
const menuBar = document.getElementById('menuBar');
const menuTool = document.getElementById('menuTool');
if (menuBar) {
offset += (menuBar.offsetHeight || 0);
this.offset = (menuBar.offsetHeight || 0) + offset;
}
if (menuTool) {
offset += (menuTool.offsetHeight || 0);
}
if (this.offset != offset) {
this.offset = offset;
this.offset = (menuTool.offsetHeight || 0) + offset;
}
});
},
setShrinkCanvas() {
setShrinkCanvas() { //
this.$emit('setShrink');
},
setMagnifyCanvas() {
setMagnifyCanvas() { //
this.$emit('setMagnify');
}
}

View File

@ -167,7 +167,7 @@ export default {
}
},
watch: {
'$store.state.config.menuBarLoadedCount': function (val) {
'$store.state.config.menuBarLoadedCount': function (val) { // menuBar
this.setPosition();
},
'$store.state.training.prdType': function (prdType) {

View File

@ -47,7 +47,6 @@ import { getSimulationQrcode } from '@/api/jointSimulation';
import { getSessionStorage } from '@/utils/auth';
import { refereeExitSimulation, quitCurrentRace, startPracticalCompetition, submitPracticalCompetition } from '@/api/competition';
import { NoQrcodeList } from '@/scripts/ProjectConfig';
// import { prefixIntrger } from '@/utils/date';
import localStore from 'storejs';
export default {
@ -140,10 +139,16 @@ export default {
});
}
},
'$store.state.socket.simulationStart': async function (val) {
// '$store.state.socket.simulationStart': async function (val) {
// if (val) {
// // this.$store.dispatch('training/setInitTime', +new Date(val));
// // this.$store.dispatch('training/simulationStart');
// }
// },
'$store.state.training.started': function (val) {
this.isDisable = false;
if (val) {
this.$store.dispatch('training/setInitTime', +new Date(val));
this.$store.dispatch('training/simulationStart');
this.isDisable = true;
}
},
'$store.state.socket.simulationOver':function(val) {
@ -227,7 +232,6 @@ export default {
},
// 仿
start(model) {
this.isDisable = true;
const data = {
time: model.initTime
};

View File

@ -261,8 +261,8 @@ export default {
this.$messageBox(`${this.$t('approval.revokeScriptFailed')}: ${error.message}`);
});
}).catch(() => { });
},
//
},
//
previewScript(index, row) {
const drawWay = this.$route.query.drawWay;
if (drawWay && JSON.parse(drawWay)) {

View File

@ -56,14 +56,8 @@ export default {
getScriptMemberDataNew(group).then(response=>{
const lastData = JSON.stringify(response.data);
this.allRoleData = this.coverData(lastData, ConstConfig.ConstSelect.roleTypeNew);
// lastData = lastData.replace(new RegExp('id', 'g'), 'key');
// lastData = JSON.parse(lastData);
// this.allRoleData = lastData;
getScriptPlayMemberNew(group).then(response=>{
const last = response.data;
// let userdata=JSON.stringify(response.data)
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let datalist=userdata.match(reg);
const data = [];
last.forEach(function(element) { data.push(element.id); });
this.selectRoleData = data;
@ -76,9 +70,6 @@ export default {
this.allRoleData = this.coverData(lastData, ConstConfig.ConstSelect.roleType);
getScriptPlayMember(group).then(response=>{
const last = response.data;
// let userdata=JSON.stringify(response.data)
// let reg=new RegExp('\"id\":\"(.*?)\\\"','g');
// let datalist=userdata.match(reg);
const data = [];
last.forEach(function(element) { data.push(element.id); });
this.selectRoleData = data;