综合演练调整

This commit is contained in:
fan 2020-03-17 14:54:03 +08:00
parent 022cf8c6ac
commit b94c2b47de
12 changed files with 434 additions and 410 deletions

View File

@ -25,7 +25,6 @@
<script>
import { mapGetters } from 'vuex';
import { timeFormat } from '@/utils/date';
import { runDiagramGetTime } from '@/api/simulation';
import DataTable from '../menusPlan/components/dataTable';
import echarts from 'echarts';

View File

@ -19,6 +19,7 @@ const DesignDisplay = () => import('@/views/display/designIndex');
const TrainRoom = () => import('@/views/trainRoom/index');
const JointTraining = () => import('@/views/jointTraining/index');
const JointTrainingNew = () => import('@/views/newMap/jointTrainingNew/index');
const Error401 = () => import('@/views/error-page/401');
const Errpr404 = () => import('@/views/error-page/404');
@ -544,7 +545,7 @@ export const asyncRouter = [
},
{
path: '/jointTrainingNew',
component: JointTraining,
component: JointTrainingNew,
hidden: true
},
{

View File

@ -13,7 +13,7 @@ const runPlan = {
width: 800, // 运行图canvas 容器 宽度
height: 600, // 运行图canvas 容器 高度
refreshCount: 0, // 刷新页面重新加载
setInitialPlanData: {} // 运行图原始数据
initialPlanData: {} // 运行图原始数据
},
getters: {
stations: (state) => {

View File

@ -1,110 +1,79 @@
<template>
<el-dialog
v-dialogDrag
v-dialogLoading="dialogLoading"
:title="title"
:visible.sync="dialogShow"
width="100%"
:before-close="doClose"
:close-on-click-modal="false"
:modal="false"
fullscreen
>
<div :id="runPlanId" v-loading="loading" />
</el-dialog>
<el-dialog
v-dialogDrag
v-dialogLoading="dialogLoading"
:title="title"
:visible.sync="dialogShow"
width="100%"
:before-close="doClose"
:close-on-click-modal="false"
:modal="false"
fullscreen
>
<div :id="runPlanId" v-loading="loading" />
</el-dialog>
</template>
<script>
import { mapGetters } from 'vuex';
import { getPublishMapInfo } from '@/api/jmap/map';
import { timeFormat } from '@/utils/date';
import echarts from 'echarts';
import {toTimeStamp, formatDuring} from '@/utils/date';
import { mapGetters } from 'vuex';
import { getPublishMapInfo } from '@/api/jmap/map';
import { timeFormat } from '@/utils/date';
import echarts from 'echarts';
import {toTimeStamp, formatDuring} from '@/utils/date';
//
export default {
name: 'RunPlanView',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: true,
runPlanId: 'run-plan-view',
myChart: null,
PlanConvert: {},
series: [],
option: {
title: {
text: '',
left: 'center'
//
export default {
name: 'RunPlanView',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: true,
runPlanId: 'run-plan-view',
myChart: null,
PlanConvert: {},
series: [],
option: {
title: {
text: '',
left: 'center'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '80px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
// right: '20px',
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// restore: {},
// saveAsImage: {}
// }
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
grid: {
top: '30px',
left: '120px',
right: '40px',
bottom: '80px',
containLabel: true,
backgroundColor: 'floralwhite'
},
toolbox: {
// right: '20px',
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// restore: {},
// saveAsImage: {}
// }
},
tooltip: {
axisPointer: {
trigger: 'item',
type: 'cross'
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
}
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
formatter: this.axisTooltip,
borderWidth: 1
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: [],
axisLine: {
onZero: false,
lineStyle: {
@ -113,255 +82,286 @@
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
formatter: this.xAxisLableFormat,
textStyle: {
color: '#333'
}
},
min: 0,
max: 0
},
// graphic: {
// type: 'line',
// progressive: true
// },
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '25px'
axisPointer: {
snap: true,
label: {
formatter: this.xAxisPointFormat,
backgroundColor: 'rgb(255,0,0,0.5)',
color: 'white'
}
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
runPlanData: {},
dialogLoading: false,
initialPlanData: []
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': async function () {
try {
await this.loadChartPage();
if (this.dialogShow) {
await this.loadInitData(this.series);
}
} catch (e) {
console.error(e);
} finally {
this.loading = false;
],
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
onZero: false,
lineStyle: {
width: 2,
color: '#d14a61'
}
},
axisLabel: {
interval: 'auto',
formatter: this.yAxisLableFormat
},
axisPointer: {
xAxisIndex: 'all',
label: {
formatter: this.yAxisPointFormat,
backgroundColor: 'rgb(0,100,0,0.5)',
color: 'white'
}
},
min: 0,
max: 0
},
// graphic: {
// type: 'line',
// progressive: true
// },
series: [],
dataZoom: [
{
type: 'inside'
},
{
fiterMode: 'filter',
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '80%',
handleStyle: {
color: '#fff',
shadowBlur: 3,
shadowColor: 'rgba(0, 0, 0, 0.6)',
shadowOffsetX: 2,
shadowOffsetY: 2
},
bottom: '25px'
}
]
},
absoluteTime: 2 * 3600,
indexKmRangeMap: {},
runPlanData: {},
dialogLoading: false,
initialPlanData: []
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': async function () {
try {
await this.loadChartPage();
if (this.dialogShow) {
await this.loadInitData(this.series);
}
},
'$store.state.runPlan.planUpdateCount': function () {
this.updateRunPlanData(this.$store.state.runPlan.updateData);
},
'$store.state.app.windowSizeCount': function() {
this.reSize({ width: this.$store.state.app.width, height: this.$store.state.app.height - 55 });
} catch (e) {
console.error(e);
} finally {
this.loading = false;
}
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.initialPlanData = this.$store.state.runPlan.planData;
this.loadChartPage();
'$store.state.runPlan.planUpdateCount': function () {
this.updateRunPlanData(this.$store.state.runPlan.updateData);
},
'$store.state.app.windowSizeCount': function() {
this.reSize({ width: this.$store.state.app.width, height: this.$store.state.app.height - 55 });
}
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.initialPlanData = this.$store.state.runPlan.planData;
this.loadChartPage();
});
},
beforeDestroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
methods: {
async doShow() {
try {
this.dialogLoading = true;
this.dialogShow = true;
this.loadInitData(this.series);
} catch (e) {
console.error(e);
} finally {
this.dialogLoading = false;
}
},
async doClose() {
this.dialogShow = false;
},
async loadChartPage() {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.series = [];
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.pushModels(this.series, [this.PlanConvert.initializeYaxis(stations)]);
this.pushModels(this.series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 1, color: '#000' }));
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: document.documentElement.clientWidth - 10, height: document.documentElement.clientHeight - 55 });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);
}
});
},
beforeDestroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
methods: {
async doShow() {
try {
this.dialogLoading = true;
this.dialogShow = true;
this.loadInitData(this.series);
} catch (e) {
console.error(e);
} finally {
this.dialogLoading = false;
}
},
async doClose() {
this.dialogShow = false;
},
async loadChartPage() {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
this.series = [];
this.kmRangeCoordMap = this.PlanConvert.convertStationsToMap(stations);
this.pushModels(this.series, [this.PlanConvert.initializeYaxis(stations)]);
this.pushModels(this.series, this.PlanConvert.convertDataToModels(planData, stations, this.kmRangeCoordMap, { width: 1, color: '#000' }));
},
async loadInitData(series) {
this.myChart && this.myChart.showLoading();
await this.xAxisInit();
await this.yAxisInit();
await this.loadInitChart(series);
this.myChart && this.myChart.hideLoading();
},
loadInitChart(series) {
return new Promise((resolve, reject) => {
try {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.clear();
}
let startValue = 3600 + this.PlanConvert.TranslationTime;
const offsetTime = 3600;
const initTime = toTimeStamp(formatDuring(this.$store.state.training.initTime));
startValue = initTime - this.PlanConvert.TranslationTime;
this.option.dataZoom[0].startValue = this.option.dataZoom[1].startValue = startValue - offsetTime;
this.option.dataZoom[0].endValue = this.option.dataZoom[1].endValue = startValue + offsetTime;
this.option.series = series;
this.myChart = echarts.init(document.getElementById(this.runPlanId));
if (this.myChart) {
this.myChart.setOption(this.option);
this.reSize({ width: document.documentElement.clientWidth -10, height: document.documentElement.clientHeight - 55 });
this.myChart.on('click', this.mouseClick);
}
resolve(true);
} catch (error) {
reject(error);
updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
if (data[0] && initialPlanData[data[0].serviceNumber]) {
Object.keys(initialPlanData[data[0].serviceNumber].trainMap).forEach(item => {
if (initialPlanData[data[0].serviceNumber].trainMap[item + ''].tripNumber == data[0].tripNumber) {
data[0].directionCode = initialPlanData[data[0].serviceNumber].trainMap[item + ''].directionCode;
}
});
},
updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
const initialPlanData = this.$store.state.runPlan.initialPlanData;
if (data[0] && initialPlanData[data[0].serviceNumber]) {
Object.keys(initialPlanData[data[0].serviceNumber].trainMap).forEach(item => {
if (initialPlanData[data[0].serviceNumber].trainMap[item+''].tripNumber == data[0].tripNumber) {
data[0].directionCode = initialPlanData[data[0].serviceNumber].trainMap[item + ''].directionCode;
}
});
}
if (data[0]) {
data[0].secondTime = data[0].second;
}
this.series = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,
planData, this.series, { color: '#FF00DE', width: 0.5 }
);
this.myChart && this.myChart.setOption({ series: this.series });
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
}
return series;
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
this.option.xAxis[0].data = list;
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style="margin: 3px 0">`,
`${this.$t('display.runPlan.stationName')}: ${station.name}<br>`,
`${this.$t('display.runPlan.stationMark')}: ${station.kmRange} km <br>`,
`${this.$t('display.runPlan.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
settingExac(data) {
this.absoluteTime = Math.abs(parseInt(data.endValue) - parseInt(data.startValue)) / 1000;
this.myChart && this.myChart.setOption({
xAxis: this.option.xAxis,
yAxis: this.option.yAxis
}
if (data[0]) {
data[0].secondTime = data[0].second;
}
this.series = this.PlanConvert.updateDataToModels(data, stations, this.kmRangeCoordMap,
planData, this.series, { color: '#FF00DE', width: 0.5 }
);
this.myChart && this.myChart.setOption({ series: this.series });
},
pushModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
if (elem) {
series.push(elem);
}
});
}
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(data.startValue / 1000),
endValue: parseInt(data.endValue / 1000)
return series;
},
popModels(series, models) {
if (models && models.length) {
models.forEach(elem => {
const index = series.indexOf(elem);
if (index >= 0) {
series.split(index, 1);
}
});
},
run(start) {
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(start - this.absoluteTime / 2),
endValue: parseInt(start + this.absoluteTime / 2)
});
this.loadInitData(this.series);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({ width: opt.width, height: opt.height, silent: false });
}
}
return series;
},
xAxisPointFormat(params) {
return timeFormat(params.value);
},
yAxisPointFormat(params) {
return this.PlanConvert.computedFormatYAxis(this.stations, params);
},
xAxisLableFormat(value, index) {
if (value % 60 === 0) {
return timeFormat(value);
}
},
yAxisLableFormat(value, index) {
return '';
},
xAxisInit() {
const list = [];
for (var time = this.PlanConvert.TranslationTime; time < 3600 * 24 + this.PlanConvert.TranslationTime; time++) {
list.push(time);
}
this.option.xAxis[0].data = list;
},
yAxisInit() {
if (Object.keys(this.PlanConvert).length) {
this.option.yAxis.min = this.PlanConvert.computedYaxisMinValue(this.stations);
this.option.yAxis.max = this.PlanConvert.computedYaxisMaxValue(this.stations);
}
},
axisTooltip(param) {
const station = this.stations[Math.floor((param.data[1] - this.PlanConvert.EdgeHeight) / this.PlanConvert.CoordMultiple)] || { name: '', kmRange: '' };
return [
`Point Data <hr size=1 style="margin: 3px 0">`,
`${this.$t('display.runPlan.stationName')}: ${station.name}<br>`,
`${this.$t('display.runPlan.stationMark')}: ${station.kmRange} km <br>`,
`${this.$t('display.runPlan.arrivalTime')}: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join('');
},
settingExac(data) {
this.absoluteTime = Math.abs(parseInt(data.endValue) - parseInt(data.startValue)) / 1000;
this.myChart && this.myChart.setOption({
xAxis: this.option.xAxis,
yAxis: this.option.yAxis
});
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(data.startValue / 1000),
endValue: parseInt(data.endValue / 1000)
});
},
run(start) {
this.myChart && this.myChart.dispatchAction({
type: 'dataZoom',
dataZoomIndex: [0, 1],
startValue: parseInt(start - this.absoluteTime / 2),
endValue: parseInt(start + this.absoluteTime / 2)
});
this.loadInitData(this.series);
},
reSize(opt) {
if (this.myChart) {
this.myChart.resize({ width: opt.width, height: opt.height, silent: false });
}
}
};
}
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">
/deep/ {

View File

@ -20,7 +20,7 @@
<script>
import SetTime from './demon/setTime';
import { Notification } from 'element-ui';
import { ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation';
import { ranAsPlan, runDiagramOver } from '@/api/simulation';
// import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus';
@ -152,10 +152,7 @@ export default {
});
},
async loadSystemTime() {
// const rest = await runDiagramGetTime(this.group);
// if (rest && rest.code == 200) {
// this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(rest.data)}`));
// }
}
}
};

View File

@ -26,23 +26,24 @@
</template>
<script>
import MapSystemDraft from '@/views/mapsystem/index';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuDemonJoint from './menuDemon';
import MenuDemonSchema from './menuSchema';
import JoinFaultChoose from '@/views/display/demon/faultChoose';
import JoinRunPlanLoad from '@/views/display/demon/runPlanLoad';
import JoinRunPlanView from '@/views/display/demon/runPlanView';
import menuSystemTime from '@/views/display/menuSystemTime';
import JoinFaultChoose from '@/views/newMap/displayNew/demon/faultChoose';
import JoinRunPlanLoad from '@/views/newMap/displayNew/demon/runPlanLoad';
import JoinRunPlanView from '@/views/newMap/displayNew/demon/runPlanView';
import menuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import IbpPlate from '@/views/ibp/ibpsystem/index';
import { mapGetters } from 'vuex';
import { OperateMode, TrainingMode } from '@/scripts/ConstDic';
import { checkLoginLine } from '@/api/login';
import { loadMapDataById } from '@/utils/loaddata';
import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { getUserRolesNew, deljointTrainRoomNew} from '@/api/jointTraining';
import { runDiagramOver, getSimulationInfo } from '@/api/simulation';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation';
import Jl3dDrive from '@/views/jlmap3d/drive/jl3ddrive';
import { EventBus } from '@/scripts/event-bus';
import ibpData from '@/ibp/constant/ibpData';
import { timeFormat } from '@/utils/date';
import { Message } from 'element-ui';
export default {
@ -122,7 +123,7 @@ export default {
showClose: false,
callback: async (action) => {
await this.$store.dispatch('training/over');
await runDiagramOver(this.group);
await clearSimulation(this.group);
await deljointTrainRoomNew(this.group);
this.$router.go(-1);
}
@ -276,10 +277,21 @@ export default {
}
},
async loadSimulationInfo() {
const resp = await getSimulationInfo(this.group);
const resp = await getSimulationInfoNew(this.group);
if (resp && resp.code == 200) {
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause);
this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${timeFormat(resp.data.systemTime)}`));
if (resp.data.planRunning) {
this.$store.dispatch('training/simulationStart');
} 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);
}
}
},
async getUserRole() {
@ -307,15 +319,15 @@ export default {
// Admin Instructor Dispatcher Attendant Audience Driver Repair IBP:IBP
this.userRole = resp.data.userRole;
switch (this.userRole) {
case 'Admin': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Admin'); this.hideIbp(); break;
case 'Instructor': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor'); this.hideIbp(); break;
case 'Dispatcher': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher'); this.hideIbp(); break;
case 'Attendant': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant'); this.hideIbp(); break;
case 'Audience': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience'); this.hideIbp(); break;
case 'Driver': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver'); this.hideIbp(); break;
case 'Repair': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair'); this.hideIbp(); break;
case 'ADMIN': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'ADMIN'); this.hideIbp(); break;
case 'INSTRUCTOR': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR'); this.hideIbp(); break;
case 'DISPATCHER': this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER'); this.hideIbp(); break;
case 'STATION_SUPERVISOR': this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR'); this.hideIbp(); break;
case 'AUDIENCE': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE'); this.hideIbp(); break;
case 'DRIVER': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER'); this.hideIbp(); break;
case 'REPAIR': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'REPAIR'); this.hideIbp(); break;
case 'IBP': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP'); this.showIbp(resp.data.deviceCode); break;
case 'BigScreen': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen'); this.hideIbp(); break;
case 'BIGSCREEN': this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN'); this.hideIbp(); break;
}
}
await this.getTrainDetail();
@ -325,7 +337,7 @@ export default {
},
async getTrainDetail() {
try {
await loadMapDataById(this.mapId);
await loadNewMapDataByGroup(this.group);
await this.$store.dispatch('training/setMapDefaultState');
} catch (error) {
this.$messageBox(this.$t('error.getMapDataFailed'));

View File

@ -8,7 +8,7 @@
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('joinTraining.drivingByPlan') }}</el-button>
<el-button type="danger" :disabled="!isDisable" @click="end">{{ $t('joinTraining.exitPlan') }}</el-button>
</template>
<el-button v-if="!isBigScreen" type="primary" @click="back">{{ $t('global.back') }}</el-button>
<el-button type="primary" @click="back">{{ $t('global.back') }}</el-button>
</el-button-group>
</div>
<qr-code ref="qrCode" />
@ -19,11 +19,10 @@
<script>
import QrCode from '@/components/QrCode';
import SetTime from '@/views/display/demon/setTime';
import { runDiagramIsStart, ranAsPlan, runDiagramOver, runDiagramGetTime } from '@/api/simulation';
import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { ranAsPlan, clearSimulation } from '@/api/simulation';
import { exitFullscreen } from '@/utils/screen';
import { putJointTrainingSimulationUserNew} from '@/api/jointTraining';
import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus';
import { getSessionStorage } from '@/utils/auth';
import RealDevice from './menuDraft/realDevice';
@ -78,16 +77,13 @@ export default {
return this.$route.query.lineCode;
},
isSpeaking() {
return this.userRole != 'Driver' && this.userRole != '';
return this.userRole != 'DRIVER' && this.userRole != '';
},
isDriver() {
return this.userRole == 'Driver';
return this.userRole == 'DRIVER';
},
isAdmin() {
return this.userRole == 'Admin';
},
isBigScreen() {
return this.userRole == 'BigScreen';
return this.userRole == 'ADMIN';
},
isProject() {
return getSessionStorage('project').endsWith('gzb');
@ -227,40 +223,40 @@ export default {
list.forEach(item => {
if (this.userId == item.id) {
switch (item.userRole) {
case 'Instructor':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Instructor');
case 'INSTRUCTOR':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'INSTRUCTOR');
this.$emit('getUserRole');
break;
case 'Dispatcher':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'Dispatcher');
case 'DISPATCHER':
this.$store.dispatch('training/setPrdType', '02'); this.$store.dispatch('training/setRoles', 'DISPATCHER');
this.$emit('getUserRole');
break;
case 'Attendant':
case 'STATION_SUPERVISOR':
if (!item['deviceCode']) {
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Attendant');
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
break;
}
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'Attendant');
this.$store.dispatch('training/setPrdType', '01'); this.$store.dispatch('training/setRoles', 'STATION_SUPERVISOR');
this.$emit('getUserRole');
break;
case 'Driver':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Driver');
case 'DRIVER':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'DRIVER');
this.$emit('getUserRole');
break;
case 'Repair':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Repair');
case 'REPAIR':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'REPAIR');
this.$emit('getUserRole');
break;
case 'IBP':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'IBP');
this.$emit('getUserRole');
break;
case 'BigScreen':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BigScreen');
case 'BIGSCREEN':
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'BIGSCREEN');
this.$emit('getUserRole');
break;
default:
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'Audience');
this.$store.dispatch('training/setPrdType', ''); this.$store.dispatch('training/setRoles', 'AUDIENCE');
this.$emit('getUserRole');
break;
}
@ -275,14 +271,16 @@ export default {
this.$refs.chat.getChathistory();
}
},
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
start(model) {
this.isDisable = true;
const data = {
time: model.initTime,
loadNumber:this.trainList.length
time: model.initTime
};
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
@ -316,7 +314,7 @@ export default {
end() {
this.isDisable = false;
EventBus.$emit('trainView');
runDiagramOver(this.group).catch(() => {
clearSimulation(this.group).catch(() => {
this.$store.dispatch('training/over').then(() => {
this.isDisable = true;
this.$messageBox(this.$t('error.endSimulationFailed'));
@ -326,7 +324,7 @@ export default {
back() {
this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUserNew(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group } });
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.lineCode, group: this.group, drawWay: true } });
exitFullscreen();
});
});

View File

@ -8,7 +8,7 @@
<script>
import PopMenu from '@/components/PopMenu';
import ChooseRole from './chooseRole';
import { putUserRolesNew} from "@/api/jointTraining";
import { putUserRolesNew} from '@/api/jointTraining';
import { DeviceMenu } from '@/scripts/ConstDic';
export default {
@ -105,7 +105,7 @@ export default {
const params = [{
id: obj.id,
nickName: obj.name,
userRole: 'Driver',
userRole: 'DRIVER',
stationCode: '',
trainCode: this.selected._code
}];
@ -119,7 +119,7 @@ export default {
const params = [{
id: data.id,
nickName: data.name,
userRole: 'Driver',
userRole: 'DRIVER',
stationCode: '',
trainCode: ''
}];

View File

@ -1,7 +1,7 @@
<template>
<div class="schema" :style="{top: offset+'px'}">
<el-select
v-if="userRole == 'Instructor' || userRole == 'Admin'"
v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'"
v-model="swch"
size="small"
:placeholder="this.$t('rules.productTypeInput')"
@ -14,17 +14,17 @@
<template>
<el-button v-if="runing" size="small" :disabled="viewDisabled" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
</template>
<template v-if="userRole == 'Admin'">
<template v-if="userRole == 'ADMIN'">
<el-button v-if="!runing" size="small" type="warning" :disabled="viewDisabled" @click="loadRunPlan">
{{ $t('joinTraining.runGraphLoading') }}</el-button>
</template>
<template v-if="userRole == 'Instructor' || userRole == 'Admin'">
<template v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'">
<el-button v-if="mode==OperateMode.FAULT" size="small" type="danger" @click="setFault">{{ $t('joinTraining.faultSetting') }}</el-button>
</template>
</el-button-group>
<el-radio-group
v-if="userRole == 'Instructor' || userRole == 'Admin'"
v-if="userRole == 'INSTRUCTOR' || userRole == 'ADMIN'"
v-model="mode"
size="small"
@change="changeOperateMode(mode)"
@ -39,7 +39,7 @@ import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic';
// import { getStationList } from '@/api/runplan';
import { getByGroupStationList } from '@/api/jmap/map';
import { getEveryDayRunPlanData } from '@/api/simulation';
import { getEveryDayRunPlanNew } from '@/api/simulation';
export default {
name: 'MenuDemonSchema',
@ -109,8 +109,9 @@ export default {
// getStationList(opt.mapId).then(response => {
const stations = response.data;
this.$store.dispatch('runPlan/setStations', stations).then(() => {
getEveryDayRunPlanData(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;
}).catch(error => {
this.$store.dispatch('runPlan/setPlanData', []);
@ -130,6 +131,9 @@ export default {
switchMode(swch) {
this.$store.dispatch('training/setPrdType', swch);
},
initPlannedDriving(isDisable) {
this.isDisable = isDisable;
},
changeOperateMode(handle) {
this.$store.dispatch('training/changeOperateMode', { mode: handle });
},

View File

@ -24,11 +24,12 @@
@change="handleUpdUser(node, index)"
/>
<el-select
v-if="roleType == 'Attendant'"
v-if="roleType.toUpperCase() == 'ATTENDANT' || roleType.toUpperCase() === 'STATION_SUPERVISOR'"
v-model="node.deviceCode"
:placeholder="$t('global.choose')"
size="mini"
:disabled="isDisable"
s
@change="handleUpdUser(node, index)"
>
<el-option
@ -80,7 +81,7 @@ export default {
},
computed: {
hasDevice() {
return ['Attendant', 'IBP'].includes(this.roleType);
return ['ATTENDANT', 'IBP', 'STATION_SUPERVISOR'].includes(this.roleType.toUpperCase());
},
isDisable() {
return this.userId != this.room.creatorId;

View File

@ -199,25 +199,25 @@ export default {
});
},
dispatcherList() {
return this.members.filter(elem => { return [elem.userRole].includes('Dispatcher'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('DISPATCHER'); });
},
attendantList() {
return this.members.filter(elem => { return [elem.userRole].includes('Attendant'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('ATTENDANT') || [elem.userRole.toUpperCase()].includes('STATION_SUPERVISOR'); });
},
instructorList() {
return this.members.filter(elem => { return [elem.userRole].includes('Instructor'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('INSTRUCTOR'); });
},
repairList() {
return this.members.filter(elem => { return [elem.userRole].includes('Repair'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('REPAIR'); });
},
driverList() {
return this.members.filter(elem => { return [elem.userRole].includes('Driver'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('DRIVER'); });
},
ibpList() {
return this.members.filter(elem => { return [elem.userRole].includes('IBP'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('IBP'); });
},
audienceList() {
return this.members.filter(elem => { return [elem.userRole].includes('Audience'); });
return this.members.filter(elem => { return [elem.userRole.toUpperCase()].includes('AUDIENCE'); });
}
},
async mounted() {
@ -278,6 +278,7 @@ export default {
deviceCode: ''
}];
if (this.drawWay) {
params[0].userRole = 'AUDIENCE';
await putUserRolesNew(params, this.group);
} else {
await putUserRoles(params, this.group);
@ -301,6 +302,10 @@ export default {
ibpPart: user.ibpPart
}];
if (this.drawWay) {
params[0].userRole = roleType.toUpperCase();
if (roleType === 'Attendant') {
params[0].userRole = 'STATION_SUPERVISOR';
}
await putUserRolesNew(params, this.group);
} else {
await putUserRoles(params, this.group);
@ -316,12 +321,18 @@ export default {
});
},
async handleDispatchUser({roleType, userList}) {
const list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType }; });
if (list.length) {
if (userList.length) {
try {
let list = [];
if (this.drawWay) {
if (roleType === 'Attendant') {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: 'STATION_SUPERVISOR' }; });
} else {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType.toUpperCase() }; });
}
await putUserRolesNew(list, this.group);
} else {
list = userList.map(elem => { return { id: elem.id, nickName: elem.nickName, userRole: roleType }; });
await putUserRoles(list, this.group);
}
list.forEach(item => {

View File

@ -99,7 +99,7 @@ export default {
members: {
deep: true,
handler() {
this.room.permissionRest = this.members.filter(elem => ['Audience'].includes(elem.userRole)).length;
this.room.permissionRest = this.members.filter(elem => ['AUDIENCE'].includes(elem.userRole.toUpperCase())).length;
}
},
//
@ -265,7 +265,7 @@ export default {
if (!old.inSimulation && user.inSimulation) {
this.$store.dispatch('socket/setChatContent', {...message, roomTip: `${user.nickName}进入仿真`});
if (this.userId == user.id) {
if (this.userId == user.id && user.userRole.toUpperCase() !== 'ADMIN') {
await this.jumpInSimulation();
}
}
@ -284,6 +284,7 @@ export default {
const rest = await getPublishMapInfo(room.mapId);
const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group, roomId: room.id };
if (this.$route.query.drawWay) {
query.drawWay = this.$route.query.drawWay;
this.$router.replace({ path: `/jointTrainingNew`, query: query});
} else {
this.$router.replace({ path: `/jointTraining`, query: query });