其他参数的配置页面 折返数据 代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-04 16:36:18 +08:00
parent 4c649312c1
commit 66af660f18
5 changed files with 147 additions and 169 deletions

View File

@ -49,7 +49,7 @@ export default {
overTime: '', //
runLevel:'', //
departureInterval:180, //
reentryTime:120, //
// reentryTime:120, //
inboundRouting:'', // code
outboundRouting:'', // code
runningRouting1: '', // code1
@ -74,9 +74,9 @@ export default {
departureInterval:[
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
reentryTime:[
{ required: true, message: '请填写折返时间', trigger: 'blur' }
],
// reentryTime:[
// { required: true, message: '', trigger: 'blur' }
// ],
inboundRouting: [
{ required: true, message: '请选择回库交路', trigger: 'change' }
],
@ -113,7 +113,7 @@ export default {
{ prop: 'overTime', label: '结束时间', type: 'timePicker', selectableRange:'02:00:00-23:59:59'},
{ 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: '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: '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},

View File

@ -42,7 +42,7 @@ export default {
overTime: '',
departureTimeInterval: 180, //
// parkedTime: 30, //
reentryTime: 120, //
// reentryTime: 120, //
runningRouting1:'', // code1
runningRouting2:'' // code2
// startStationCode: '',
@ -62,9 +62,9 @@ export default {
// parkedTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' }
],
// reentryTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
runningRouting1: [
{ 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: '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: '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: [
{ name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 },

View File

@ -120,7 +120,7 @@ export default {
setSelected(selected) {
if (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) {
@ -132,7 +132,7 @@ export default {
close() {
this.dialogShow = false;
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>
<div class="runPlanConfig">
<div class="reentryConfig">折返配置</div>
<div class="reentryConfig">折返配置 (单位)</div>
<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
:data="sectionCodeList"
:data="reentryDataList"
border
style="width:87%"
height="300"
style="width:100%"
height="430"
class="el-parkSectionCode-table"
>
<el-table-column prop="stationCode" :label="$t('map.stationName')">
<template slot-scope="scope">
<span>{{ formatName(scope.row.stationCode) }}</span>
<span>{{ scope.row.stationName }}</span>
</template>
</el-table-column>
<el-table-column prop="sectionCode" :label="$t('map.sectionName')">
<el-table-column label="站前折返">
<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>
</el-table-column>
<el-table-column :label="$t('map.operation')" width="150">
<el-table-column label="站后折返">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.prevent="deleteSection(sectionCodeList, scope.$index)"
>
{{ $t('map.remove') }}
</el-button>
<el-input-number
v-model="scope.row.reentryData.tbBack"
:style="{width: '80px'}"
:min="1"
size="mini"
:precision="0"
: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>
</el-table-column>
</el-table>
@ -63,13 +78,13 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { formatName } from '@/utils/runPlan';
import { addRunplanConfig, getRunplanConfig } from '@/api/jmap/mapdraft';
export default {
name:'RunPlanConfig',
data() {
return {
sectionCodeList:[],
reentryDataList:[],
stationList:{},
sectionCode:'',
field:'',
loading:false
@ -78,135 +93,98 @@ export default {
computed: {
...mapGetters('map', [
'sectionList'
]),
filterReentrySection() {
])
},
mounted() {
if (this.sectionList) {
return this.sectionList.filter(elem => { return elem.reentryTrack; });
} else {
return [];
const reentrySections = this.sectionList.filter(elem => { return elem.reentryTrack; });
const stationList = {};
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:{
doShow() {
this.sectionCodeList = [];
this.sectionCode = '';
this.field = '';
this.loading = false;
getRunplanConfig(this.$route.query.mapId).then(resp => {
if (resp.data.config) {
const runPlanUserReentryData = resp.data.config.runPlanUserReentryData;
const runPlanUserReentryDataKey = Object.keys(runPlanUserReentryData);
if (runPlanUserReentryDataKey && runPlanUserReentryDataKey.length > 0) {
runPlanUserReentryDataKey.forEach(each=>{
this.sectionCodeList.push({stationCode:each, sectionCode:runPlanUserReentryData[each]});
if (resp.data && resp.data.config && resp.data.config.reentryData) {
const reentryData = resp.data.config.reentryData;
const keys = Object.keys(reentryData);
keys.forEach(each=>{
this.stationList[each].reentryData = reentryData[each];
});
//
// this.changeSectionSelected(this.sectionCodeList, true);
}
const newData = Object.values(this.stationList);
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() {
if (this.sectionCodeList.length > 0) {
this.loading = true;
const runPlanUserReentryData = {};
this.sectionCodeList.forEach(each=>{
runPlanUserReentryData[each.stationCode] = each.sectionCode;
const tbBackList = [];
const reentryData = {};
this.reentryDataList.forEach(each=>{
if (each.reentryData.tbFront || (each.reentryData.tbBack && each.reentryData.tbFrom && each.reentryData.tbTo)) {
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 => {
this.$message.success('折返区段配置成功');
if (tbBackList.length > 0) {
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;
}).catch((error) => {
this.$messageBox('折返区段配置失败' + ':' + error.message);
this.$messageBox('折返配置失败' + ':' + error.message);
this.loading = false;
});
} else {
this.$messageBox('请添加折返区段');
}
},
clear() {
this.changeSectionSelected(this.sectionCodeList, false);
}
}
};
</script>
<style lang="scss" scoped>
.reentryConfig{
}
<style lang="scss">
.reentryConfigTable{
margin-top: 10px;
}
.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>

View File

@ -42,7 +42,7 @@ export default {
overTime: '',
departureTimeInterval: 180, //
// parkedTime: 30, //
reentryTime: 120, //
// reentryTime: 120, //
runningRouting1:'', // code1
runningRouting2:'' // code2
// startStationCode: '',
@ -62,9 +62,9 @@ export default {
// parkedTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
reentryTime: [
{ required: true, message: '请填写折返时间', trigger: 'blur' }
],
// reentryTime: [
// { required: true, message: '', trigger: 'blur' }
// ],
runningRouting1: [
{ 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: '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: '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: [
{ name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 },