运行图编制 代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-12 16:16:51 +08:00
parent 905e59c869
commit c3fec625e2
2 changed files with 73 additions and 66 deletions

View File

@ -35,6 +35,7 @@ export default {
dialogShow: false,
routingList: [],
loading: false,
runningRoutingMap:{},
runLevelList: [
{ value: 1, label: '等级一' },
{ value: 2, label: '等级二' },
@ -49,11 +50,11 @@ export default {
overTime: '', //
runLevel:'', //
departureInterval:180, //
// reentryTime:120, //
inboundRouting:'', // code
outboundRouting:'', // code
runningRouting1: '', // code1
runningRouting2: '' // code2
runningRouting2: '', // code2
runningRouting:''
},
rules: {
@ -74,23 +75,15 @@ export default {
departureInterval:[
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
// reentryTime:[
// { required: true, message: '', trigger: 'blur' }
// ],
inboundRouting: [
{ required: true, message: '请选择回库交路', trigger: 'change' }
],
runningRouting: [
{ required: true, message: '请选择环路', trigger: 'blur' },
{ required: true, message: '请选择环路', trigger: 'change' }
],
outboundRouting: [
{ required: true, message: '请选择出库交路', trigger: 'change' }
],
runningRouting1: [
// message: '',
{ required: true, validator: this.validateRunningRouting, trigger: 'change' },
{ required: true, validator: this.validateRunningRouting, trigger: 'blur' }
],
runningRouting2: [
{ required: true, validator: this.validateRunningRouting, trigger: 'change' },
{ required: true, validator: this.validateRunningRouting, trigger: 'blur' }
]
}
};
@ -113,10 +106,10 @@ 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: '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},
{ prop: 'runningRouting1', label: '环路交路1', type: 'select', show:false},
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:false},
{prop:'runningRouting', label:'环路', type: 'select', options:this.covertRoutingCircle(), noDataText:'请先设置交路', change:true, onChange:this.changeRoute},
{ prop: 'inboundRouting', label: '入库交路', type: 'select', options: this.covertRouting('INBOUND'), noDataText:'请先设置交路'}
]
};
@ -127,8 +120,35 @@ export default {
this.loading = false;
const mapId = this.$route.query.mapId;
if (mapId) {
const runningRoutingMap = {};
listUserRoutingData(mapId).then(response => {
this.routingList = response.data.map(elem => { return { value: elem.code, label: elem.name, routingType:elem.routingType }; });
const list = response.data;
this.routingList = list.map(elem => { return { value: elem.code, label: elem.name, routingType:elem.routingType }; });
list.forEach(elem=>{
// this.routingList.push({value: elem.code, label: elem.name, routingType:elem.routingType});
if (elem.routingType === 'LOOP') {
const name = elem.name;
let temp = '';
if (elem.right) {
temp = name.split('-')[0];
// const data = ;
const data = runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode];
if (!data) { runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode] = {}; }
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].label = elem.name + '-' + temp;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
} else {
temp = name.split('-')[1];
// const data = ;
const data = runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode];
if (!data) { runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode] = {}; }
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].label = temp + '-' + elem.name;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].value = elem.endSectionCode + '-' + elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].runningRouting2 = elem.code;
}
}
});
this.runningRoutingMap = runningRoutingMap;
}).catch(() => {
this.$messageBox(`获取交路列表失败`);
});
@ -171,34 +191,39 @@ export default {
}
}
},
validateRunningRouting(rule, value, callback) {
if (value.trim().length == 0) {
return callback(new Error('请选择环路'));
} else {
if (this.formModel.runningRouting1 == this.formModel.runningRouting2) {
return callback(new Error('环路交路1和环路交路2不能相同'));
} else {
return callback();
}
}
},
changeRoute2() {
this.changeRoute('runningRouting2');
},
changeRoute1() {
this.changeRoute('runningRouting1');
},
// changeRoute(runningRouting) {
// if (this.formModel[runningRouting]) { this.$refs.dataform.validateField([runningRouting]); }
// },
changeRoute(runningRouting) {
if (this.formModel[runningRouting]) { this.$refs.dataform.validateField([runningRouting]); }
const temp = this.runningRoutingMap[runningRouting];
this.formModel.runningRouting1 = temp.runningRouting1;
this.formModel.runningRouting2 = temp.runningRouting2;
},
doClose() {
this.loading = false;
this.$refs.dataform.resetForm();
this.formModel = {
gernarateType:'01',
serviceNumber:'', //
beginTime: '', //
overTime: '', //
runLevel:'', //
departureInterval:180, //
inboundRouting:'', // code
outboundRouting:'', // code
runningRouting1: '', // code1
runningRouting2: '', // code2
runningRouting:''
};
this.dialogShow = false;
},
covertRouting(routingType) {
return this.routingList.filter(route=>{ return route.routingType == routingType; });
},
covertRoutingCircle() {
const list = Object.values(this.runningRoutingMap);
return list.filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
},
handleCommit() {
this.$refs.dataform.validateForm(() => {
if (this.formModel.overTime <= this.formModel.beginTime) {
@ -212,6 +237,7 @@ export default {
delete formModel.serviceNumber;
}
delete formModel.gernarateType;
this.loading = true;
generatePlanTrain(this.$route.query.planId || this.loadRunPlanId, formModel).then(res => {
this.loading = false;

View File

@ -62,6 +62,7 @@ export default {
{ required: true, message: '请填写发车间隔', trigger: 'blur' }
],
runningRouting: [
{ required: true, message: '请选择环路', trigger: 'blur' },
{ required: true, message: '请选择环路', trigger: 'change' }
]
// parkedTime: [
@ -96,20 +97,14 @@ export default {
{ prop: 'beginTime', 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: '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: 'right', label: '发车类型', type: 'checkBox', children: [
{ name: '上行发车', value: 1 },
{ name: '下次发车', value: 2 },
{ name: '同时发车', value: 3 }
] },
// options: this.covertRouting('LOOP')
// options: this.covertRouting('LOOP')
{ prop: 'runningRouting1', label: '环路交路1', type: 'select', show:false},
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:false},
{prop:'runningRouting', label:'环路', type: 'select', options:this.covertRouting(), noDataText:'请先设置交路', change:true, onChange:this.changeRoute}
// noDataText:'', change:true, onChange:this.changeRoute1
// noDataText:'', change:true, onChange:this.changeRoute2
// { prop: 'startStationCode', label: '', type: 'select', options: this.stationList },
// { prop: 'endStationCode', label: '', type: 'select', options: this.stationList }
]
@ -135,7 +130,6 @@ export default {
listUserRoutingData(mapId).then(response => {
const list = response.data;
list.forEach(elem=>{
// this.routingList.push({value: elem.code, label: elem.name, routingType:elem.routingType});
if (elem.routingType === 'LOOP') {
const name = elem.name;
let temp = '';
@ -169,6 +163,16 @@ export default {
doClose() {
this.loading = false;
this.$refs.dataform.resetForm();
this.formModel = {
stationRunningTime: 60, //
right: 3, //
beginTime: '',
overTime: '',
departureTimeInterval: 180, //
runningRouting1:'', // code1
runningRouting2:'', // code2
runningRouting:''
};
this.dialogShow = false;
},
handleCommit() {
@ -198,26 +202,6 @@ export default {
}
});
},
// validateRunningRouting(rule, value, callback) {
// if (value.trim().length == 0) {
// return callback(new Error(''));
// } else {
// if (this.formModel.runningRouting1 == this.formModel.runningRouting2) {
// return callback(new Error('12'));
// } else {
// return callback();
// }
// }
// },
// changeRoute2() {
// this.changeRoute('runningRouting2');
// },
// changeRoute1() {
// this.changeRoute('runningRouting1');
// },
// changeRoute(runningRouting) {
// if (this.formModel[runningRouting]) { this.$refs.dataform.validateField([runningRouting]); }
// },
changeRoute(runningRouting) {
const temp = this.runningRoutingMap[runningRouting];
this.formModel.runningRouting1 = temp.runningRouting1;
@ -227,9 +211,6 @@ export default {
const list = Object.values(this.runningRoutingMap);
return list.filter(route=>{ return route.runningRouting1 && route.runningRouting2; });
}
// covertRouting(routingType) {
// return this.routingList.filter(route=>{ return route.routingType == routingType; });
// }
}
};
</script>