运行图 测试代码调整

This commit is contained in:
joylink_cuiweidong 2020-11-13 14:14:18 +08:00
parent 720c527683
commit 0e7f27c1db
8 changed files with 221 additions and 114 deletions

View File

@ -91,6 +91,7 @@ const DesignPlatform = () => import('@/views/designPlatform/index');
const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew');
const BigScreen = () => import('@/views/designPlatform/bigScreen');
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
const TestRunplan = () => import('@/views/designPlatform/testRunplan');
const Package = () => import('@/views/package/index');
@ -207,12 +208,12 @@ export const constantRoutes = [
path: '/design/jlmap3d/assetmanager',
component: Jlmap3dAssetManager,
hidden: true
},
{
path: '/data2json',
component: () => import('@/views/planMonitor/data2json/page.vue'),
hidden: true
},
},
{
path: '/data2json',
component: () => import('@/views/planMonitor/data2json/page.vue'),
hidden: true
},
{ // 线信息
path: '/AUSline',
component: PlanMonitorEditAUSLine,
@ -391,6 +392,12 @@ export const publicAsyncRoute = [
path: '/planSchedule/window',
component: PlanScheduleWicket,
hidden: true
},
{
// 运行图测试(仿真,仅有按计划行车和初始化操作)
path: '/design/runPlan/testRunplan',
component: TestRunplan,
hidden: true
}
];
// 城市轨道项目

View File

@ -46,6 +46,7 @@ const LessonHome = () => import('@/views/lesson/home');
const LessonDetail = () => import('@/views/lesson/details');
const BigScreen = () => import('@/views/designPlatform/bigScreen');
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
const TestRunplan = () => import('@/views/designPlatform/testRunplan');
const ScriptmanageHome = () => import('@/views/scriptManage/home');
@ -273,6 +274,12 @@ export const publicAsyncRoute = [
path: '/device/result/:userExamId',
component: ExamResult,
hidden: true
},
{
// 运行图测试(仿真,仅有按计划行车和初始化操作)
path: '/design/runPlan/testRunplan',
component: TestRunplan,
hidden: true
}
];
export const asyncRouter = [

View File

@ -2277,6 +2277,7 @@ export const UrlConfig = {
lessonTraining: '/design/lesson/training',
trainingRecord: '/design/lesson/training',
runPlan: '/design/runPlan/detail',
testRunPlan: '/design/runPlan/testRunplan',
scriptHome: '/design/script/home',
display: '/design/display',
displayNew: '/design/displayNew',

View File

@ -0,0 +1,197 @@
<template>
<div class="map-view" :style="{width: canvasWidth+'px',height:'100%',position:'absolute',overflow:'hidden'}">
<div v-show="maskOpen" class="mask" :style="{'width': maskWidth}" />
<jlmap-visual ref="jlmapVisual" />
<div class="display-draft">
<el-button-group>
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
<el-button type="small" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
</el-button-group>
</div>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
<menu-system-time ref="menuSystemTime" :offset="15" :group="group" />
</div>
</template>
<script>
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import JlmapVisual from '@/views/newMap/jlmapNew/index';
import { Notification } from 'element-ui';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { getToken } from '@/utils/auth';
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
export default {
name:'TestRunplan',
components: {
SetTime,
JlmapVisual,
MenuSystemTime
},
data() {
return {
maskOpen: false,
maskWidth: '100%'
};
},
computed:{
...mapGetters([
'canvasWidth'
]),
group() {
return this.$route.query.group;
},
isDisable() {
return this.$store.state.training.started;
},
width() {
return this.$store.state.app.width;
},
height() {
return this.$store.state.app.height;
}
},
watch:{
'$store.state.map.mapViewLoadedCount':function() {
this.$store.dispatch('map/setTrainWindowShow', false);
this.$jlmap.off('zoom');
if (this.group) {
this.subscribe();
}
},
'$store.state.app.windowSizeCount': function() { //
this.setWindowSize();
},
'$store.state.socket.equipmentStatus': function (val) {
if (val.length && this.$route.query.group) {
this.statusMessage(val);
}
},
'$store.state.socket.simulationStart': function(val) {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('map/setShowCentralizedStationNum');
});
}
},
async beforeDestroy() {
await this.$store.dispatch('map/mapClear');
},
async mounted() {
this.setWindowSize();
await this.initLoadData();
},
methods:{
async initLoadData() { //
if (this.group) {
this.loadSimulationInfo();
await loadNewMapDataByGroup(this.group);
}
},
//
setWindowSize() {
const width = this.width;
const height = this.height;
this.$store.dispatch('config/resize', { width, height });
},
async back() {
if (this.group) {
await clearSimulation(this.group);
this.clearSubscribe();
}
this.$store.dispatch('map/setShowCentralizedStationCode', '');
history.go(-1);
Notification.closeAll();
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
async statusMessage(list) {
await this.$store.dispatch('training/updateMapState', list);
await this.$store.dispatch('socket/setEquipmentStatus');
},
end() {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
},
async subscribe() {
this.clearSubscribe();
const header = { group: this.group || '', 'X-Token': getToken() };
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
await this.$store.dispatch('training/setHasSubscribed');
},
clearSubscribe() {
clearSubscribe(`${displayTopic}\/${this.group}`);
},
async loadSimulationInfo() {
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200 && resp.data) {
if (!resp.data.dataError) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); //
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
this.$store.dispatch('training/countTime');
this.planRunning = resp.data.planRunning;
if (resp.data.planRunning) {
this.$store.commit('training/start');
}
} else {
this.$messageBox('此地图数据正在维护中,无法运行!');
}
this.dataError = resp.data.dataError;
}
},
start(model) { // 仿
const data = {
time: model.initTime
};
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
} else {
this.$messageBox('按计划行车异常,请退出重试!');
}
});
}
}
};
</script>
<style lang="scss" scoped>
.display-draft {
position: absolute;
float: right;
right: 15px;
bottom: 15px;
}
</style>

View File

@ -9,7 +9,6 @@
<menu-exam v-if="isExam" ref="menuExam" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" />
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :offset="offset" :text-status-height="textStatusHeight" :data-error="dataError" />
<menu-dispather-contest v-if="isContest" ref="menuDispatherContest" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" />
<menu-runplan v-if="isPlan" ref="menuPlan" />
</template>
<menu-train-list v-if="isDemon||isContest||isScript" @setCenter="setCenter" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
@ -27,7 +26,6 @@ import MenuDemon from './menuDemon';
import MenuExam from './exam/index';
import MenuScript from './scriptDisplay/scriptRecord/index';
import MenuDispatherContest from './dispatherContest/index';
import MenuRunplan from './menuRunplan';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
@ -46,8 +44,7 @@ export default {
MenuSystemTime,
MenuTrainList,
MenuDispatherContest,
MenuScript,
MenuRunplan
MenuScript
},
data() {
return {

View File

@ -1,102 +0,0 @@
<template>
<div>
<div class="display-draft">
<el-button-group>
<el-button type="primary" size="small" @click="back">返回</el-button>
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
</el-button-group>
</div>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
</div>
</template>
<script>
import SetTime from './demon/setTime';
import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
export default {
name:'MenuPlan',
components: {
SetTime
},
data() {
return {
};
},
computed:{
group() {
return this.$route.query.group;
},
isDisable() {
return this.$store.state.training.started;
}
},
methods:{
back() {
this.$store.dispatch('map/setShowCentralizedStationCode', '');
history.go(-1);
Notification.closeAll();
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
end() {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
},
start(model) { // 仿
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/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
} else {
this.$messageBox('按计划行车异常,请退出重试!');
}
});
}
}
};
</script>
<style lang="scss" scoped>
.display-draft {
position: absolute;
float: right;
right: 15px;
bottom: 15px;
}
</style>

View File

@ -463,7 +463,7 @@ export default {
prdType: '01', group: resp.data, mapId: this.$route.query.mapId, planId: this.$route.query.planId
};
// this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
this.$router.push({ path: `${UrlConfig.displayNew}/plan`, query: query });
this.$router.push({ path: UrlConfig.design.testRunPlan, query: query });
launchFullscreen();
}).catch(error => {
this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);

View File

@ -152,7 +152,7 @@ export default {
prdType: '01', group: resp.data, mapId: this.$route.query.mapId, planId: this.$route.query.planId
};
// this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
this.$router.push({ path: `${UrlConfig.displayNew}/plan`, query: query });
this.$router.push({ path: UrlConfig.design.testRunPlan, query: query });
launchFullscreen();
} else {
this.$messageBox(this.$t('error.checkTheValidityFirst'));