代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-16 17:43:22 +08:00
parent c11568348f
commit 76dcd271d9
3 changed files with 91 additions and 82 deletions

View File

@ -198,12 +198,13 @@
<el-select
v-model="formModel[item.prop]"
filterable
:clearable="!!item.clearable"
:clearable="!!item.clearable"
:placeholder="item.placeholder"
:no-data-text="item.noDataText?item.noDataText:'无数据'"
:disabled="item.disabled"
@change="item.onChange"
>
<!-- :popper-append-to-body="false" -->
<el-option
v-for="option in item.options"
:key="option[item.optionValue|| 'value']"
@ -223,6 +224,7 @@
:disabled="item.disabled"
@change="((val)=>{deviceChange(val, item)})"
>
<!-- :popper-append-to-body="false" -->
<el-option
v-for="option in item.options"
:key="option[item.optionValue|| 'value']"

View File

@ -87,9 +87,9 @@ export default {
{ required: true, message: '请选择出库交路', trigger: 'change' }
]
},
outboundRouteList: [],
runningRouteList: [],
inboundRouteList: []
outboundRouteList: [],
runningRouteList: [],
inboundRouteList: []
};
},
computed: {
@ -97,7 +97,7 @@ export default {
return '生成计划';
},
form() {
return {
return {
labelWidth: '100px',
size:'small',
items: [
@ -110,7 +110,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: 'outboundRouting', label: '出库交路', type: 'select', options: this.outboundRouteList, clearable: true, change:true, onChange: this.onOutboundRouteChange, noDataText:'请先设置交路'},
{ prop: 'outboundRouting', label: '出库交路', type: 'select', options: this.outboundRouteList, clearable: true, change:true, onChange: this.onOutboundRouteChange, noDataText:'请先设置交路'},
{ prop: 'runningRouting1', label: '环路交路1', type: 'select', show:false},
{ prop: 'runningRouting2', label: '环路交路2', type: 'select', show:false},
{ prop: 'runningRouting', label:'环路', type: 'select', options: this.runningRouteList, noDataText:'请先设置交路', clearable: true, change:true, onChange:this.onRunningRouteChange},
@ -142,9 +142,9 @@ export default {
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].label = elem.name;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startSectionCode = elem.startSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endSectionCode = elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].startSectionCode = elem.startSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].endSectionCode = elem.endSectionCode;
} else {
// temp = name.split('-')[1];
// const data = ;
@ -153,18 +153,18 @@ export default {
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].label = elem.name;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].value = elem.endSectionCode + '-' + elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].runningRouting2 = elem.code;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].startSectionCode = elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].endSectionCode = elem.endSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].startSectionCode = elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].endSectionCode = elem.endSectionCode;
}
}
});
this.runningRoutingMap = runningRoutingMap;
this.onOutboundRouteChange();
this.onRunningRouteChange();
this.onInboundRouteChange();
this.dataLoading = false;
this.onOutboundRouteChange();
this.onRunningRouteChange();
this.onInboundRouteChange();
this.dataLoading = false;
}).catch(_ => {
console.log(_)
console.log(_);
this.dataLoading = false;
this.$messageBox(`获取交路列表失败`);
});
@ -222,117 +222,120 @@ export default {
this.formModel.inboundRouting = '';
}
this.$nextTick(_ => {
this.$refs.dataform && this.$refs.dataform.clearValidate();
});
this.$nextTick(_ => {
this.$refs.dataform && this.$refs.dataform.clearValidate();
});
},
onOutboundRouteChange(outboundRouting='') {
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
onOutboundRouteChange(outboundRouting = '') {
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
if (this.formModel.runningRouting) {
this.runningRouteList = this.covertRouting(Object.values(this.runningRoutingMap), route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
this.runningRouteList = this.covertRouting(Object.values(this.runningRoutingMap), route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode)
)
})
} else {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && !inboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
);
});
} else {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && !inboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
!outboundRoute && inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode) ||
outboundRoute && inboundRoute && (
outboundRoute.endSectionCode != inboundRoute.startSectionCode && JSON.stringify([route.startSectionCode,route.endSectionCode].sort()) == JSON.stringify([outboundRoute.endSectionCode, inboundRoute.startSectionCode].sort()) ||
outboundRoute.endSectionCode == inboundRoute.startSectionCode && [route.startSectionCode,route.endSectionCode].includes(outboundRoute.endSectionCode)
) ||
outboundRoute.endSectionCode != inboundRoute.startSectionCode && JSON.stringify([route.startSectionCode, route.endSectionCode].sort()) == JSON.stringify([outboundRoute.endSectionCode, inboundRoute.startSectionCode].sort()) ||
outboundRoute.endSectionCode == inboundRoute.startSectionCode && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode)
) ||
!inboundRoute && !outboundRoute
)
})
}
);
});
}
if (!outboundRouting) {
this.outboundRouteList = this.covertRouting(this.routingList, route => {
return route.routingType == 'OUTBOUND'
})
return route.routingType == 'OUTBOUND';
});
}
this.checkRouteCurrentValue();
},
onRunningRouteChange(runningRouting='') {
const temp = this.runningRoutingMap[runningRouting];
if (temp) {
this.formModel.runningRouting1 = temp.runningRouting1;
this.formModel.runningRouting2 = temp.runningRouting2;
}
},
onRunningRouteChange(runningRouting = '') {
const temp = this.runningRoutingMap[runningRouting];
if (temp) {
this.formModel.runningRouting1 = temp.runningRouting1;
this.formModel.runningRouting2 = temp.runningRouting2;
}
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
const runningRoute = Object.values(this.runningRoutingMap).find(route => route.value == this.formModel.runningRouting);
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
const runningRoute = Object.values(this.runningRoutingMap).find(route => route.value == this.formModel.runningRouting);
if (!this.formModel.runningRouting) {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode) ||
!inboundRoute && !outboundRoute
))
}
));
}
this.outboundRouteList = this.covertRouting(this.routingList, route => {
return route.routingType == 'OUTBOUND' && (
runningRoute
? [runningRoute.startSectionCode, runningRoute.endSectionCode].includes(route.endSectionCode)
: true
)
})
);
});
this.inboundRouteList = this.covertRouting(this.routingList, route => {
return route.routingType == 'INBOUND' && (
runningRoute
? [runningRoute.startSectionCode, runningRoute.endSectionCode].includes(route.startSectionCode)
: true
)
})
);
});
this.checkRouteCurrentValue();
},
onInboundRouteChange(inboundRouting='') {
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
onInboundRouteChange(inboundRouting = '') {
const outboundRoute = this.routingList.find(route => route.value == this.formModel.outboundRouting);
const inboundRoute = this.routingList.find(route => route.value == this.formModel.inboundRouting);
if (this.formModel.runningRouting) {
this.runningRouteList = this.covertRouting(Object.values(this.runningRoutingMap), route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
if (this.formModel.runningRouting) {
this.runningRouteList = this.covertRouting(Object.values(this.runningRoutingMap), route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode)
)
})
} else {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && !inboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
);
});
} else {
this.runningRouteList = Object.values(this.runningRoutingMap).filter(route => {
return route.runningRouting1 && route.runningRouting2 && (
outboundRoute && !inboundRoute && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode) ||
!outboundRoute && inboundRoute && [route.startSectionCode, route.endSectionCode].includes(inboundRoute.startSectionCode) ||
outboundRoute && inboundRoute && (
outboundRoute.endSectionCode != inboundRoute.startSectionCode && JSON.stringify([route.startSectionCode,route.endSectionCode].sort()) == JSON.stringify([outboundRoute.endSectionCode, inboundRoute.startSectionCode].sort()) ||
outboundRoute.endSectionCode == inboundRoute.startSectionCode && [route.startSectionCode,route.endSectionCode].includes(outboundRoute.endSectionCode)
) ||
outboundRoute.endSectionCode != inboundRoute.startSectionCode && JSON.stringify([route.startSectionCode, route.endSectionCode].sort()) == JSON.stringify([outboundRoute.endSectionCode, inboundRoute.startSectionCode].sort()) ||
outboundRoute.endSectionCode == inboundRoute.startSectionCode && [route.startSectionCode, route.endSectionCode].includes(outboundRoute.endSectionCode)
) ||
!inboundRoute && !outboundRoute
)
})
}
);
});
}
if (!inboundRouting) {
if (!inboundRouting) {
this.inboundRouteList = this.covertRouting(this.routingList, route => {
return route.routingType == 'INBOUND'
})
return route.routingType == 'INBOUND';
});
}
this.checkRouteCurrentValue();
},
},
doClose() {
this.loading = false;
debugger;
// this.$refs.dataform.validateField('runningRouting');
this.$refs.dataform.resetForm();
// this.$refs.dataform.clearValidate();
// blur
this.formModel = {
gernarateType:'01',
serviceNumber:'', //
@ -348,7 +351,7 @@ export default {
};
this.dialogShow = false;
},
covertRouting(list, cb=e => true) {
covertRouting(list, cb = e => true) {
return list.filter(route=> cb(route));
},
handleCommit() {

View File

@ -289,6 +289,10 @@ export default {
serviceObj = this.$store.state.runPlan.editData[row.serviceNumber] || {};
const op = this.myChart.getOption();
//console.log(op.series);
// const array1 = []; op.series[1].data.forEach(each=>{ array1.push({dataTime:each[0], temperature:each[1], serviceNumber:each[3]}); });
//const array1 = []; op.series[5].data.forEach(each=>{ array1.push({dataTime:each[0], kiloMemter:each[1], serviceNumber:each[3], tripNumber:'05'}); });
//debugger;
op.series.forEach((item, index) => {
item.lineStyle.color = '#000';
item.lineStyle.width = 0.5;