西安三加线逻辑调整

This commit is contained in:
joylink_cuiweidong 2021-07-01 10:06:35 +08:00
parent 3992310427
commit c7e75739c3
8 changed files with 438 additions and 5 deletions

View File

@ -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) { export function querySectionListByRouting(routingCode) {
return request({ return request({

View File

@ -15,6 +15,7 @@
<train-delete ref="trainDelete" /> <train-delete ref="trainDelete" />
<manage-user ref="manageUser" /> <manage-user ref="manageUser" />
<help-about ref="helpAbout" /> <help-about ref="helpAbout" />
<add-runplan-line ref="addRunplanLine" />
</div> </div>
</template> </template>
<script> <script>
@ -22,6 +23,7 @@ import MenuBar from '@/jmapNew/theme/components/menus/menuBar';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler.js'; import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler.js';
import StationControlConvert from './menuDialog/stationControlConvert'; import StationControlConvert from './menuDialog/stationControlConvert';
import TrainAdd from './menuDialog/trainAdd'; import TrainAdd from './menuDialog/trainAdd';
import AddRunplanLine from './menuDialog/addRunplanLine';
import TrainTranstalet from './menuDialog/trainTranstalet'; import TrainTranstalet from './menuDialog/trainTranstalet';
import TrainDelete from './menuDialog/trainDelete'; import TrainDelete from './menuDialog/trainDelete';
import PasswordBox from './menuDialog/passwordBox'; import PasswordBox from './menuDialog/passwordBox';
@ -42,6 +44,7 @@ export default {
ViewName, ViewName,
ViewDevice, ViewDevice,
TrainAdd, TrainAdd,
AddRunplanLine,
TrainTranstalet, TrainTranstalet,
TrainDelete, TrainDelete,
ManageUser, ManageUser,
@ -403,7 +406,11 @@ export default {
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { this.$store.dispatch('training/nextNew', operate).then(({ valid }) => {
if (valid) { if (valid) {
this.$store.dispatch('menuOperation/handleBreakFlag', { break: true }); this.$store.dispatch('menuOperation/handleBreakFlag', { break: true });
if (this.$route.query.lineCode == '10') {
this.$refs.trainAdd.doShow(operate); this.$refs.trainAdd.doShow(operate);
} else {
this.$refs.addRunplanLine.doShow(operate);
}
} }
}); });
}, },

View File

@ -0,0 +1,314 @@
<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" />
</el-form-item>
<el-form-item prop="tripNumber">
<span id="rpTripNumber" slot="label">车次号: </span>
<el-input v-model="addModel.tripNumber" style="width:260px" />
</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="routeCode">
<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
}
// planId: "472"
// routingCode
// startTbFront
// endTbFront
// arriveConfigList
},
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;
}
},
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');
});
},
doClose() {
this.$refs['routing'].blur();
this.$refs['destinationCode'].blur();
this.$refs['startTime'].hidePicker();
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() {
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>

View File

@ -114,6 +114,85 @@ const runPlan = {
state.planLoadedCount++; state.planLoadedCount++;
} }
}, },
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.add) {
// 添加计划
state.editData[serviceNumber].trainMap[tripNumberData.tripNumber] = Object.assign({oldIndex:serviceObj.tripNumberDataList.length }, tripNumberData);
serviceObj.tripNumberDataList.push(tripNumberData);
} else if (tripNumberData.invalid) {
// 删除计划
if (tripNumberData.firstInvalid) {
// 删除的第一条数据处理
} else {
}
}
});
// 删除 刷新 绘制
// if (tripNumberData.invalid) {
// if (tripNumberData.firstInvalid) {
// } else {
// // delete state.editData[serviceNumber].trainMap[tripNumberData.tripNumber];
// }
// } else {
// }
}
// 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++;
// const serviceObj = state.planData[serviceNumber];
// if (serviceObj) {
// const oldIndex = serviceObj.oldIndex;
// state.planData[serviceNumber] = { oldIndex, serviceNumber, trainMap: {} };
// state.planLoadedCount++;
// }
},
clear: (state) => { clear: (state) => {
// state.stations = []; // state.stations = [];
state.planData = {}; state.planData = {};
@ -188,6 +267,10 @@ const runPlan = {
addServiceNumber: ({ commit }, serviceNumber) => { addServiceNumber: ({ commit }, serviceNumber) => {
commit('addServiceNumber', serviceNumber); commit('addServiceNumber', serviceNumber);
}, },
/** 更新仿真里的运行图(西安三加线抽线逻辑) */
updateTrainRunplan: ({ commit }, updateServiceNumber) => {
commit('updateTrainRunplan', updateServiceNumber);
},
/** 选择车次*/ /** 选择车次*/
setSelected: ({ commit }, selected) => { setSelected: ({ commit }, selected) => {
commit('setSelected', selected); commit('setSelected', selected);

View File

@ -192,6 +192,10 @@ function handle(state, data) {
case 'Simulation_PslStatus': case 'Simulation_PslStatus':
state.simulationPslStatus = msg; state.simulationPslStatus = msg;
break; break;
// 运行图加线/抽线/变化推送消息
case 'Simulation_Trip_Plan_Change':
state.simulationPlanChange = msg;
break;
} }
} }
@ -338,6 +342,7 @@ const socket = {
simulationSpeed: 1, // 仿真倍速 simulationSpeed: 1, // 仿真倍速
simulationPause: false, simulationPause: false,
simulationPslStatus: [], // PSL面板按钮状态信息 simulationPslStatus: [], // PSL面板按钮状态信息
simulationPlanChange:{} // 运行图加线/抽线/变化推送消息
}, },
getters: { getters: {
}, },

View File

@ -254,6 +254,7 @@ export default {
this.staticSeries = []; this.staticSeries = [];
const stations = this.$store.state.runPlan.stations; const stations = this.$store.state.runPlan.stations;
const planData = this.$store.state.runPlan.planData; const planData = this.$store.state.runPlan.planData;
debugger;
this.kmRangeMap = this.PlanParser.convertStationsToMap(stations); this.kmRangeMap = this.PlanParser.convertStationsToMap(stations);
if (this.$route.query.lineCode === '07') { if (this.$route.query.lineCode === '07') {
this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]); this.pushModels(this.staticSeries, [this.PlanParser.initializeAxisX(stations)]);

View File

@ -142,9 +142,22 @@ export default {
this.swch = '01'; this.swch = '01';
} }
}, },
'$store.state.map.mapDataLoadedCount': function () { // '$store.state.map.mapDataLoadedCount': function () {
// this.loadRunData();
// },
'$store.state.training.subscribeCount': function () {
debugger;
this.loadRunData(); this.loadRunData();
}, },
'$store.state.socket.simulationPlanChange': function (val) {
// debugger;
//
if (JSON.stringify(this.$store.state.runPlan.planData) == '{}') {
} else {
this.$store.dispatch('runPlan/updateTrainRunplan', val);
}
},
'$store.state.training.triggerFaultCount': function () { '$store.state.training.triggerFaultCount': function () {
this.setFault(); this.setFault();
}, },
@ -170,6 +183,7 @@ export default {
// //
getByGroupStationList(this.group).then(response => { getByGroupStationList(this.group).then(response => {
this.$store.dispatch('runPlan/setStations', response.data).then(() => { this.$store.dispatch('runPlan/setStations', response.data).then(() => {
debugger;
loadRunPlanData(this.group, this.dataError); loadRunPlanData(this.group, this.dataError);
}); });
}).catch(() => { }).catch(() => {

View File

@ -116,6 +116,7 @@ export default {
}); });
}, },
async subscribe() { async subscribe() {
debugger;
this.clearSubscribe(); this.clearSubscribe();
const header = { group: this.$route.query.group || '', 'X-Token': getToken() }; const header = { group: this.$route.query.group || '', 'X-Token': getToken() };
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header); creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);