This commit is contained in:
ival 2021-03-04 18:22:42 +08:00
commit 6baf23149f
5 changed files with 147 additions and 169 deletions

View File

@ -49,7 +49,7 @@ export default {
overTime: '', // overTime: '', //
runLevel:'', // runLevel:'', //
departureInterval:180, // departureInterval:180, //
reentryTime:120, // // reentryTime:120, //
inboundRouting:'', // code inboundRouting:'', // code
outboundRouting:'', // code outboundRouting:'', // code
runningRouting1: '', // code1 runningRouting1: '', // code1
@ -74,9 +74,9 @@ export default {
departureInterval:[ departureInterval:[
{ required: true, message: '请填写发车间隔', trigger: 'blur' } { required: true, message: '请填写发车间隔', trigger: 'blur' }
], ],
reentryTime:[ // reentryTime:[
{ required: true, message: '请填写折返时间', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
], // ],
inboundRouting: [ inboundRouting: [
{ required: true, message: '请选择回库交路', trigger: 'change' } { required: true, message: '请选择回库交路', trigger: 'change' }
], ],
@ -113,7 +113,7 @@ export default {
{ prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'}, { prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'runLevel', label: '运行等级', type: 'select', options: this.runLevelList }, { prop: 'runLevel', label: '运行等级', type: 'select', options: this.runLevelList },
{ prop: 'departureInterval', label: '发车间隔', type: 'number', show:this.formModel.gernarateType == '02', min:0, step:1, precisionFlag:true, precision:0, message:'s'}, { prop: 'departureInterval', label: '发车间隔', type: 'number', show:this.formModel.gernarateType == '02', min:0, step:1, precisionFlag:true, precision:0, message:'s'},
{ prop: 'reentryTime', label: '折返时间', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s' }, // { prop: 'reentryTime', label: '', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s' },
{ prop: 'outboundRouting', label: '出库交路', type: 'select', options: this.covertRouting('OUTBOUND'), noDataText:'请先设置交路'}, { prop: 'outboundRouting', label: '出库交路', type: 'select', options: this.covertRouting('OUTBOUND'), noDataText:'请先设置交路'},
{ prop: 'runningRouting1', label: '环路交路1', type: 'select', show:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute2 }, { prop: 'runningRouting1', label: '环路交路1', type: 'select', show:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute2 },
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute1}, { prop: 'runningRouting2', label: '环路交路2', type: 'select', show:true, options: this.covertRouting('LOOP'), noDataText:'请先设置交路', change:true, onChange:this.changeRoute1},

View File

@ -42,7 +42,7 @@ export default {
overTime: '', overTime: '',
departureTimeInterval: 180, // departureTimeInterval: 180, //
// parkedTime: 30, // // parkedTime: 30, //
reentryTime: 120, // // reentryTime: 120, //
runningRouting1:'', // code1 runningRouting1:'', // code1
runningRouting2:'' // code2 runningRouting2:'' // code2
// startStationCode: '', // startStationCode: '',
@ -62,9 +62,9 @@ export default {
// parkedTime: [ // parkedTime: [
// { required: true, message: '', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ], // ],
reentryTime: [ // reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
], // ],
runningRouting1: [ runningRouting1: [
{ required: true, validator: this.validateRunningRouting, trigger: 'change' } { required: true, validator: this.validateRunningRouting, trigger: 'change' }
], ],
@ -92,7 +92,7 @@ export default {
{ prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'}, { prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'departureTimeInterval', label: '发车间隔', type: 'number', min:0, step:1, precisionFlag:true, precision:0, message:'s'}, { prop: 'departureTimeInterval', label: '发车间隔', type: 'number', min:0, step:1, precisionFlag:true, precision:0, message:'s'},
// { prop: 'parkedTime', label: '', type: 'number', min:0, step:1, precisionFlag:true, precision:0}, // { prop: 'parkedTime', label: '', type: 'number', min:0, step:1, precisionFlag:true, precision:0},
{ prop: 'reentryTime', label: '折返时间', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s'}, // { prop: 'reentryTime', label: '', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s'},
{ prop: 'right', label: '发车类型', type: 'checkBox', children: [ { prop: 'right', label: '发车类型', type: 'checkBox', children: [
{ name: '上行发车', value: 1 }, { name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 }, { name: '下次发车', value: 2 },

View File

@ -120,7 +120,7 @@ export default {
setSelected(selected) { setSelected(selected) {
if (selected) { if (selected) {
if (this.type == 'routeMap') { this.$refs.routeConfig.setSelected(selected); } if (this.type == 'routeMap') { this.$refs.routeConfig.setSelected(selected); }
if (this.type == 'runplanParams') { this.$refs.runPlanConfig.setSelected(selected); } // if (this.type == 'runplanParams') { this.$refs.runPlanConfig.setSelected(selected); }
} }
}, },
// batchSectionListFocus(flag) { // batchSectionListFocus(flag) {
@ -132,7 +132,7 @@ export default {
close() { close() {
this.dialogShow = false; this.dialogShow = false;
if (this.type == 'routeMap') { this.$refs.routeConfig.createRouteEvent(); } if (this.type == 'routeMap') { this.$refs.routeConfig.createRouteEvent(); }
if (this.type == 'runplanParams') { this.$refs.runPlanConfig.clear(); } // if (this.type == 'runplanParams') { this.$refs.runPlanConfig.clear(); }
} }
} }
}; };

View File

@ -1,56 +1,71 @@
<template> <template>
<div class="runPlanConfig"> <div class="runPlanConfig">
<div class="reentryConfig">折返配置</div> <div class="reentryConfig">折返配置 (单位)</div>
<div class="reentryConfigTable"> <div class="reentryConfigTable">
<div style="margin-bottom:10px;">
<span>区段:</span>
<el-select v-model="sectionCode" clearable :filterable="true" :placeholder="$t('map.pleaseSelect')" size="small">
<el-option
v-for="item in filterReentrySection"
:key="item.code"
:label="`${item.name}(${item.code})`"
:value="item.code"
/>
</el-select>
<el-button
size="small"
:type=" field === 'reentrySection' ? 'danger' : 'primary'"
@click="hover('reentrySection')"
>{{ $t('map.activate') }}</el-button>
<el-button
type="primary"
size="small"
@click="pushSection(sectionCode)"
>
{{ $t('map.add') }}
</el-button>
</div>
<el-table <el-table
:data="sectionCodeList" :data="reentryDataList"
border border
style="width:87%" style="width:100%"
height="300" height="430"
class="el-parkSectionCode-table" class="el-parkSectionCode-table"
> >
<el-table-column prop="stationCode" :label="$t('map.stationName')"> <el-table-column prop="stationCode" :label="$t('map.stationName')">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ formatName(scope.row.stationCode) }}</span> <span>{{ scope.row.stationName }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sectionCode" :label="$t('map.sectionName')"> <el-table-column label="站前折返">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ formatName(scope.row.sectionCode) }}</span> <!-- v-if="scope.row.reentryData.tbFrom" -->
<el-input-number
v-model="scope.row.reentryData.tbFront"
:style="{width: '80px'}"
:min="1"
size="mini"
:controls="false"
:precision="0"
:step="1"
/>
<!-- <el-button v-else type="primary" size="small" @click="add(scope.row)">添加</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('map.operation')" width="150"> <el-table-column label="站后折返">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-input-number
type="text" v-model="scope.row.reentryData.tbBack"
size="small" :style="{width: '80px'}"
@click.native.prevent="deleteSection(sectionCodeList, scope.$index)" :min="1"
> size="mini"
{{ $t('map.remove') }} :precision="0"
</el-button> :controls="false"
:step="1"
/>
</template>
</el-table-column>
<el-table-column label="从股道到折返">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.reentryData.tbFrom"
:style="{width: '80px'}"
:min="1"
size="mini"
:controls="false"
:precision="0"
:step="1"
/>
</template>
</el-table-column>
<el-table-column label="从折返到股道">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.reentryData.tbTo"
:style="{width: '80px'}"
:min="1"
size="mini"
:controls="false"
:precision="0"
:step="1"
/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -63,13 +78,13 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { formatName } from '@/utils/runPlan';
import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft'; import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft';
export default { export default {
name:'RunPlanConfig', name:'RunPlanConfig',
data() { data() {
return { return {
sectionCodeList:[], reentryDataList:[],
stationList:{},
sectionCode:'', sectionCode:'',
field:'', field:'',
loading:false loading:false
@ -78,135 +93,98 @@ export default {
computed: { computed: {
...mapGetters('map', [ ...mapGetters('map', [
'sectionList' 'sectionList'
]), ])
filterReentrySection() { },
mounted() {
if (this.sectionList) { if (this.sectionList) {
return this.sectionList.filter(elem => { return elem.reentryTrack; }); const reentrySections = this.sectionList.filter(elem => { return elem.reentryTrack; });
} else { const stationList = {};
return []; reentrySections.forEach(each=>{
if (each.belongStation) {
const station = this.$store.getters['map/getDeviceByCode'](each.belongStation);
if (!stationList[each.belongStation]) {
stationList[each.belongStation] = {code:each.belongStation, stationName:station.name,
reentryData:{tbFront:undefined, tbBack:undefined, tbFrom:undefined, tbTo:undefined}};
} }
} }
});
this.reentryDataList = Object.values(stationList);
this.stationList = stationList;
}
}, },
methods:{ methods:{
doShow() { doShow() {
this.sectionCodeList = [];
this.sectionCode = '';
this.field = '';
this.loading = false; this.loading = false;
getRunplanConfig(this.$route.query.mapId).then(resp => { getRunplanConfig(this.$route.query.mapId).then(resp => {
if (resp.data.config) { if (resp.data && resp.data.config && resp.data.config.reentryData) {
const runPlanUserReentryData = resp.data.config.runPlanUserReentryData; const reentryData = resp.data.config.reentryData;
const runPlanUserReentryDataKey = Object.keys(runPlanUserReentryData); const keys = Object.keys(reentryData);
if (runPlanUserReentryDataKey && runPlanUserReentryDataKey.length > 0) { keys.forEach(each=>{
runPlanUserReentryDataKey.forEach(each=>{ this.stationList[each].reentryData = reentryData[each];
this.sectionCodeList.push({stationCode:each, sectionCode:runPlanUserReentryData[each]});
}); });
// const newData = Object.values(this.stationList);
// this.changeSectionSelected(this.sectionCodeList, true); this.reentryDataList = [...newData || []];
}
} }
}); });
}, },
deleteSection(list, index) {
const data = list.splice(index, 1);
if (data.length > 0) {
this.setSectionColor({'sectionCode':data[0].sectionCode}, '');
}
},
hover(field) {
this.field = field === this.field ? '' : field;
},
setSelected(selected) {
if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() == 'reentrySection'.toUpperCase()) {
if (selected.reentryTrack) {
this.sectionCode = selected.code;
} else {
this.$message.error('请选择正确的区段');
}
}
},
formatName(code) {
return formatName(code);
},
pushSection(sectionCode) {
if (sectionCode) {
const index = this.sectionCodeList.findIndex(elem => { return elem.sectionCode == sectionCode; });
if (index < 0) {
const section = this.$store.getters['map/getDeviceByCode'](sectionCode);
let stationCode = '';
if (section && section.belongStation) {
stationCode = section.belongStation;
}
const sectionState = this.sectionCodeList.find(elem => { return elem.stationCode == stationCode; });
if (!sectionState) {
this.sectionCodeList.push({'sectionCode':sectionCode, 'stationCode':stationCode});
this.setSectionColor({'sectionCode':sectionCode}, 'routingSection');
this.sectionCode = '';
} else {
this.$messageBox('一个车站只能添加一个折返区段');
}
} else {
this.$messageBox('该折返区段已添加');
}
}
},
setSectionColor(sectionParam, type) {
const section = this.$store.getters['map/getDeviceByCode'](sectionParam.sectionCode);
console.log(this.$store.state.map.mapDevice);
const list = section.logicSectionCodeList;
if (list && list.length > 0) {
list.forEach(logicSectionCode=>{
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection.instance.drawBatchSelected(section, type);
});
} else {
// this.oldsection && this.oldsection.push(section);
section.instance.drawBatchSelected(section, type);
}
},
changeSectionSelected(selectedList, flag) {
if (selectedList && selectedList.length > 0) {
if (flag) {
selectedList.forEach(each=>{
this.setSectionColor({'sectionCode':each.sectionCode}, 'routingSection');
});
} else {
selectedList.forEach(each=>{
this.setSectionColor({'sectionCode':each.sectionCode}, '');
});
}
}
},
save() { save() {
if (this.sectionCodeList.length > 0) { const tbBackList = [];
this.loading = true; const reentryData = {};
const runPlanUserReentryData = {}; this.reentryDataList.forEach(each=>{
this.sectionCodeList.forEach(each=>{ if (each.reentryData.tbFront || (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
runPlanUserReentryData[each.stationCode] = each.sectionCode; const temp = Object.assign({}, each.reentryData);
if (each.reentryData.tbFront) {
temp.tbBack = null;
temp.tbFrom = null;
temp.tbTo = null;
} else {
temp.tbFront = null;
}
reentryData[each.code] = temp;
} else {
if (each.reentryData.tbBack || each.reentryData.tbFrom || each.reentryData.tbTo) {
tbBackList.push(each.stationName);
}
}
}); });
addRunplanConfig(this.$route.query.mapId, {runPlanUserReentryData:runPlanUserReentryData}).then(resp => { if (tbBackList.length > 0) {
this.$message.success('折返区段配置成功'); this.$messageBox('请设置【' + reentryData.toString() + '】站后折返信息');
return;
} else if (Object.keys(reentryData).length == 0) {
// JSON.stringify(reentryData) == '{}'
this.$messageBox('请填写折返配置信息');
return;
}
addRunplanConfig(this.$route.query.mapId, {'reentryData':reentryData}).then(resp => {
this.$message.success('折返配置成功');
this.loading = false; this.loading = false;
}).catch((error) => { }).catch((error) => {
this.$messageBox('折返区段配置失败' + ':' + error.message); this.$messageBox('折返配置失败' + ':' + error.message);
this.loading = false; this.loading = false;
}); });
} else {
this.$messageBox('请添加折返区段');
}
},
clear() {
this.changeSectionSelected(this.sectionCodeList, false);
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.reentryConfig{
}
.reentryConfigTable{ .reentryConfigTable{
margin-top: 10px; margin-top: 10px;
} }
.runPlanConfig{padding:15px 20px} .runPlanConfig{padding:15px 20px}
// .reentryConfigTable .el-table--scrollable-y .el-table__body-wrapper{
// &::-webkit-scrollbar {
// width: 4px;
// }
// &::-webkit-scrollbar-thumb {
// border-radius: 10px;
// background: #c3c3c3;
// }
// &::-webkit-scrollbar-track {
// border-radius: 0;
// background: #f0f0f0;
// }
// }
</style> </style>

View File

@ -42,7 +42,7 @@ export default {
overTime: '', overTime: '',
departureTimeInterval: 180, // departureTimeInterval: 180, //
// parkedTime: 30, // // parkedTime: 30, //
reentryTime: 120, // // reentryTime: 120, //
runningRouting1:'', // code1 runningRouting1:'', // code1
runningRouting2:'' // code2 runningRouting2:'' // code2
// startStationCode: '', // startStationCode: '',
@ -62,9 +62,9 @@ export default {
// parkedTime: [ // parkedTime: [
// { required: true, message: '', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
// ], // ],
reentryTime: [ // reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' } // { required: true, message: '', trigger: 'blur' }
], // ],
runningRouting1: [ runningRouting1: [
{ required: true, validator: this.validateRunningRouting, trigger: 'change' } { required: true, validator: this.validateRunningRouting, trigger: 'change' }
], ],
@ -92,7 +92,7 @@ export default {
{ prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'}, { prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ prop: 'departureTimeInterval', label: '发车间隔', type: 'number', min:0, step:1, precisionFlag:true, precision:0, message:'s'}, { prop: 'departureTimeInterval', label: '发车间隔', type: 'number', min:0, step:1, precisionFlag:true, precision:0, message:'s'},
// { prop: 'parkedTime', label: '', type: 'number', min:0, step:1, precisionFlag:true, precision:0}, // { prop: 'parkedTime', label: '', type: 'number', min:0, step:1, precisionFlag:true, precision:0},
{ prop: 'reentryTime', label: '折返时间', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s'}, // { prop: 'reentryTime', label: '', type: 'number', min:120, step:1, precisionFlag:true, precision:0, message:'s'},
{ prop: 'right', label: '发车类型', type: 'checkBox', children: [ { prop: 'right', label: '发车类型', type: 'checkBox', children: [
{ name: '上行发车', value: 1 }, { name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 }, { name: '下次发车', value: 2 },