Merge remote-tracking branch 'remotes/origin/test_cx' into test

This commit is contained in:
joylink_cuiweidong 2021-07-02 13:45:32 +08:00
commit 6ddee3ac9d
9 changed files with 395 additions and 166 deletions

View File

@ -52,6 +52,8 @@ class EqualRatioParser {
/** 如果车次号为空,不显示名称*/
if (train.tripNumber) {
// 如果不是被删除的首个车次
if (!train.firstInvalid) {
/** 创建标记点名称和坐标*/
// pointdata.name = `${service.serviceNumber}${train.directionCode}${train.tripNumber}`;
pointdata.name = `${service.serviceNumber}${train.tripNumber}`;
@ -61,13 +63,15 @@ class EqualRatioParser {
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));
}
/** 创建服务号名称*/
opt.name = `${service.serviceNumber}`;
}
if (!train.firstInvalid) {
/** 计算非折返点车次点坐标集合*/
train.stationTimeList.forEach((elem, index) => {
idx = index;
@ -78,6 +82,20 @@ class EqualRatioParser {
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) {

View File

@ -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);
}
});
},

View File

@ -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,6 +246,8 @@ export default {
}
},
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,
@ -260,6 +321,8 @@ export default {
});
}
});
}
});
},
computedTimeByString(timeStr) {
const bTime = +new Date(`2019-01-01 00:00:00`);

View 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>

View File

@ -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.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);
} else if (tripNumberData.invalid) {
// 删除计划
if (tripNumberData.firstInvalid) {
// 删除的第一条数据处理
} else {
}
}
});
// 删除 刷新 绘制
// 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);

View File

@ -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,6 +523,7 @@ export default {
axisTooltip(param) {
const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' };
if (this.$route.query.lineCode !== '07') {
if (station.name) {
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
@ -531,6 +531,10 @@ export default {
`到站时间: ${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 => {
markPoint.data.forEach((each, index) => {
if (each.symbol == 'circle') {
markPoint.data.splice(index, 1);
} else {
each.label.color = '#f00';
}
});
data = this.seriesMap[serviceNumber].data;
}

View File

@ -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(() => {

View File

@ -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);

View File

@ -490,6 +490,7 @@ export default {
axisTooltip(param) {
const station = (this.$store.getters['map/getDeviceByCode'](param.data[2])) || { name: '', kmRange: '' };
if (this.$route.query.lineCode !== '07') {
if (station.name) {
return [
`Point Data <hr size=1 style=" margin: 3px 0">`,
`车站名称: ${station.name}<br>`,
@ -497,6 +498,10 @@ export default {
`到站时间: ${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=>{
markPoint.data.forEach((each, index)=>{
if (each.symbol == 'circle') {
markPoint.data.splice(index, 1);
} else {
each.label.color = '#f00';
}
});
data = item.data;
}