绘图 交路添加 生成交路区段数据的接口

交路和运行等级代码调整
This commit is contained in:
joylink_cuiweidong 2020-04-30 10:07:44 +08:00
parent 70c26426b0
commit 7961c2c5f9
3 changed files with 78 additions and 26 deletions

View File

@ -281,6 +281,15 @@ export function getRoutingData(routingId) {
});
}
/** 生成交路区段数据(新版)*/
export function gernateRoutingSection(data) {
return request({
url: `/api/mapBuild/routingData/generate`,
method: 'PUT',
data: data
});
}
/** 更新交路(新版)*/
export function updateRoutingData(data) {
return request({

View File

@ -93,6 +93,7 @@
<!--<el-button :type=" field === 'routingSection' ? 'danger' : 'primary'" @click="hover('routingSection')">{{ $t('map.activate') }}</el-button>-->
<!--</el-form-item>-->
<el-form-item :label="$t('map.trafficSegmentData')" prop="parkSectionCodeList">
<el-button type="primary" size="small" :loading="generating" style="margin-bottom:10px" @click.native.prevent="generateParkSection">生成交路区段</el-button>
<el-table :data="addModel.parkSectionCodeList" border style="width: 97%">
<el-table-column prop="sectionCode" :label="$t('map.stationName')">
<template slot-scope="scope">
@ -173,10 +174,10 @@
<script>
import { mapGetters } from 'vuex';
import { setUID } from '@/jmapNew/utils/Uid';
import { addRoutingData, updateRoutingData } from '@/api/jmap/mapdraft';
import { addRoutingData, updateRoutingData, gernateRoutingSection } from '@/api/jmap/mapdraft';
import { ViewMode } from '@/scripts/ConstDic';
import { formatName } from '@/utils/runPlan';
// import Sortable from 'sortablejs';
import Sortable from 'sortablejs';
export default {
name: 'RouteOperation',
@ -210,6 +211,7 @@ export default {
sectionCode: '',
isSave: true,
loading: false,
generating:false,
DirectionCodeList: [{label: '右行', value: true}, {label: '左行', value: false}],
addModel: {
name: '',
@ -280,22 +282,38 @@ export default {
}
},
mounted() {
// this.rowDrop();
this.rowDrop();
},
methods: {
//
// rowDrop() {
// const that = this;
// const tbody = document.querySelector('.el-table__body-wrapper tbody');
// if (tbody) {
// Sortable.create(tbody, {
// onEnd({ newIndex, oldIndex }) {
// const currRow = that.addModel.mapRouteUnitRelList.splice(oldIndex, 1)[0];
// that.addModel.mapRouteUnitRelList.splice(newIndex, 0, currRow);
// }
// });
// }
// },
rowDrop() {
const that = this;
const tbody = document.querySelector('.el-table__body-wrapper tbody');
if (tbody) {
Sortable.create(tbody, {
onEnd({ newIndex, oldIndex }) {
const currRow = that.addModel.mapRouteUnitRelList.splice(oldIndex, 1)[0];
that.addModel.mapRouteUnitRelList.splice(newIndex, 0, currRow);
}
});
}
},
generateParkSection() {
this.$refs.form.validate((valid) => {
if (valid) {
this.generating = true;
gernateRoutingSection(this.buildModel(setUID('Routing'))).then(resp => {
this.generating = false;
if (resp.data.parkSectionCodeList && resp.data.parkSectionCodeList.length > 2) {
this.addModel.parkSectionCodeList = resp.data.parkSectionCodeList;
}
}).catch((error) => {
this.$messageBox('生成交路区段数据失败: ' + error.message);
this.generating = false;
});
}
});
},
editData() {
this.isSave = false;
this.allowSelect = true;
@ -353,18 +371,35 @@ export default {
this.judgeAllowSelected();
this.addEndSectionData(true);
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData(false);
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.startSectionCode = selected.code;
this.judgeAllowSelected();
this.addStartSectionData(false);
} else {
// (//)
this.$message.error('请选择正确的起始区段');
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData(false);
this.addModel.destinationCode = selected.destinationCode || '';
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.endSectionCode = selected.code;
this.judgeAllowSelected();
this.addEndSectionData(false);
this.addModel.destinationCode = selected.destinationCode || '';
} else {
this.$message.error('请选择正确的终到区段');
}
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'routingSection'.toUpperCase()) {
this.sectionCode = selected.code;
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.sectionCode = selected.code;
} else {
this.$message.error('请选择正确的区段');
}
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() == 'routingStation'.toUpperCase()) {
this.stationCode = selected.code;
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.stationCode = selected.code;
} else {
this.$message.error('请选择正确的区段');
}
}
}
},
@ -464,7 +499,6 @@ export default {
this.$messageBox(this.$t('tip.createRoutingFailed'));
this.loading = false;
});
}
});
},

View File

@ -355,9 +355,18 @@ export default {
} else if (selected._type.toUpperCase() === 'Station'.toUpperCase() && this.field.toUpperCase() === 'endStationCode'.toUpperCase()) {
this.addModel.endStationCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'startSectionCode'.toUpperCase()) {
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.endSectionCode = selected.code;
} else {
this.$message.error('请选择正确的起始区段');
}
this.addModel.startSectionCode = selected.code;
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'endSectionCode'.toUpperCase()) {
this.addModel.endSectionCode = selected.code;
if (selected.standTrack || selected.reentryTrack || selected.transferTrack) {
this.addModel.endSectionCode = selected.code;
} else {
this.$message.error('请选择正确的终到区段');
}
}
}
}