Merge remote-tracking branch 'remotes/origin/test_cx' into test
This commit is contained in:
commit
6ddee3ac9d
@ -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,7 @@
|
||||
<train-delete ref="trainDelete" />
|
||||
<manage-user ref="manageUser" />
|
||||
<help-about ref="helpAbout" />
|
||||
<delete-runplan-line ref="deleteRunplanLine" />
|
||||
<add-runplan-line ref="addRunplanLine" />
|
||||
</div>
|
||||
</template>
|
||||
@ -32,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 {
|
||||
@ -48,7 +50,8 @@ export default {
|
||||
TrainTranstalet,
|
||||
TrainDelete,
|
||||
ManageUser,
|
||||
HelpAbout
|
||||
HelpAbout,
|
||||
DeleteRunplanLine
|
||||
},
|
||||
props: {
|
||||
selected: {
|
||||
@ -434,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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -13,11 +13,11 @@
|
||||
<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" />
|
||||
<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" />
|
||||
<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>
|
||||
@ -30,7 +30,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="routeCode">
|
||||
<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
|
||||
@ -90,15 +90,9 @@ export default {
|
||||
startTbFront: null,
|
||||
endTbFront: null
|
||||
}
|
||||
// planId: "472"
|
||||
|
||||
// routingCode
|
||||
// startTbFront
|
||||
// endTbFront
|
||||
// arriveConfigList
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
// rules: {
|
||||
// }
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -115,10 +109,43 @@ export default {
|
||||
return this.dialogShow ? OperationEvent.Command.planTrain.addPlanTrain.domId : '';
|
||||
},
|
||||
title() {
|
||||
return this.$t('menu.menuDialog.addPlanTrain');
|
||||
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() {
|
||||
@ -166,10 +193,42 @@ export default {
|
||||
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');
|
||||
@ -187,76 +246,80 @@ export default {
|
||||
}
|
||||
},
|
||||
commit() {
|
||||
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;
|
||||
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
|
||||
}] };
|
||||
//
|
||||
// // 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;
|
||||
// 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);
|
||||
if (this.group) {
|
||||
sendCommandNew(this.group, 'RunPlan_Add_Trip', runplanLine).then((response) => {
|
||||
this.$message.success('添加计划车成功');
|
||||
this.doClose();
|
||||
// 重新加载 仿真运行图
|
||||
}).catch(error => {
|
||||
this.$messageBox('添加计划车失败:' + error.$message);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
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,10 @@ const runPlan = {
|
||||
state.planLoadedCount++;
|
||||
}
|
||||
},
|
||||
setUpdateTrainRpData: (state, updateTrainRpData) => {
|
||||
state.updateTrainRpData = updateTrainRpData;
|
||||
},
|
||||
|
||||
updateTrainRunplan:(state, updateServiceNumber) => {
|
||||
const dataList = updateServiceNumber.serviceNumberDataList;
|
||||
const length = dataList.length;
|
||||
@ -84,7 +89,7 @@ const runPlan = {
|
||||
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);
|
||||
@ -96,54 +101,32 @@ const runPlan = {
|
||||
} else {
|
||||
// 原始计划存在
|
||||
tripNumberDataList.forEach(tripNumberData=>{
|
||||
if (tripNumberData.add) {
|
||||
// 添加计划
|
||||
state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData);
|
||||
serviceObj.tripNumberDataList.push(tripNumberData);
|
||||
} else if (tripNumberData.invalid) {
|
||||
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 (tripNumberData.invalid) {
|
||||
// if (tripNumberData.firstInvalid) {
|
||||
// } else {
|
||||
// // delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber];
|
||||
// }
|
||||
// } else {
|
||||
// }
|
||||
// 处理所有的车次号删除
|
||||
if (serviceObj.tripNumberDataList.length == 1 && serviceObj.tripNumberDataList[0].firstInvalid) {
|
||||
delete state.editData[serviceNumber];
|
||||
}
|
||||
}
|
||||
// if (tripNumberDataList.length > 0) {
|
||||
// tripNumberDataList.forEach(tripNumberData=>{
|
||||
// if (tripNumberData.add) {
|
||||
// const trainLength = Object.keys(state.initialPlanData[serviceNumber].trainMap).length;
|
||||
// state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber] = {
|
||||
// directionCode:tripNumberData.directionCode,
|
||||
// endSecondTime:tripNumberData.endSecondTime,
|
||||
// endSectionCode:tripNumberData.endSectionCode,
|
||||
// oldIndex:trainLength,
|
||||
// right:tripNumberData.right,
|
||||
// reentry: tripNumberData.reentry,
|
||||
// startSecondTime:tripNumberData.startSecondTime,
|
||||
// startSectionCode:tripNumberData.startSectionCode,
|
||||
// stationTimeList:tripNumberData.stationTimeList,
|
||||
// tripNumber:tripNumberData.tripNumber
|
||||
// };
|
||||
// } else if (tripNumberData.invalid) {
|
||||
// if (tripNumberData.firstInvalid) {
|
||||
// // 处理被删除的前一段的最后一个点的问题
|
||||
// // state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber]
|
||||
// } else {
|
||||
// delete state.initialPlanData[serviceNumber].trainMap[tripNumberData.tripNumber];
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
});
|
||||
}
|
||||
state.planLoadedCount++;
|
||||
@ -218,6 +201,10 @@ const runPlan = {
|
||||
updateTrainRunplan: ({ commit }, updateServiceNumber) => {
|
||||
commit('updateTrainRunplan', updateServiceNumber);
|
||||
},
|
||||
/** 设置需要更新的仿真运行图数据 (西安三加线抽线逻辑) */
|
||||
setUpdateTrainRpData: ({ commit }, updateTrainRpData) => {
|
||||
commit('setUpdateTrainRpData', updateTrainRpData);
|
||||
},
|
||||
/** 选择车次*/
|
||||
setSelected: ({ commit }, selected) => {
|
||||
commit('setSelected', selected);
|
||||
|
@ -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 = [];
|
||||
});
|
||||
@ -246,7 +246,6 @@ export default {
|
||||
this.staticSeries = [];
|
||||
const stations = this.$store.state.runPlan.stations;
|
||||
const planData = this.$store.state.runPlan.planData;
|
||||
debugger;
|
||||
this.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
|
||||
if (this.$route.query.lineCode === '07') {
|
||||
this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]);
|
||||
@ -524,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>`,
|
||||
@ -559,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;
|
||||
}
|
||||
|
@ -146,14 +146,12 @@ export default {
|
||||
// this.loadRunData();
|
||||
// },
|
||||
'$store.state.training.subscribeCount': function () {
|
||||
debugger;
|
||||
this.loadRunData();
|
||||
},
|
||||
'$store.state.socket.simulationPlanChange': function (val) {
|
||||
// debugger;
|
||||
// 判断是否已经加载运行图,若加载只处理运行图数据,否则,缓存数据
|
||||
if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') {
|
||||
|
||||
this.$store.dispatch('runPlan/setUpdateTrainRpData', val);
|
||||
} else {
|
||||
this.$store.dispatch('runPlan/updateTrainRunplan', val);
|
||||
}
|
||||
@ -163,6 +161,9 @@ export default {
|
||||
},
|
||||
'$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;
|
||||
@ -183,7 +184,6 @@ export default {
|
||||
// 获取排序的车站列表
|
||||
getByGroupStationList(this.group).then(response => {
|
||||
this.$store.dispatch('runPlan/setStations', response.data).then(() => {
|
||||
debugger;
|
||||
loadRunPlanData(this.group, this.dataError);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
@ -116,7 +116,6 @@ export default {
|
||||
});
|
||||
},
|
||||
async subscribe() {
|
||||
debugger;
|
||||
this.clearSubscribe();
|
||||
const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
||||
|
@ -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