skinCode调整

This commit is contained in:
joylink_cuiweidong 2019-11-11 15:54:04 +08:00
parent b3a4e6ca8c
commit e8c8e491f5
46 changed files with 972 additions and 1131 deletions

View File

@ -1,11 +1,11 @@
const mapDeviceStyle = {
'01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
'05': 'batong_01' // 暂时没有画北京八通线
'01': 'chengdu_04',
'02': 'fuzhou_01',
'03': 'bejing_01',
'04': 'chengdu_03',
'05': 'batong_01' // 暂时没有画北京八通线
};
export function selectSkinCode(code) {
return Object.assign({}, require(`./skinCode/${mapDeviceStyle[code || '02']}`).default);
export function selectLineCode(code) {
return Object.assign({}, require(`./skinCode/${mapDeviceStyle[code || '02']}`).default);
}

View File

@ -7,7 +7,7 @@ import MouseController from './mouseController';
import KeyboardController from './keyboardController';
import deviceState from './constant/deviceState';
import deviceType from './constant/deviceType';
import { selectSkinCode } from './config/deviceStyle';
import { selectLineCode } from './config/deviceStyle';
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
import { deepAssign } from '@/utils/index';
@ -22,8 +22,8 @@ class Jlmap {
// 鼠标事件
this.events = { __Pan: 'pan', __Zoom: 'zoom', Selected: 'selected', Contextmenu: 'contextmenu', DataZoom: 'dataZoom', Keyboard: 'keyboard'};
// 皮肤参数
this.skinCode = '';
// 线路参数
this.lineCode = '';
// 皮肤风格
this.style = {};
@ -62,9 +62,9 @@ class Jlmap {
this.$keyboardController.enable();
}
loadStyle(skinCode) {
return selectSkinCode(skinCode);
}
loadStyle(lineCode) {
return selectLineCode(lineCode);
}ine
loadDefaultState() {
const defaultStateDict = {};
@ -82,7 +82,7 @@ class Jlmap {
setMap(map, mapDevice) {
// 保存皮肤类型
if (map.skinVO) {
this.skinCode = map.skinVO.code;
this.lineCode = map.skinVO.code;
this.$options.scaleRate = map.skinVO.scaling || 1;
this.$options.offsetX = map.skinVO.origin ? map.skinVO.origin.x : 0;
this.$options.offsetY = map.skinVO.origin ? map.skinVO.origin.y : 0;
@ -95,7 +95,7 @@ class Jlmap {
this.mapDevice = mapDevice;
// 加载对应皮肤
this.style = this.loadStyle(this.skinCode);
this.style = this.loadStyle(this.lineCode);
// 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(this.mapDevice); }
@ -315,7 +315,7 @@ class Jlmap {
}
clear() {
this.skinCode = '';
this.lineCode = '';
this.style = {};
this.mapDevice = {};
this.$painter.clear();

View File

@ -88,7 +88,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -90,7 +90,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -88,7 +88,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -90,7 +90,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -88,7 +88,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -90,7 +90,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -88,7 +88,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -90,7 +90,7 @@ export default {
},
queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) {
params['skinCode'] = this.$store.getters['map/skinCode'];
params['skinCode'] = this.$store.getters['map/lineCode'];
}
return runPlanTemplateList(params);
},

View File

@ -315,7 +315,7 @@ const map = {
map: (state) => {
return state.map;
},
skinCode: (state) => {
lineCode: (state) => {
if (state.map && state.map.skinVO) {
return state.map.skinVO.code;
}

View File

@ -47,6 +47,12 @@ export default {
'$store.state.app.windowSizeCount': function() {
this.setWindowSize();
}
// '$store.state.socket.simulationReset': function (val) {
// debugger;
// // if (val) {
// // this.simulationReset(val);
// // }
// }
},
async beforeDestroy() {
await this.$store.dispatch('map/mapClear');
@ -67,11 +73,12 @@ export default {
async loadMapDataById(mapId) {
try {
await this.$store.dispatch('training/changeMode', { mode: null });
await loadMapDataById(mapId);
await this.$store.dispatch('training/over');
await this.$store.dispatch('training/setMapDefaultState');
await this.$store.dispatch('map/clearJlmapTrainView');
await this.$store.dispatch('map/setTrainWindowShow', false);
loadMapDataById(mapId).then(()=>{
this.$store.dispatch('training/over');
this.$store.dispatch('training/setMapDefaultState');
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
} catch (error) {
this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading();

View File

@ -119,7 +119,7 @@ export default {
}
},
'$store.state.map.mapDataLoadedCount': function () {
if (this.$jlmap.skinCode) {
if (this.$jlmap.lineCode) {
this.isUpdate = true;
}
}

View File

@ -16,337 +16,341 @@
<script>
import { mapGetters } from 'vuex';
import { runDiagramGetTime } from '@/api/simulation';
import { getPublishMapInfo } from '@/api/jmap/map';
import { timeFormat } from '@/utils/date';
export default {
name: 'RunPlanView',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
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'
},
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
},
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: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': function () {
this.loadChartPage();
if (this.dialogShow) {
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 });
}
},
mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
this.loadChartPage();
},
beforeDestroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
methods: {
doShow() {
this.dialogShow = true;
this.loadInitData(this.series);
},
doClose() {
this.dialogShow = false;
},
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 {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear();
}
name: 'RunPlanView',
props: {
group: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
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'
},
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
},
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: {}
};
},
computed: {
...mapGetters('runPlan', [
'stations'
]),
title() {
return this.$t('display.runPlan.previewRunDiagram');
}
},
watch: {
'$store.state.runPlan.planLoadedCount': function () {
this.loadChartPage();
if (this.dialogShow) {
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 });
}
},
mounted() {
getPublishMapInfo(this.$route.query.mapId).then(res=>{
// this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.lineCode);
this.PlanConvert = this.$theme.loadPlanConvert(res.data.lineCode);
this.loadChartPage();
});
},
beforeDestroy() {
if (this.myChart && this.myChart.isDisposed) {
this.myChart.dispose();
this.myChart = null;
}
},
methods: {
doShow() {
this.dialogShow = true;
this.loadInitData(this.series);
},
doClose() {
this.dialogShow = false;
},
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 {
const that = this;
// echart
require.config(
{
paths: {
echarts: './js/dist'
}
}
);
//
require(
[
'echarts',
'echarts/lib/chart/line'
],
function (ec) {
if (that.myChart && that.myChart.isDisposed) {
that.myChart.clear();
}
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: document.documentElement.clientWidth, height: document.documentElement.clientHeight - 55 });
}
resolve(true);
});
}
);
} catch (error) {
reject(error);
}
});
},
updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
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);
}
});
}
let startValue = 3600 + that.PlanConvert.TranslationTime;
const offsetTime = 3600;
runDiagramGetTime(that.group).then(resp => {
startValue = resp.data - that.PlanConvert.TranslationTime;
that.option.dataZoom[0].startValue = that.option.dataZoom[1].startValue = startValue - offsetTime;
that.option.dataZoom[0].endValue = that.option.dataZoom[1].endValue = startValue + offsetTime;
that.option.series = series;
that.myChart = ec.init(document.getElementById(that.runPlanId));
if (that.myChart) {
that.myChart.setOption(that.option);
that.reSize({ width: document.documentElement.clientWidth, height: document.documentElement.clientHeight - 55 });
}
resolve(true);
});
}
);
} catch (error) {
reject(error);
}
});
},
updateRunPlanData(data) {
const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData;
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;
},
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
});
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 });
}
}
}
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">

View File

@ -31,7 +31,6 @@ import { Notification } from 'element-ui';
import { getGoodsTryUse } from '@/api/management/goods';
import { runDiagramStart, runDiagramOver, runDiagramGetTime } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic';
import { exitFullscreen } from '@/utils/screen';
import { getCountTime } from '@/utils/index';
import { runDiagramIsStart, quitScript } from '@/api/simulation';
import { timeFormat } from '@/utils/date';
@ -191,7 +190,6 @@ export default {
EventBus.$emit('chatSubscribeStop');
history.go(-1);
Notification.closeAll();
// exitFullscreen();
});
},
jumpjlmap3d() {

View File

@ -7,9 +7,9 @@
<el-button type="danger" @click="dumpScenesData">重置剧本</el-button>
</el-button-group> -->
<el-button-group>
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{$t('scriptRecord.drivingByPlan')}}</el-button>
<el-button type="success" :disabled="isDisable" @click="selectBeginTime">{{ $t('scriptRecord.drivingByPlan') }}</el-button>
<!-- <el-button type="danger" :disabled="!isDisable" @click="end">退出计划</el-button> -->
<el-button type="primary" @click="back">{{$t('scriptRecord.scriptBack')}}</el-button>
<el-button type="primary" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
</el-button-group>
</div>
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
@ -23,7 +23,6 @@ import SetTime from './demon/setTime';
import { Notification } from 'element-ui';
import { runDiagramStart, runDiagramOver, runDiagramGetTime } from '@/api/simulation';
// import { OperateMode, PermissionType } from '@/scripts/ConstDic';
import { exitFullscreen } from '@/utils/screen';
// import { getCountTime } from '@/utils/index';
// import { loadMapData } from '@/utils/loaddata';
import { runDiagramIsStart } from '@/api/simulation';
@ -31,122 +30,121 @@ import { timeFormat } from '@/utils/date';
import { EventBus } from '@/scripts/event-bus';
export default {
name: 'MenuTask',
components: {
SetTime
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
isDisable: false,
tryTime: 0, //
timeNow: 0, //
time: null, //
countTime: 0, //
remainingTime: 0,
goodsId: this.$route.query.goodsId,
// isSaveStage: true,
training: {
id: '',
name: '',
remarks: ''
}
};
},
computed: {
scriptId() {
return this.$route.query.scriptId;
}
},
watch: {
'$store.state.training.subscribeCount': function () {
this.group && this.initLoadPage();
}
},
beforeDestroy() {
if (this.time) {
this.setTryTime();
clearTimeout(this.time);
}
},
methods: {
async initLoadPage() {
try {
const resp = await runDiagramIsStart(this.group);
if (resp && resp.data) {
this.isDisable = true;
this.$store.dispatch('training/simulationStart');
} else {
this.isDisable = false;
this.$store.dispatch('training/over');
}
name: 'MenuTask',
components: {
SetTime
},
props: {
group: {
type: String,
required: true
},
offset: {
type: Number,
required: true
}
},
data() {
return {
isDisable: false,
tryTime: 0, //
timeNow: 0, //
time: null, //
countTime: 0, //
remainingTime: 0,
goodsId: this.$route.query.goodsId,
// isSaveStage: true,
training: {
id: '',
name: '',
remarks: ''
}
};
},
computed: {
scriptId() {
return this.$route.query.scriptId;
}
},
watch: {
'$store.state.training.subscribeCount': function () {
this.group && this.initLoadPage();
}
},
beforeDestroy() {
if (this.time) {
this.setTryTime();
clearTimeout(this.time);
}
},
methods: {
async initLoadPage() {
try {
const resp = await runDiagramIsStart(this.group);
if (resp && resp.data) {
this.isDisable = true;
this.$store.dispatch('training/simulationStart');
} else {
this.isDisable = false;
this.$store.dispatch('training/over');
}
await this.loadSystemTime();
} catch (error) {
console.log(error);
}
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
resetBeginTime() {
this.isDisable = false;
},
start(model) {
this.isDisable = true;
runDiagramStart(model, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
});
}).catch(() => {
this.isDisable = false;
this.$messageBox('开始仿真失败,请返回重试');
});
},
end() {
this.isDisable = false;
runDiagramOver(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.isDisable = true;
this.$messageBox('结束仿真失败,请返回');
});
},
setTryTime() {
if (this.try) {
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId });
}
},
back() {
this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop');
history.go(-1);
Notification.closeAll();
// exitFullscreen();
});
},
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)}`));
}
}
}
await this.loadSystemTime();
} catch (error) {
console.log(error);
}
},
selectBeginTime() {
this.$refs.setTime.doShow();
},
resetBeginTime() {
this.isDisable = false;
},
start(model) {
this.isDisable = true;
runDiagramStart(model, this.group).then(res => {
this.$store.dispatch('training/simulationStart').then(() => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().getFullYear()} ${model.initTime}`));
});
}).catch(() => {
this.isDisable = false;
this.$messageBox('开始仿真失败,请返回重试');
});
},
end() {
this.isDisable = false;
runDiagramOver(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.isDisable = true;
this.$messageBox('结束仿真失败,请返回');
});
},
setTryTime() {
if (this.try) {
this.$emit('tryTime', { time: this.tryTime, goodsId: this.goodsId });
}
},
back() {
this.$store.dispatch('training/over').then(() => {
EventBus.$emit('runPlanStop');
EventBus.$emit('chatSubscribeStop');
history.go(-1);
Notification.closeAll();
});
},
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)}`));
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,155 +0,0 @@
<template>
<el-card>
<div slot="header" style="text-align: center;">
<span class="title">{{ this.$t('exam.trainingName') }} {{ courseModel.name }}</span>
</div>
<div style="margin:50px" :style="{ height: height - 150 +'px' }">
<p class="time-item">
<span class="time-label">{{ this.$t('exam.examinationTiming') }}</span>
<span class="time-elem">{{ formatExamUsedTime }}</span>
</p>
<p class="list-item">
<span class="list-label">{{ this.$t('exam.maximumTimeToCompleteThisQuestion') }}</span>
<span class="list-elem">{{ courseModel.maxDuration | setTime }}{{ this.$t('global.second') }} </span>
</p>
<p class="list-item">
<span class="list-label">{{ this.$t('exam.theBestTimeToCompleteTheQuestion') }}</span>
<span class="list-elem">{{ courseModel.minDuration | setTime }}{{ this.$t('global.second') }}</span>
</p>
<p class="list-item">
<span class="list-label"> {{ this.$t('exam.trainingNotes') }}</span>
<span class="list-elem">{{ courseModel.remarks }}</span>
</p>
<p>
<span class="list-label" />
<el-button :loading="loading" type="primary" @click="start">{{ this.$t('exam.startTheExam') }}</el-button>
<el-button :loading="loading" type="danger" @click="back">{{ this.$t('exam.giveUpTheExam') }}</el-button>
</p>
</div>
</el-card>
</template>
<script>
import { setExamGive } from '@/api/management/userexam';
import { getTrainingDetail } from '@/api/jmap/training';
import { launchFullscreen } from '@/utils/screen';
import { timeFormat } from '@/utils/date';
export default {
name: 'ExamDetailList',
filters: {
setTime(val) {
return val;
}
},
data() {
return {
loading: false,
courseModel: {
id: '',
name: '',
skinCode: '',
maxDuration: '',
minDuration: '',
remarks: '',
updateTime: ''
}
};
},
computed: {
formatExamUsedTime() {
return timeFormat(this.$store.state.exam.usedTime);
},
height() {
return this.$store.state.app.height;
}
},
watch: {
$route(newVal) {
this.initLoadPage();
}
},
mounted() {
this.initLoadPage();
},
methods: {
initLoadPage() {
const trainingId = this.$route.query.trainingId;
if (parseInt(trainingId)) {
getTrainingDetail(trainingId).then(res => {
this.courseModel = {
id: res.data.id,
name: res.data.name,
skinCode: res.data.skinCode,
maxDuration: res.data.maxDuration,
remarks: res.data.remarks,
minDuration: res.data.minDuration,
updateTime: res.data.updateTime
};
}).catch(error => {
this.$message.error( this.$t('error.getTestInformationFailed') + ':' + error.message);
});
}
},
start() {
this.loading = true;
const query = { skinCode: this.$route.query.skinCode, trainingId: this.$route.query.trainingId, userExamId: this.$route.query.userExamId, examQuestionId: this.$route.params.examQuestionId };
this.$router.push({ path: '/display/exam', query: query });
launchFullscreen();
},
back() {
this.loading = true;
this.$confirm( this.$t('tip.giveUpTheExamTip'), this.$t('tip.hint'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
//
setExamGive(this.$route.query.userExamId).then(() => {
this.$router.back();
});
}).catch(() => {
this.loading = false;
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.title {
font-weight: bold
}
.time-item {
font-size: 24px;
color: black !important;
}
.time-label {
display: -moz-inline-box;
display: inline-block;
text-align: right;
margin-left: 14px;
}
.time-elem {
color: rgb(90, 89, 89) !important;
}
.list-item {
font-size: 16px;
margin-bottom: 20px;
}
.list-label {
display: -moz-inline-box;
display: inline-block;
text-align: right;
width: 160px;
}
.list-elem {
color: #808080 !important;
}
</style>

View File

@ -231,16 +231,16 @@ export default {
this.dataZoom.offsetY = dataZoom.offsetY.toFixed(1) + '';
this.dataZoom.scaleRate = dataZoom.scaleRate + '';
const skinCode = this.$store.getters['map/skinCode'];
if (skinCode) {
const lineCode = this.$store.getters['map/lineCode'];
if (lineCode) {
const param = {
scaleRate: this.dataZoom.scaleRate,
offsetY: this.dataZoom.offsetY,
offsetX: this.dataZoom.offsetX,
skinCode: skinCode
lineCode: lineCode
};
this.$store.dispatch('map/updateZoom', this.dataZoom);
localStore.set(`scaleRate_${skinCode}`, JSON.stringify(param)); //
localStore.set(`scaleRate_${lineCode}`, JSON.stringify(param)); //
}
this.$store.dispatch('training/emitTipFresh');

View File

@ -73,7 +73,7 @@ export default {
deviceCode: '',
group: '',
mapId: '',
skinCode: '',
lineCode: '',
simulationShow: false,
drivingShow: false,
ibpShow: false,
@ -153,7 +153,7 @@ export default {
async created() {
this.group = this.$route.query.group;
this.mapId = this.$route.query.mapId;
this.skinCode = this.$route.query.skinCode;
this.lineCode = this.$route.query.lineCode;
this.subSystem = this.$route.query.subSystem;
Message.closeAll();
},
@ -302,7 +302,7 @@ export default {
this.$store.dispatch('training/end', TrainingMode.NORMAL);
this.$store.dispatch('training/changeOperateMode', { mode: OperateMode.NORMAL }); //
if (this.skinCode) {
if (this.lineCode) {
// 01 02 ''
const resp = await this.getUserRole();
if (resp && resp.code == 200) {
@ -367,7 +367,7 @@ export default {
this.panelShow = false;
this.drivingShow = true;
this.ibpShow = false;
this.$refs.Jl3dDrive.show(this.skinCode);
this.$refs.Jl3dDrive.show(this.mapId);
},
hideIbp() {
Message.closeAll();

View File

@ -298,7 +298,7 @@ export default {
back() {
this.$store.dispatch('training/over').then(() => {
putJointTrainingSimulationUser(this.group).then(() => {
this.$router.replace({ path: `/trainroom`, query: { skinCode: this.$route.query.skinCode, group: this.group, subSystem: this.$route.query.subSystem } });
this.$router.replace({ path: `/trainroom`, query: { lineCode: this.$route.query.lineCode, group: this.group, subSystem: this.$route.query.subSystem } });
exitFullscreen();
});
});

View File

@ -97,7 +97,7 @@ export default {
...mapGetters('map', [
'counterList',
'stationList',
'skinCode'
'lineCode'
]),
createRules: function () {
return {

View File

@ -82,7 +82,7 @@ export default {
...mapGetters('map', [
'delayShowList',
'stationList',
'skinCode'
'lineCode'
]),
createRules: function () {
return {

View File

@ -111,7 +111,7 @@ export default {
'sectionList',
'trainModelList',
'lcList',
'skinCode'
'lineCode'
]),
createRules: function () {
return {

View File

@ -90,7 +90,7 @@ export default {
'sectionList',
'trainModelList',
'tempSpeedLimitList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -143,7 +143,7 @@ export default {
...mapGetters('map', [
'lineList',
'stationList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -320,7 +320,7 @@ export default {
'switchList',
'stationList',
'stationStandList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -192,7 +192,7 @@ export default {
'signalList',
'sectionList',
'stationList',
'skinCode'
'lineCode'
]),
PhysicalSectionList() {
let list = [];

View File

@ -104,7 +104,7 @@ export default {
'stationList',
'sectionList',
'zcList',
'skinCode'
'lineCode'
]),
form() {
return {

View File

@ -90,7 +90,7 @@ export default {
...mapGetters('map', [
'stationList',
'stationControlList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -119,7 +119,7 @@ export default {
...mapGetters('map', [
'stationList',
'stationStandList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -139,7 +139,7 @@ export default {
'sectionList',
'switchList',
'stationList',
'skinCode'
'lineCode'
])
},
watch: {

View File

@ -132,7 +132,7 @@ export default {
...mapGetters('map', [
'textList',
'stationList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -75,7 +75,7 @@ export default {
...mapGetters('map', [
'trainList',
'trainModelList',
'skinCode'
'lineCode'
])
},
watch: {

View File

@ -95,7 +95,7 @@ export default {
'sectionList',
'trainModelList',
'zcList',
'skinCode'
'lineCode'
]),
form() {
const form = {

View File

@ -46,9 +46,9 @@ export default {
},
watch: {
'$store.state.map.mapDataLoadedCount': function () {
const skinCode = this.$jlmap.skinCode;
if (skinCode) {
this.menus = this.$theme.loadMenuComponent(skinCode);
const lineCode = this.$jlmap.lineCode;
if (lineCode) {
this.menus = this.$theme.loadMenuComponent(lineCode);
}
}
},
@ -67,10 +67,10 @@ export default {
return device;
},
//
getSelectedBySkinCode(device) {
const switchSectionIsWitchSkinCodeList = ['03'];
const skinCode = this.$store.getters['map/skinCode'];
if (switchSectionIsWitchSkinCodeList.includes(skinCode) && device._type == deviceType.Section) {
getSelectedByLineCode(device) {
const switchSectionIsWitchLineCodeList = ['03'];
const lineCode = this.$store.getters['map/lineCode'];
if (switchSectionIsWitchLineCodeList.includes(lineCode) && device._type == deviceType.Section) {
const section = this.$store.getters['map/getDeviceByCode'](device._code);
if (section) {
device = this.$store.getters['map/getDeviceByCode'](section.relSwitchCode);
@ -117,7 +117,7 @@ export default {
}
if (device) {
this.selected = device = this.getSelectedBySkinCode(device);
this.selected = device = this.getSelectedByLineCode(device);
if (!this.buttonOperation) {
this.$store.dispatch('menuOperation/setSelected', device);
if (!this.checkShouldPop(device)) {
@ -134,10 +134,10 @@ export default {
this.$store.dispatch('training/emitTipFresh');
},
checkShouldPop(device) {
const skinCode = this.$store.getters['map/skinCode'];
const lineCode = this.$store.getters['map/lineCode'];
if (device._type === 'Signal') {
return device._viewVal === '3';
} else if (device._type === 'StationControl' && skinCode == '01') { //
} else if (device._type === 'StationControl' && lineCode == '01') { //
return device._viewVal === '1';
} else {
return true;

View File

@ -253,12 +253,7 @@ export default {
}).then(() => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
// if (row.id === this.$route.query.planId) {
// const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
// this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
// }
this.refresh();
// this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});

View File

@ -3,7 +3,7 @@
<menu-bar ref="menuBar" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" />
<schedule
ref="schedule"
:skin-code="skinCode"
:line-code="lineCode"
:plan-convert="PlanConvert"
:max-height="height"
:max-width="width"
@ -91,8 +91,8 @@ export default {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
lineCode() {
return this.$route.query.lineCode || '02';
},
width() {
return this.$store.state.app.width;
@ -102,7 +102,7 @@ export default {
}
},
created() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
mounted() {

View File

@ -144,188 +144,188 @@ import { formatTime, formatName } from '@/utils/runPlan';
import { getUID } from '@/jmap/utils/Uid';
export default {
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
showDefault: true,
stopStationMap: {},
params: {},
addModel: {
taskIndex: '',
addToFront: false,
routingCode: '',
endStationCode: '',
startStationCode: '',
endSectionCode: '',
startSectionCode: '',
startTime: '00:00:00',
endTime: '',
planId: '',
tripNumber: '',
serviceNumber: '',
defaultStopTime: '30',
defaultSpeedLevel: 'level3',
routingList: [],
arriveConfigList: []
},
tripNumberList: [{ value: '', label: this.$t('planMonitor.automatic') }],
defaultStopTimeList: [{ value: '30', label: this.$t('planMonitor.default') }, { value: '0', label: '0' }],
defaultSpeedLevelList: [{ value: 'level3', label: this.$t('planMonitor.default') }]
};
},
computed: {
title() {
return this.$t('planMonitor.addTask');
}
},
watch: {
'addModel.routingCode': function () {
this.computedDetailList();
},
'addModel.startTime': function () {
this.computedDetailList();
},
'addModel.defaultStopTime': function () {
this.computedDetailList();
},
'addModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
methods: {
loadInitData(params) {
this.isPlan = params.isPlan;
this.addModel.taskIndex = getUID('task_');
this.addModel.serviceNumber = params.serviceNumber;
this.addModel.planId = this.$route.query.planId;
name: 'AddTask',
components: {
},
data() {
return {
dialogShow: false,
loading: false,
isPlan: false,
showDefault: true,
stopStationMap: {},
params: {},
addModel: {
taskIndex: '',
addToFront: false,
routingCode: '',
endStationCode: '',
startStationCode: '',
endSectionCode: '',
startSectionCode: '',
startTime: '00:00:00',
endTime: '',
planId: '',
tripNumber: '',
serviceNumber: '',
defaultStopTime: '30',
defaultSpeedLevel: 'level3',
routingList: [],
arriveConfigList: []
},
tripNumberList: [{ value: '', label: this.$t('planMonitor.automatic') }],
defaultStopTimeList: [{ value: '30', label: this.$t('planMonitor.default') }, { value: '0', label: '0' }],
defaultSpeedLevelList: [{ value: 'level3', label: this.$t('planMonitor.default') }]
};
},
computed: {
title() {
return this.$t('planMonitor.addTask');
}
},
watch: {
'addModel.routingCode': function () {
this.computedDetailList();
},
'addModel.startTime': function () {
this.computedDetailList();
},
'addModel.defaultStopTime': function () {
this.computedDetailList();
},
'addModel.defaultSpeedLevel': function () {
this.computedDetailList();
}
},
methods: {
loadInitData(params) {
this.isPlan = params.isPlan;
this.addModel.taskIndex = getUID('task_');
this.addModel.serviceNumber = params.serviceNumber;
this.addModel.planId = this.$route.query.planId;
const planId = this.$route.query.planId;
if (planId) {
getRoutingList(planId).then(resp => {
this.addModel.routingList = resp.data;
});
}
const planId = this.$route.query.planId;
if (planId) {
getRoutingList(planId).then(resp => {
this.addModel.routingList = resp.data;
});
}
const mapId = this.$route.query.mapId;
if (skinCode) {
getStationRunning(mapId).then(resp => { //
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
if (list && list.length) {
list.forEach(elem => {
if (!elem.runPlanLevelVO) {
this.$alert(`${this.$t('planMonitor.tipOperationTime')}`, {
confirmButtonText: this.$t('global.confirm'),
callback: action => {
this.doClose();
}
});
}
});
const mapId = this.$route.query.mapId;
if (mapId) {
getStationRunning(mapId).then(resp => { //
const list = resp.data;
list.forEach(elem => {
this.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
});
if (list && list.length) {
list.forEach(elem => {
if (!elem.runPlanLevelVO) {
this.$alert(`${this.$t('planMonitor.tipOperationTime')}`, {
confirmButtonText: this.$t('global.confirm'),
callback: action => {
this.doClose();
}
});
}
});
}
});
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
formatName(code) {
return formatName(code);
},
computedTimeByString(timeStr) {
const bTime = +new Date(`2019-01-01 00:00:00`);
const eTime = +new Date(`2019-01-01 ${timeStr}`);
return Number(eTime) - Number(bTime);
},
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if (index < list.length - 1) {
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
} else {
this.$messageBox(this.$t('planMonitor.addTaskHint1')+stopStationObj.startSectionCode+this.$t('planMonitor.addTaskHint2')+stopStationObj.endSectionCode+this.$t('planMonitor.addTaskHint3'));
}
}
}
}
});
}
},
doShow(params) {
this.loadInitData(params);
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
formatName(code) {
return formatName(code);
},
computedTimeByString(timeStr) {
const bTime = +new Date(`2019-01-01 00:00:00`);
const eTime = +new Date(`2019-01-01 ${timeStr}`);
return Number(eTime) - Number(bTime);
},
compuntedRunTime(list, index, runLevel) {
let runTime = 0;
if (index < list.length - 1) {
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
} else {
this.$messageBox(this.$t('planMonitor.addTaskHint1') + stopStationObj.startSectionCode + this.$t('planMonitor.addTaskHint2') + stopStationObj.endSectionCode + this.$t('planMonitor.addTaskHint3'));
}
}
}
return runTime;
},
changeStopTime(indexs, time) {
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
const runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
this.addModel.arriveConfigList.forEach((elem, index) => {
if (indexs == index) {
elem.stopTime = time ? Number(time) : 0;
}
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == this.addModel.arriveConfigList.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? this.$t('planMonitor.default') : '';
tempTime = tempTime + elem.stopTime + this.compuntedRunTime(this.addModel.arriveConfigList, index, runLevel);
});
this.addModel.endTime = formatTime(tempTime - this.addModel.arriveConfigList[this.addModel.arriveConfigList.length - 1].stopTime);
},
computedDetailList() {
if (this.addModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.addModel.routingCode }).then(resp => {
const list = resp.data;
const waitTime = Number(this.addModel.defaultStopTime) || 0; //
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
const runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? this.$t('planMonitor.default') : '';
elem.stopTime = this.addModel.defaultStopTime != '0' ? 30 : 0;
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
return runTime;
},
changeStopTime(indexs, time) {
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
const runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
this.addModel.arriveConfigList.forEach((elem, index) => {
if (indexs == index) {
elem.stopTime = time ? Number(time) : 0;
}
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == this.addModel.arriveConfigList.length - 1 ? '' : formatTime(tempTime + elem.stopTime);
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? this.$t('planMonitor.default') : '';
tempTime = tempTime + elem.stopTime + this.compuntedRunTime(this.addModel.arriveConfigList, index, runLevel);
});
this.addModel.endTime = formatTime(tempTime - this.addModel.arriveConfigList[this.addModel.arriveConfigList.length - 1].stopTime);
},
computedDetailList() {
if (this.addModel.routingCode) {
querySectionListByRouting({ planId: this.$route.query.planId, routingCode: this.addModel.routingCode }).then(resp => {
const list = resp.data;
const waitTime = Number(this.addModel.defaultStopTime) || 0; //
let tempTime = this.computedTimeByString(this.addModel.startTime) / 1000 - 30;
const runLevel = this.addModel.defaultSpeedLevel || 'level3'; //
list.forEach((elem, index) => {
elem.arriveTime = index ? formatTime(tempTime) : '';
elem.departureTime = index == list.length - 1 ? '' : formatTime(tempTime + waitTime);
elem.speedLevel = this.addModel.defaultSpeedLevel == 'level3' ? this.$t('planMonitor.default') : '';
elem.stopTime = this.addModel.defaultStopTime != '0' ? 30 : 0;
tempTime = tempTime + waitTime + this.compuntedRunTime(list, index, runLevel);
});
this.addModel.arriveConfigList = list;
this.addModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
});
}
},
handleClick(row, column, event) {
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
this.addModel.startSectionCode = row.startSectionCode;
this.addModel.endSectionCode = row.endSectionCode;
this.addModel.routingCode = row.code;
},
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) });
} else {
//
addPlanTrip(this.addModel).then(resp => {
// this.$emit('dispatchOperate', {
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
// });
this.$emit('refresh');
this.$message.success(this.$t('tip.addTaskSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.addTaskFailed'));
});
}
this.addModel.arriveConfigList = list;
this.addModel.endTime = formatTime(tempTime - list[list.length - 1].stopTime);
});
}
},
handleClick(row, column, event) {
this.addModel.startStationCode = row.startStationCode;
this.addModel.endStationCode = row.endStationCode;
this.addModel.startSectionCode = row.startSectionCode;
this.addModel.endSectionCode = row.endSectionCode;
this.addModel.routingCode = row.code;
},
handleCommit() {
if (this.isPlan) {
//
this.$emit('dispatchOperate', { dialogName: 'editPlanningTrain', operate: 'handleConfirmAddTask', params: Object.assign({}, this.addModel) });
} else {
//
addPlanTrip(this.addModel).then(resp => {
// this.$emit('dispatchOperate', {
// dialogName: 'openRunPlan', operate: 'loadRunPlanData', params: Object.assign({refresh: true}, this.$route.query)
// });
this.$emit('refresh');
this.$message.success(this.$t('tip.addTaskSuccessfully'));
}).catch(() => {
this.$messageBox(this.$t('tip.addTaskFailed'));
});
}
this.doClose();
}
}
this.doClose();
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -65,7 +65,6 @@
<script>
import { createEmptyPlan, queryRunPlanList, postCreatePlan, importRunPlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import XLSX from 'xlsx';
export default {
@ -168,7 +167,6 @@ export default {
this.loading = true;
postCreatePlan(this.pullModel).then(resp => {
this.$message.success(this.$t('tip.createARunGraphSuccessfully'));
// this.jump(resp.data, this.pullModel.name);
this.$emit('refresh');
this.doClose();
}).catch((error) => {
@ -251,10 +249,6 @@ export default {
}, 200);
}
this.doClose();
},
jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
}
};

View File

@ -30,75 +30,75 @@
import { putRunPlanDetail } from '@/api/runplan';
export default {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
publishMapList: [],
editModel: {
planId: '',
name: ''
}
};
},
computed: {
title() {
return this.$t('planMonitor.modifyRunningDiagramName');
},
rules() {
return {
name: [
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
]
};
}
},
mounted() {
name: 'CreateEmptyPlan',
components: {
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
publishMapList: [],
editModel: {
planId: '',
name: ''
}
};
},
computed: {
title() {
return this.$t('planMonitor.modifyRunningDiagramName');
},
rules() {
return {
name: [
{ required: true, message: this.$t('rules.enterTheNameOfTheRunGraph'), trigger: 'blur' }
]
};
}
},
mounted() {
},
methods: {
doShow(data) {
this.dialogShow = true;
if (data && data.name) {
this.editModel.name = data.name;
this.editModel.planId = data.id;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.editModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
},
handleEdit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
putRunPlanDetail(this.editModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, skinCode: this.$route.query.skinCode, planName: this.editModel.name, refresh: true }
};
},
methods: {
doShow(data) {
this.dialogShow = true;
if (data && data.name) {
this.editModel.name = data.name;
this.editModel.planId = data.id;
}
},
doClose() {
this.loading = false;
this.dialogShow = false;
this.editModel.name = '';
if (this.$refs.form) {
this.$refs.form.resetFields();
}
},
handleEdit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true;
putRunPlanDetail(this.editModel).then(resp => {
const params = {
dialogName: 'openRunPlan',
operate: 'loadRunPlanData',
params: { planId: resp.data, lineCode: this.$route.query.lineCode, planName: this.editModel.name, refresh: true }
};
this.$emit('dispatchOperate', params);
this.$message.success(this.$t('tip.runGraphNameModifiedSuccessfully'));
this.$emit('renewal');
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.modifyRunGraphNameFailed'));
this.doClose();
});
}
});
}
}
this.$emit('dispatchOperate', params);
this.$message.success(this.$t('tip.runGraphNameModifiedSuccessfully'));
this.$emit('renewal');
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.modifyRunGraphNameFailed'));
this.doClose();
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -102,97 +102,97 @@ import { getStationRunning, setStationRunning } from '@/api/runplan';
import UpdateStationIntervalTime from './updateStationIntervalTime';
export default {
name: 'ModifyingStationIntervalTime',
components: {
UpdateStationIntervalTime
},
data() {
return {
dialogShow: false,
loading: false,
DirectionCodeMap: {},
stationIntervalData: [],
params: {},
runSpeedLevels: {
level1: 42,
level2: 37,
level3: 32,
level4: 27,
level5: 22
}
};
},
computed: {
title() {
return this.$t('planMonitor.modifying.modifyRunLevel');
}
},
mounted() {
this.loadInitData();
},
methods: {
formatName(code) {
return formatName(code);
},
loadInitData() {
this.DirectionCodeMap = {};
this.$ConstSelect.DirectionCodeList.forEach(elem => {
this.DirectionCodeMap[elem.value] = elem.label;
});
name: 'ModifyingStationIntervalTime',
components: {
UpdateStationIntervalTime
},
data() {
return {
dialogShow: false,
loading: false,
DirectionCodeMap: {},
stationIntervalData: [],
params: {},
runSpeedLevels: {
level1: 42,
level2: 37,
level3: 32,
level4: 27,
level5: 22
}
};
},
computed: {
title() {
return this.$t('planMonitor.modifying.modifyRunLevel');
}
},
mounted() {
this.loadInitData();
},
methods: {
formatName(code) {
return formatName(code);
},
loadInitData() {
this.DirectionCodeMap = {};
this.$ConstSelect.DirectionCodeList.forEach(elem => {
this.DirectionCodeMap[elem.value] = elem.label;
});
this.stationIntervalData = [];
if (this.$route.query.skinCode) {
getStationRunning(this.$route.query.mapId).then(resp => {
const list = resp.data;
list.forEach(elem => {
elem.isEditStatus = false;
if (!elem.runPlanLevelVO || elem.runPlanLevelVO.length <= 0) {
elem.runPlanLevelVO = { stationRunningId: elem.id };
Object.keys(this.runSpeedLevels).forEach(key => {
elem.runPlanLevelVO[key] = parseInt((elem.distance / 100) / (this.runSpeedLevels[key] / 3.6));
elem.isEditStatus = true;
});
}
});
this.stationIntervalData = list;
});
}
},
doShow(params) {
this.params = params || {};
this.loadInitData();
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleUpdate(row) {
this.$refs.updateStationIntervalTime.doShow(row);
},
handleConfirm(model) {
this.stationIntervalData.forEach(elem => {
if (elem.id == model.stationRunningId) {
elem.isEditStatus = true;
elem.runPlanLevelVO = model;
}
});
},
handleSave() {
const data = [];
this.stationIntervalData.forEach(elem => {
data.push(elem.runPlanLevelVO);
});
setStationRunning(this.$route.query.mapId, data).then(resp => {
this.stationIntervalData.forEach(elem => {
elem.isEditStatus = false;
});
this.$message.success(this.$t('planMonitor.modifying.modifySuccess'));
}).catch(() => {
this.$messageBox(this.$t('planMonitor.modifying.modifyFailed'));
});
}
}
this.stationIntervalData = [];
if (this.$route.query.lineCode) {
getStationRunning(this.$route.query.mapId).then(resp => {
const list = resp.data;
list.forEach(elem => {
elem.isEditStatus = false;
if (!elem.runPlanLevelVO || elem.runPlanLevelVO.length <= 0) {
elem.runPlanLevelVO = { stationRunningId: elem.id };
Object.keys(this.runSpeedLevels).forEach(key => {
elem.runPlanLevelVO[key] = parseInt((elem.distance / 100) / (this.runSpeedLevels[key] / 3.6));
elem.isEditStatus = true;
});
}
});
this.stationIntervalData = list;
});
}
},
doShow(params) {
this.params = params || {};
this.loadInitData();
this.dialogShow = true;
},
doClose() {
this.loading = false;
this.dialogShow = false;
},
handleUpdate(row) {
this.$refs.updateStationIntervalTime.doShow(row);
},
handleConfirm(model) {
this.stationIntervalData.forEach(elem => {
if (elem.id == model.stationRunningId) {
elem.isEditStatus = true;
elem.runPlanLevelVO = model;
}
});
},
handleSave() {
const data = [];
this.stationIntervalData.forEach(elem => {
data.push(elem.runPlanLevelVO);
});
setStationRunning(this.$route.query.mapId, data).then(resp => {
this.stationIntervalData.forEach(elem => {
elem.isEditStatus = false;
});
this.$message.success(this.$t('planMonitor.modifying.modifySuccess'));
}).catch(() => {
this.$messageBox(this.$t('planMonitor.modifying.modifyFailed'));
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -347,13 +347,13 @@ export default {
}
},
loadInitData(params) {
const skinCode = this.$route.query.skinCode;
const lineCode = this.$route.query.lineCode;
const mapId = this.$route.query.mapId;
this.isPlan = params.isPlan;
this.editModel.taskIndex = params.taskIndex;
this.editModel.serviceNumber = params.serviceNumber;
this.editModel.tripNumber = params.tripNumber;
this.PlanConvert = this.$theme.loadPlanConvert(skinCode);
this.PlanConvert = this.$theme.loadPlanConvert(lineCode);
const editData = this.$store.state.runPlan.editData[this.editModel.serviceNumber];
if (editData) {

View File

@ -50,117 +50,117 @@ import { UrlConfig } from '@/router/index';
import EditPlanName from './editPlanName';
export default {
name: 'OpenRunPlan',
components: {
EditPlanName
},
props: {
skinCode: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
height: 260,
// planId: '',
// planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
runPlanDict: {}
// defaultProps: {
// label: 'name'
// }
};
},
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('planMonitor.openRunPlan.runPlanList');
}
},
mounted() {
this.loadRunPlanData({
planId: this.$route.query.planId,
skinCode: this.$route.query.skinCode,
planName: this.$route.query.planName
});
},
methods: {
// handleNodeClick(data) {
// this.planId = data.id;
// this.planName = data.name;
// },
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
},
getRunPlanList() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
this.dialogShow = true;
}).catch(() => {
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
});
},
doShow(data) {
this.type = data.type || 'add';
this.getRunPlanList();
},
doClose() {
this.dialogShow = false;
// this.planId = '';
// this.planName = '';
},
//
handleConfirm(row) {
this.loadRunPlanData({
planId: row.id,
skinCode: this.$route.query.skinCode,
planName: row.name
});
this.doClose();
},
//
handleDelete(row) {
this.$confirm(this.$t('planMonitor.openRunPlan.confirmDeleteRunPlan'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
if (row.id === this.$route.query.planId) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
},
//
handleEdit(row) {
if (row.id && row.name) {
this.$refs.editPlan.doShow({id: row.id, name: row.name});
} else {
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
}
}
}
name: 'OpenRunPlan',
components: {
EditPlanName
},
props: {
skinCode: {
type: String,
required: true
}
},
data() {
return {
dialogShow: false,
loading: false,
height: 260,
// planId: '',
// planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
runPlanDict: {}
// defaultProps: {
// label: 'name'
// }
};
},
computed: {
show() {
return this.dialogShow;
},
title() {
return this.$t('planMonitor.openRunPlan.runPlanList');
}
},
mounted() {
this.loadRunPlanData({
planId: this.$route.query.planId,
skinCode: this.$route.query.skinCode,
planName: this.$route.query.planName
});
},
methods: {
// handleNodeClick(data) {
// this.planId = data.id;
// this.planName = data.name;
// },
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
} else {
const query = { skinCode: skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
},
getRunPlanList() {
getRpListByMapId(this.$route.query.mapId).then((resp) => {
this.runPlanList = resp.data;
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
this.dialogShow = true;
}).catch(() => {
this.$messageBox(this.$t('planMonitor.openRunPlan.getRunPlanListFail'));
});
},
doShow(data) {
this.type = data.type || 'add';
this.getRunPlanList();
},
doClose() {
this.dialogShow = false;
// this.planId = '';
// this.planName = '';
},
//
handleConfirm(row) {
this.loadRunPlanData({
planId: row.id,
skinCode: this.$route.query.skinCode,
planName: row.name
});
this.doClose();
},
//
handleDelete(row) {
this.$confirm(this.$t('planMonitor.openRunPlan.confirmDeleteRunPlan'), this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(this.$t('planMonitor.openRunPlan.deleteSuccess'));
if (row.id === this.$route.query.planId) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
this.doClose();
}).catch(() => {
this.$messageBox(this.$t('tip.deleteOperationGraphFailed'));
});
}).catch(() => { });
},
//
handleEdit(row) {
if (row.id && row.name) {
this.$refs.editPlan.doShow({id: row.id, name: row.name});
} else {
this.$message.info(this.$t('planMonitor.openRunPlan.pleaseSelectRunplan'));
}
}
}
};
</script>

View File

@ -37,7 +37,7 @@ export default {
DataTable
},
props: {
skinCode: {
lineCode: {
type: String,
required: true
},
@ -367,7 +367,7 @@ export default {
this.mapName = `${resp.data.name} (${this.$route.query.planName || ''})`;
});
}
this.planConvert = this.$theme.loadPlanConvert(this.skinCode);
this.planConvert = this.$theme.loadPlanConvert(this.lineCode);
this.$store.dispatch('runPlan/clear').then(() => {
this.loadInitChart().then(() => {
if (this.$route.query.mapId) {

View File

@ -3,7 +3,7 @@
<menu-bar ref="menuBar" :plan-convert="PlanConvert" @dispatchDialog="dispatchDialog" />
<schedule
ref="schedule"
:skin-code="skinCode"
:line-code="lineCode"
:plan-convert="PlanConvert"
:max-height="height"
:max-width="width"
@ -91,8 +91,8 @@ export default {
};
},
computed: {
skinCode() {
return this.$route.query.skinCode || '02';
lineCode() {
return this.$route.query.lineCode || '02';
},
width() {
return this.$store.state.app.width;
@ -102,7 +102,7 @@ export default {
}
},
created() {
this.PlanConvert = this.$theme.loadPlanConvert(this.skinCode);
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
},
methods: {
setPosition() {

View File

@ -237,7 +237,7 @@ export default {
const room = this.room;
await putJointTrainingSimulationEntrance(room.group);
const rest = await getPublishMapInfo(room.mapId);
const query = { skinCode: rest.data.lineCode, mapId: room.mapId, group: room.group, subSystem: this.$route.query.subSystem };
const query = { lineCode: rest.data.lineCode, mapId: room.mapId, group: room.group, subSystem: this.$route.query.subSystem };
this.$router.replace({ path: `/jointTraining`, query: query });
launchFullscreen();
//