Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
4f844f3242
@ -148,6 +148,14 @@ export function listUserRoutingData(mapId) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据目的地码查询用户交路数据(新版) */
|
||||
export function getUserRoutingDataByDes(mapId, destinationCode) {
|
||||
return request({
|
||||
url: `/api/runPlan/userData/${mapId}/routing/select?destinationCode=${destinationCode}`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
|
||||
/** 根据交路查询交路区段列表*/
|
||||
export function querySectionListByRouting(routingCode) {
|
||||
return request({
|
||||
|
@ -52,32 +52,50 @@ class EqualRatioParser {
|
||||
|
||||
/** 如果车次号为空,不显示名称*/
|
||||
if (train.tripNumber) {
|
||||
/** 创建标记点名称和坐标*/
|
||||
// pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`;
|
||||
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
|
||||
pointdata.color = '#000' || lineStyle.color;
|
||||
pointdata.directionCode = train.right ? '2' : '1';
|
||||
if (!store.state.map.mapConfig.upRight) {
|
||||
pointdata.directionCode = train.right ? '1' : '2';
|
||||
// 如果不是被删除的首个车次
|
||||
if (!train.firstInvalid) {
|
||||
/** 创建标记点名称和坐标*/
|
||||
// pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`;
|
||||
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
|
||||
pointdata.color = '#000' || lineStyle.color;
|
||||
pointdata.directionCode = train.right ? '2' : '1';
|
||||
if (!store.state.map.mapConfig.upRight) {
|
||||
pointdata.directionCode = train.right ? '1' : '2';
|
||||
}
|
||||
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[1], pointdata.directionCode, false)];
|
||||
/** 给服务对象添加服务名称和标记点*/
|
||||
opt.markPointData.push(this.__createMartPoint(pointdata));
|
||||
}
|
||||
pointdata.coord = [train.stationTimeList[1].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[1], pointdata.directionCode, false)];
|
||||
|
||||
/** 给服务对象添加服务名称和标记点*/
|
||||
opt.markPointData.push(this.__createMartPoint(pointdata));
|
||||
/** 创建服务号名称*/
|
||||
opt.name = `${service.serviceNumber}`;
|
||||
}
|
||||
|
||||
/** 计算非折返点车次点坐标集合*/
|
||||
train.stationTimeList.forEach((elem, index) => {
|
||||
idx = index;
|
||||
// if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode ||
|
||||
// index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime ||
|
||||
// index > 0 && index < train.stationTimeList.length - 1) {
|
||||
const aa = `${train.tripNumber}`;
|
||||
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]);
|
||||
if (!train.firstInvalid) {
|
||||
/** 计算非折返点车次点坐标集合*/
|
||||
train.stationTimeList.forEach((elem, index) => {
|
||||
idx = index;
|
||||
// if (index == 0 && train.stationTimeList[index].stationCode != train.stationTimeList[index + 1].stationCode ||
|
||||
// index == train.stationTimeList.length - 2 && train.stationTimeList[index].secondTime != train.stationTimeList[index + 1].secondTime ||
|
||||
// index > 0 && index < train.stationTimeList.length - 1) {
|
||||
const aa = `${train.tripNumber}`;
|
||||
opt.data.push([elem.secondTime, this.getCoordYByElem(stations, kmRangeMap, elem, pointdata.directionCode, false), elem.stationCode, aa]);
|
||||
// }
|
||||
});
|
||||
});
|
||||
} else {
|
||||
const deletePoint = {
|
||||
symbol:'circle',
|
||||
name:'breakPoint',
|
||||
symbolSize:10,
|
||||
itemStyle:{
|
||||
color:'#FF5A3B'
|
||||
},
|
||||
coord: [train.stationTimeList[0].secondTime, this.getCoordYByElem(stations, kmRangeMap, train.stationTimeList[0], pointdata.directionCode, false)]
|
||||
};
|
||||
/** 给服务对象添加服务名称和标记点*/
|
||||
// this.__createMartPoint(deletePoint)
|
||||
opt.markPointData.push(deletePoint);
|
||||
}
|
||||
|
||||
/** 计算折返点车次坐标点集合*/
|
||||
if (!train.backup && train.reentry && service.tripNumberDataList[j + 1] && service.tripNumberDataList[j + 1].stationTimeList) {
|
||||
|
@ -15,6 +15,8 @@
|
||||
<train-delete ref="trainDelete" />
|
||||
<manage-user ref="manageUser" />
|
||||
<help-about ref="helpAbout" />
|
||||
<delete-runplan-line ref="deleteRunplanLine" />
|
||||
<add-runplan-line ref="addRunplanLine" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -22,6 +24,7 @@ import MenuBar from '@/jmapNew/theme/components/menus/menuBar';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler.js';
|
||||
import StationControlConvert from './menuDialog/stationControlConvert';
|
||||
import TrainAdd from './menuDialog/trainAdd';
|
||||
import AddRunplanLine from './menuDialog/addRunplanLine';
|
||||
import TrainTranstalet from './menuDialog/trainTranstalet';
|
||||
import TrainDelete from './menuDialog/trainDelete';
|
||||
import PasswordBox from './menuDialog/passwordBox';
|
||||
@ -30,6 +33,7 @@ import ViewName from './menuDialog/viewName';
|
||||
import ViewDevice from './menuDialog/viewDevice';
|
||||
import ManageUser from './menuDialog/manageUser';
|
||||
import HelpAbout from './menuDialog/helpAbout';
|
||||
import DeleteRunplanLine from './menuDialog/deleteRunplanLine';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
@ -42,10 +46,12 @@ export default {
|
||||
ViewName,
|
||||
ViewDevice,
|
||||
TrainAdd,
|
||||
AddRunplanLine,
|
||||
TrainTranstalet,
|
||||
TrainDelete,
|
||||
ManageUser,
|
||||
HelpAbout
|
||||
HelpAbout,
|
||||
DeleteRunplanLine
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -403,7 +409,11 @@ export default {
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.trainAdd.doShow(operate);
|
||||
if (this.$route.query.lineCode == '10') {
|
||||
this.$refs.trainAdd.doShow(operate);
|
||||
} else {
|
||||
this.$refs.addRunplanLine.doShow(operate);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -427,7 +437,8 @@ export default {
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
|
||||
this.$refs.trainDelete.doShow(operate);
|
||||
// this.$refs.trainDelete.doShow(operate);
|
||||
this.$refs.deleteRunplanLine.doShow(operate);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
377
src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue
Normal file
377
src/jmapNew/theme/xian_01/menus/menuDialog/addRunplanLine.vue
Normal file
@ -0,0 +1,377 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
class="xian-01__systerm stand-stop-time"
|
||||
:title="title"
|
||||
:visible.sync="show"
|
||||
width="430px"
|
||||
:before-close="doClose"
|
||||
:z-index="2000"
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form ref="form" size="small" label-width="100px" :model="addModel" :rules="rules">
|
||||
<el-form-item prop="serviceNumber">
|
||||
<span id="rpServiceNumber" slot="label">表号: </span>
|
||||
<el-input v-model="addModel.serviceNumber" style="width:260px" maxlength="2" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="tripNumber">
|
||||
<span id="rpTripNumber" slot="label">车次号: </span>
|
||||
<el-input v-model="addModel.tripNumber" style="width:260px" maxlength="4" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="destinationCode">
|
||||
<span id="rpDestinationCode" slot="label">目的地码: </span>
|
||||
<el-select ref="destinationCode" v-model="addModel.destinationCode" filterable :placeholder="$t('menu.menuDialog.pleaseSelect')" style="width:260px" @change="changeDestination">
|
||||
<el-option
|
||||
v-for="item in destinationCodeList"
|
||||
:key="item.code"
|
||||
:label="item.code"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="routing">
|
||||
<span slot="label">交路: </span>
|
||||
<el-select ref="routing" v-model="addModel.routing" value-key="id" filterable :placeholder="$t('menu.menuDialog.pleaseSelect')" style="width:260px">
|
||||
<el-option
|
||||
v-for="item in routeList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="startTime">
|
||||
<span slot="label">开始时间: </span>
|
||||
<el-time-picker ref="startTime" v-model="addModel.startTime" size="small" value-format="HH:mm:ss" :clearable="false" :picker-options="{selectableRange:'02:00:00-23:59:59'}" style="width:260px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row justify="center" class="button-group">
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button :id="domIdConfirm" type="primary" :loading="loading" @click="commit">{{ $t('menu.menuDialog.confirm') }}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button :id="domIdCancel" @click="cancel">{{ $t('menu.menuDialog.cancel') }}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';
|
||||
import {getUserRoutingDataByDes, querySectionListByRouting, getMapStationRunUser, getStationStopTime} from '@/api/runplan';
|
||||
import { getRunplanConfig } from '@/api/jmap/mapdraft';
|
||||
import { formatTime } from '@/jmapNew/theme/parser/util';
|
||||
import { sendCommandNew } from '@/api/jmap/training';
|
||||
export default {
|
||||
name:'AddRunplanLine',
|
||||
data() {
|
||||
return {
|
||||
dialogShow:false,
|
||||
loading:false,
|
||||
operate: null,
|
||||
operation:'',
|
||||
destinationCodeList:[],
|
||||
routeList:[],
|
||||
stopStationMap:{},
|
||||
stopTimeMap:{},
|
||||
reentryData: {},
|
||||
addModel:{
|
||||
serviceNumber:'',
|
||||
tripNumber:'',
|
||||
destinationCode:'',
|
||||
startTime:'',
|
||||
routing:{
|
||||
startStationCode:'',
|
||||
endStationCode:'',
|
||||
endSectionCode:'',
|
||||
startSectionCode:'',
|
||||
id:'',
|
||||
startTbFront: null,
|
||||
endTbFront: null
|
||||
}
|
||||
}
|
||||
// rules: {
|
||||
// }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('map', [
|
||||
'sectionList'
|
||||
]),
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
},
|
||||
domIdCancel() {
|
||||
return this.dialogShow ? OperationEvent.Command.cancel.menu.domId : '';
|
||||
},
|
||||
domIdConfirm() {
|
||||
return this.dialogShow ? OperationEvent.Command.planTrain.addPlanTrain.domId : '';
|
||||
},
|
||||
title() {
|
||||
return '加线';
|
||||
// this.$t('menu.menuDialog.addPlanTrain')
|
||||
},
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
rules() {
|
||||
const validateRouting = (rule, value, callback) => {
|
||||
if (value && value.id != '') {
|
||||
return callback();
|
||||
} else {
|
||||
return callback(new Error('请选择交路'));
|
||||
}
|
||||
};
|
||||
|
||||
const crules = {
|
||||
serviceNumber: [
|
||||
{ required: true, trigger: 'blur', validator:this.validateService}
|
||||
// message: '请输入表号',
|
||||
],
|
||||
tripNumber: [
|
||||
{ required: true, message: '请输入车次号', trigger: 'blur' }
|
||||
],
|
||||
destinationCode:[
|
||||
{ required: true, message: '请选择目的地码', trigger: 'blur' },
|
||||
{ required: true, message: '请选择目的地码', trigger: 'change' }
|
||||
],
|
||||
routing:[
|
||||
{ required: true, validator: validateRouting, trigger: 'blur' },
|
||||
{ required: true, validator: validateRouting, trigger: 'change' }
|
||||
],
|
||||
startTime:[
|
||||
{ required: true, message: '请选择开始时间', trigger: 'blur' },
|
||||
{ required: true, message: '请选择开始时间', trigger: 'change' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const destinationList = this.sectionList.filter(section=>{
|
||||
return section.destinationCode != '' && section.destinationCode != undefined;
|
||||
});
|
||||
this.destinationCodeList = destinationList.map(section=>{
|
||||
const destination = {};
|
||||
destination['code'] = section.destinationCode;
|
||||
return destination;
|
||||
});
|
||||
const mapId = this.$route.query.mapId;
|
||||
const that = this;
|
||||
if (mapId) {
|
||||
getMapStationRunUser(mapId).then(resp =>{
|
||||
const list = resp.data.list;
|
||||
list.forEach(elem => {
|
||||
that.stopStationMap[[elem.startSectionCode, elem.endSectionCode].toString()] = elem;
|
||||
});
|
||||
getStationStopTime(mapId).then(response=>{
|
||||
const stopTimeList = response.data.list;
|
||||
stopTimeList.forEach(element=>{
|
||||
that.stopTimeMap[element.stationCode] = {parkingTime:element.parkingTime};
|
||||
});
|
||||
getRunplanConfig(mapId).then(resp => {
|
||||
const data = resp.data;
|
||||
this.reentryData = data.config.reentryData;
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
methods:{
|
||||
doShow(operate) {
|
||||
this.operate = operate || {};
|
||||
this.operation = operate.operation;
|
||||
|
||||
if (!this.dialogShow) {
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
this.dialogShow = true;
|
||||
this.$nextTick(function () {
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
});
|
||||
},
|
||||
validateService (rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请输入表号'));
|
||||
} else {
|
||||
let newValue = parseInt(value);
|
||||
if (newValue) {
|
||||
if (newValue > 0 & newValue < 9) {
|
||||
newValue = '0' + newValue;
|
||||
}
|
||||
this.addModel.serviceNumber = newValue;
|
||||
return callback();
|
||||
} else {
|
||||
this.addModel.serviceNumber = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
doClose() {
|
||||
this.$refs['routing'].blur();
|
||||
this.$refs['destinationCode'].blur();
|
||||
this.$refs['startTime'].hidePicker();
|
||||
this.$refs['form'].resetFields();
|
||||
this.addModel = {
|
||||
serviceNumber:'',
|
||||
tripNumber:'',
|
||||
destinationCode:'',
|
||||
startTime:'',
|
||||
routing:{
|
||||
startStationCode:'',
|
||||
endStationCode:'',
|
||||
endSectionCode:'',
|
||||
startSectionCode:'',
|
||||
id:'',
|
||||
startTbFront: null,
|
||||
endTbFront: null
|
||||
}
|
||||
},
|
||||
this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.$store.dispatch('training/emitTipFresh');
|
||||
},
|
||||
changeDestination(destinationCode) {
|
||||
this.addModel.routing = {};
|
||||
const mapId = this.$route.query.mapId;
|
||||
if (mapId) {
|
||||
getUserRoutingDataByDes(mapId, destinationCode).then(resp => {
|
||||
this.routeList = resp.data;
|
||||
}).catch((error) => {
|
||||
this.routeList = [];
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
commit() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const runplanLine = {serviceNumber:this.addModel.serviceNumber, tripConfigList:[{
|
||||
startStationCode:this.addModel.routing.startStationCode,
|
||||
endStationCode:this.addModel.routing.endStationCode,
|
||||
endSectionCode:this.addModel.routing.endSectionCode,
|
||||
startSectionCode:this.addModel.routing.startSectionCode,
|
||||
routingCode:this.addModel.routing.id,
|
||||
id:1,
|
||||
tripNumber:this.addModel.tripNumber,
|
||||
startTime:this.addModel.startTime
|
||||
}] };
|
||||
//
|
||||
// startTbFront
|
||||
// startTbFront
|
||||
// endTbFront
|
||||
const arriveConfigList = [];
|
||||
const that = this;
|
||||
querySectionListByRouting(that.addModel.routing.id).then(resp=>{
|
||||
const length = resp.data.length - 1;
|
||||
resp.data.forEach((parkSectionCode, index)=>{
|
||||
const arriveConfig = {arriveTime:'', departureTime:'', sectionCode:parkSectionCode.sectionCode, stationCode:parkSectionCode.stationCode};
|
||||
const prev = arriveConfigList[index - 1];
|
||||
const reentryData = that.reentryData[parkSectionCode.stationCode] || {};
|
||||
if (index == 0) {
|
||||
arriveConfig.departureTime = that.addModel.startTime;
|
||||
} else if (index < length) {
|
||||
if (String(that.addModel.routing.startTbFront) == 'false' && index == 1) {
|
||||
// const reentryData = that.reentryData[parkSectionCode.stationCode] || {};
|
||||
arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0));
|
||||
} else {
|
||||
const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {};
|
||||
arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0));
|
||||
}
|
||||
const nowParking = that.stopTimeMap[parkSectionCode.stationCode] || {};
|
||||
arriveConfig.departureTime = formatTime(this.computedTimeByString(arriveConfig.arriveTime) / 1000 + nowParking.parkingTime || 0 );
|
||||
} else {
|
||||
if (String(that.addModel.routing.endTbFront) == 'false') {
|
||||
// const reentryData = that.reentryData[parkSectionCode.stationCode] || {};
|
||||
arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (reentryData.tbTo || 0));
|
||||
} else {
|
||||
const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || {};
|
||||
arriveConfig.arriveTime = formatTime(this.computedTimeByString(prev.departureTime) / 1000 + (runLevel.l3 || 0));
|
||||
}
|
||||
arriveConfig.departureTime = '';
|
||||
}
|
||||
// if (index == 0) {
|
||||
// arriveConfig.departureTime = that.addModel.startTime;
|
||||
// } else if (index < resp.data.length - 1) {
|
||||
// const prev = arriveConfigList[index - 1];
|
||||
// // startSectionCode;
|
||||
// // endSectionCode;
|
||||
// const runLevel = that.stopStationMap[[prev.sectionCode, parkSectionCode.sectionCode].toString()] || 0;
|
||||
// arriveConfig.arriveTime = prev.departureTime + that.stopTimeMap[prev.stationCode] || 0 + runLevel ? runLevel.l3 : 0;
|
||||
//
|
||||
// // elem.stopTime = this.stopTimeMap[elem.stationCode].parkingTime;
|
||||
// } else {
|
||||
// arriveConfig.arriveTime = '';
|
||||
// }
|
||||
// { }
|
||||
arriveConfigList.push(arriveConfig);
|
||||
});
|
||||
runplanLine.tripConfigList[0].arriveConfigList = arriveConfigList;
|
||||
runplanLine.tripConfigList[0].endTime = arriveConfigList[arriveConfigList.length - 1].arriveTime;
|
||||
|
||||
if (this.group) {
|
||||
sendCommandNew(this.group, 'RunPlan_Add_Trip', runplanLine).then((response) => {
|
||||
this.$message.success('添加计划车成功');
|
||||
this.doClose();
|
||||
// 重新加载 仿真运行图
|
||||
}).catch(error => {
|
||||
this.$messageBox('添加计划车失败:' + error.$message);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
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);
|
||||
},
|
||||
cancel() {
|
||||
const operate = {
|
||||
operation: OperationEvent.Command.cancel.menu.operation
|
||||
};
|
||||
|
||||
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
|
||||
if (valid) {
|
||||
this.doClose();
|
||||
}
|
||||
}).catch(() => { this.doClose(); });
|
||||
}
|
||||
|
||||
// serviceNumber: "001",
|
||||
// tripConfigList:[
|
||||
// {
|
||||
// arriveConfigList[]
|
||||
// {
|
||||
// arriveTime: "06:00:00"
|
||||
// departureTime: "06:00:00"
|
||||
// sectionCode: "T2"
|
||||
// speedLevel: "等级一"
|
||||
// speedLevelTime: 123
|
||||
// stationCode: "Station1478"
|
||||
// stopTime: 0
|
||||
// }
|
||||
|
||||
// startStationCode
|
||||
// endStationCode
|
||||
// endSectionCode
|
||||
// startSectionCode
|
||||
// endTime
|
||||
// id
|
||||
// routingCode: 3615
|
||||
// serviceNumber: "001"
|
||||
// startTime: "06:00:00"
|
||||
// tripNumber: ""
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.rpServiceNumber{}
|
||||
.rpTripNumber{}
|
||||
.rpDestinationCode{}
|
||||
</style>
|
141
src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue
Normal file
141
src/jmapNew/theme/xian_01/menus/menuDialog/deleteRunplanLine.vue
Normal file
@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-dialogDrag
|
||||
class="xian-01__systerm stand-stop-time"
|
||||
:title="title"
|
||||
:visible.sync="show"
|
||||
width="320px"
|
||||
:before-close="doClose"
|
||||
:z-index="2000"
|
||||
:modal="false"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
size="small"
|
||||
label-width="100px"
|
||||
:model="model"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-form-item prop="serviceNumber" label="表号">
|
||||
<el-input maxlength="2" v-model="model.serviceNumber" />
|
||||
</el-form-item>
|
||||
<el-form-item prop="tripNumber" label="车次号">
|
||||
<el-input maxlength="4" v-model="model.tripNumber" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row justify="center" class="button-group">
|
||||
<el-col :span="10" :offset="2">
|
||||
<el-button type="primary" :loading="loading" @click="commit">{{
|
||||
$t("menu.menuDialog.confirm")
|
||||
}}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="8" :offset="4">
|
||||
<el-button @click="doClose">{{
|
||||
$t("menu.menuDialog.cancel")
|
||||
}}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendCommandNew } from "@/api/jmap/training";
|
||||
export default {
|
||||
name: "DeleteRunplanLine",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
dialogShow: false,
|
||||
model: {
|
||||
serviceNumber: "",
|
||||
tripNumber: ""
|
||||
},
|
||||
rules: {
|
||||
serviceNumber: [
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
validator:this.validateService
|
||||
// message: "请输入表号"
|
||||
}
|
||||
],
|
||||
tripNumber: [
|
||||
{
|
||||
required: true,
|
||||
trigger: "blur",
|
||||
message: "请输入车次号"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return "抽线";
|
||||
},
|
||||
show() {
|
||||
return this.dialogShow && !this.$store.state.menuOperation.break;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow(operate) {
|
||||
// this.operate = operate || {};
|
||||
// this.operation = operate.operation;
|
||||
// // 非断电激活时设置初始值
|
||||
// if (!this.dialogShow) {
|
||||
// this.loading = false;
|
||||
// }
|
||||
this.dialogShow = true;
|
||||
this.$nextTick(function() {
|
||||
this.$store.dispatch("training/emitTipFresh");
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
// this.loading = false;
|
||||
this.dialogShow = false;
|
||||
this.$store.dispatch("training/emitTipFresh");
|
||||
},
|
||||
validateService (rule, value, callback) {
|
||||
if (typeof value == 'string' && value.trim().length == 0) {
|
||||
return callback(new Error('请输入表号'));
|
||||
} else {
|
||||
let newValue = parseInt(value);
|
||||
if (newValue) {
|
||||
if (newValue > 0 & newValue < 9) {
|
||||
newValue = '0' + newValue;
|
||||
}
|
||||
this.model.serviceNumber = newValue;
|
||||
return callback();
|
||||
} else {
|
||||
this.model.serviceNumber = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
commit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
const group = this.$route.query.group;
|
||||
const data = this.model;
|
||||
sendCommandNew(group, "RunPlan_Delete_Trip", data)
|
||||
.then(resp => {
|
||||
console.log(resp);
|
||||
this.$message.success('删除计划车成功');
|
||||
this.doClose();
|
||||
})
|
||||
.catch(e => {
|
||||
this.$messageBox(e);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"$store.state.runPlan": function(oldVal, newVal) {
|
||||
console.log(newVal);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
@ -16,7 +16,8 @@ const runPlan = {
|
||||
runPlanMap: {}, // 运行图数据map(以id和version 为标识)
|
||||
runPlanInfo: {}, // 运行图信息
|
||||
loadRunPlanCount: 0, // 运行图加载数据完成
|
||||
serviceNumberDataList: [] // 运行图数据
|
||||
serviceNumberDataList: [], // 运行图数据
|
||||
updateTrainRpData:{} // 更新仿真运行图数据
|
||||
},
|
||||
getters: {
|
||||
stations: (state) => {
|
||||
@ -75,6 +76,67 @@ const runPlan = {
|
||||
state.planLoadedCount++;
|
||||
}
|
||||
},
|
||||
setUpdateTrainRpData: (state, updateTrainRpData) => {
|
||||
state.updateTrainRpData = updateTrainRpData;
|
||||
},
|
||||
|
||||
updateTrainRunplan:(state, updateServiceNumber) => {
|
||||
const dataList = updateServiceNumber.serviceNumberDataList;
|
||||
const length = dataList.length;
|
||||
if (length > 0) {
|
||||
dataList.forEach(data=>{
|
||||
const {serviceNumber, tripNumberDataList} = data;
|
||||
const serviceNumberDataList = state.planData.serviceNumberDataList;
|
||||
const serviceObj = serviceNumberDataList.find(serviceNumberData=>{ return serviceNumberData.serviceNumber == serviceNumber; });
|
||||
if (!serviceObj) {
|
||||
// 原始计划不存在 添加
|
||||
state.editData[serviceNumber] = { oldIndex: serviceNumberDataList.length, serviceNumber: serviceNumber, backup: undefined, trainMap: {}};
|
||||
tripNumberDataList.forEach(tripNumberData=>{
|
||||
state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:tripNumberDataList.length }, tripNumberData);
|
||||
});
|
||||
state.planData.serviceNumberDataList.push({
|
||||
serviceNumber: serviceNumber,
|
||||
tripNumberDataList:[...tripNumberDataList]
|
||||
});
|
||||
} else {
|
||||
// 原始计划存在
|
||||
tripNumberDataList.forEach(tripNumberData=>{
|
||||
if (tripNumberData.invalid) {
|
||||
// 删除计划
|
||||
const index = serviceObj.tripNumberDataList.findIndex(tripNumberInfo=>{ return tripNumberInfo.tripNumber == tripNumberData.tripNumber; });
|
||||
if (tripNumberData.firstInvalid) {
|
||||
// 删除的第一条数据处理
|
||||
serviceObj.tripNumberDataList[index].stationTimeList.splice(1, tripNumberData.stationTimeList.length - 1);
|
||||
serviceObj.tripNumberDataList[index].firstInvalid = tripNumberData.firstInvalid;
|
||||
delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber];
|
||||
// state.editData[serviceNumber].trainMap[tripNumberData.tripNumber].stationTimeList.splice(1, tripNumberData.stationTimeList.length - 1);
|
||||
} else {
|
||||
serviceObj.tripNumberDataList.splice(index, 1);
|
||||
delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber];
|
||||
}
|
||||
} else {
|
||||
if (tripNumberData.add) {
|
||||
// 添加计划
|
||||
state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData);
|
||||
serviceObj.tripNumberDataList.push(tripNumberData);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 处理所有的车次号删除
|
||||
if (serviceObj.tripNumberDataList.length == 1 && serviceObj.tripNumberDataList[0].firstInvalid) {
|
||||
delete state.editData[serviceNumber];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
state.planLoadedCount++;
|
||||
// const serviceObj = state.planData[serviceNumber];
|
||||
// if (serviceObj) {
|
||||
// const oldIndex = serviceObj.oldIndex;
|
||||
// state.planData[serviceNumber] = { oldIndex, serviceNumber, trainMap: {} };
|
||||
// state.planLoadedCount++;
|
||||
// }
|
||||
},
|
||||
clear: (state) => {
|
||||
// state.stations = [];
|
||||
state.planData = {};
|
||||
@ -135,6 +197,14 @@ const runPlan = {
|
||||
addServiceNumber: ({ commit }, serviceNumber) => {
|
||||
commit('addServiceNumber', serviceNumber);
|
||||
},
|
||||
/** 更新仿真里的运行图(西安三加线抽线逻辑) */
|
||||
updateTrainRunplan: ({ commit }, updateServiceNumber) => {
|
||||
commit('updateTrainRunplan', updateServiceNumber);
|
||||
},
|
||||
/** 设置需要更新的仿真运行图数据 (西安三加线抽线逻辑) */
|
||||
setUpdateTrainRpData: ({ commit }, updateTrainRpData) => {
|
||||
commit('setUpdateTrainRpData', updateTrainRpData);
|
||||
},
|
||||
/** 选择车次*/
|
||||
setSelected: ({ commit }, selected) => {
|
||||
commit('setSelected', selected);
|
||||
|
@ -192,6 +192,10 @@ function handle(state, data) {
|
||||
case 'Simulation_PslStatus':
|
||||
state.simulationPslStatus = msg;
|
||||
break;
|
||||
// 运行图加线/抽线/变化推送消息
|
||||
case 'Simulation_Trip_Plan_Change':
|
||||
state.simulationPlanChange = msg;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -337,7 +341,8 @@ const socket = {
|
||||
deviceStateMessages: null, // 新版订阅设备状态消息
|
||||
simulationSpeed: 1, // 仿真倍速
|
||||
simulationPause: false,
|
||||
simulationPslStatus: [], //PSL面板按钮状态信息
|
||||
simulationPslStatus: [], // PSL面板按钮状态信息
|
||||
simulationPlanChange:{} // 运行图加线/抽线/变化推送消息
|
||||
},
|
||||
getters: {
|
||||
},
|
||||
|
@ -157,7 +157,7 @@ export default {
|
||||
mounted() {
|
||||
this.staticSeries = []; this.selectSeries = []; this.runSeries = []; this.runPlanData = {};
|
||||
this.PlanParser = this.$theme.loadPlanParser(this.$route.query.lineCode);
|
||||
this.loadChartPage();
|
||||
// this.loadChartPage();
|
||||
EventBus.$on('clearRunSeries', () => {
|
||||
this.runSeries = [];
|
||||
});
|
||||
@ -523,13 +523,18 @@ export default {
|
||||
axisTooltip(param) {
|
||||
const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' };
|
||||
if (this.$route.query.lineCode !== '07') {
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
`车站公里标: ${station.kmRange} km <br>`,
|
||||
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
|
||||
].join('');
|
||||
if (station.name) {
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
`车站公里标: ${station.kmRange} km <br>`,
|
||||
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
|
||||
].join('');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
@ -558,8 +563,12 @@ export default {
|
||||
}
|
||||
} else if (this.seriesMap[serviceNumber]) {
|
||||
markPoint = deepAssign({}, this.seriesMap[serviceNumber].markPoint);
|
||||
markPoint.data.forEach(each => {
|
||||
each.label.color = '#f00';
|
||||
markPoint.data.forEach((each, index) => {
|
||||
if (each.symbol == 'circle') {
|
||||
markPoint.data.splice(index, 1);
|
||||
} else {
|
||||
each.label.color = '#f00';
|
||||
}
|
||||
});
|
||||
data = this.seriesMap[serviceNumber].data;
|
||||
}
|
||||
|
@ -142,14 +142,28 @@ export default {
|
||||
this.swch = '01';
|
||||
}
|
||||
},
|
||||
'$store.state.map.mapDataLoadedCount': function () {
|
||||
// '$store.state.map.mapDataLoadedCount': function () {
|
||||
// this.loadRunData();
|
||||
// },
|
||||
'$store.state.training.subscribeCount': function () {
|
||||
this.loadRunData();
|
||||
},
|
||||
'$store.state.socket.simulationPlanChange': function (val) {
|
||||
// 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据
|
||||
if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') {
|
||||
this.$store.dispatch('runPlan/setUpdateTrainRpData', val);
|
||||
} else {
|
||||
this.$store.dispatch('runPlan/updateTrainRunplan', val);
|
||||
}
|
||||
},
|
||||
'$store.state.training.triggerFaultCount': function () {
|
||||
this.setFault();
|
||||
},
|
||||
'$store.state.runPlan.loadRunPlanCount': function () {
|
||||
this.viewDisabled = false;
|
||||
if (JSON.stringify(this.$store.state.runPlan.updateTrainRpData) != '{}') {
|
||||
this.$store.dispatch('runPlan/updateTrainRunplan', this.$store.state.runPlan.updateTrainRpData);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.simulationSpeed': function (val) {
|
||||
this.speed = val;
|
||||
|
@ -490,13 +490,18 @@ export default {
|
||||
axisTooltip(param) {
|
||||
const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' };
|
||||
if (this.$route.query.lineCode !== '07') {
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
`车站公里标: ${station.kmRange} km <br>`,
|
||||
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
|
||||
].join('');
|
||||
if (station.name) {
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
`车站公里标: ${station.kmRange} km <br>`,
|
||||
`到站时间: ${timeFormat(param.data[0] + this.PlanParser.getTranslation())} (${param.data[0]})<br>`
|
||||
].join('');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
|
||||
return [
|
||||
`Point Data <hr size=1 style=" margin: 3px 0">`,
|
||||
`车站名称: ${station.name}<br>`,
|
||||
@ -525,8 +530,12 @@ export default {
|
||||
}
|
||||
} else {
|
||||
markPoint = deepAssign({}, item.markPoint);
|
||||
markPoint.data.forEach(each=>{
|
||||
each.label.color = '#f00';
|
||||
markPoint.data.forEach((each, index)=>{
|
||||
if (each.symbol == 'circle') {
|
||||
markPoint.data.splice(index, 1);
|
||||
} else {
|
||||
each.label.color = '#f00';
|
||||
}
|
||||
});
|
||||
data = item.data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user