diff --git a/src/views/planMonitor/components/menus/gernaratePlanTrain.vue b/src/views/planMonitor/components/menus/gernaratePlanTrain.vue index 225dbe00a..c965b18b4 100644 --- a/src/views/planMonitor/components/menus/gernaratePlanTrain.vue +++ b/src/views/planMonitor/components/menus/gernaratePlanTrain.vue @@ -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; diff --git a/src/views/planMonitor/components/menus/populatingGenericData.vue b/src/views/planMonitor/components/menus/populatingGenericData.vue index 5ca121b69..410a8f95c 100644 --- a/src/views/planMonitor/components/menus/populatingGenericData.vue +++ b/src/views/planMonitor/components/menus/populatingGenericData.vue @@ -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('环路交路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) { 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; }); - // } } };