运行图编制 代码调整

This commit is contained in:
joylink_cuiweidong 2021-03-12 16:37:32 +08:00
parent c3fec625e2
commit 40f6314b85
2 changed files with 23 additions and 16 deletions

View File

@ -11,7 +11,7 @@
top="10vh"
:close-on-click-modal="false"
>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<data-form ref="dataform" v-loading="dataLoading" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="small" :loading="loading" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
@ -33,6 +33,7 @@ export default {
data() {
return {
dialogShow: false,
dataLoading:false,
routingList: [],
loading: false,
runningRoutingMap:{},
@ -121,35 +122,38 @@ export default {
const mapId = this.$route.query.mapId;
if (mapId) {
const runningRoutingMap = {};
this.dataLoading = true;
listUserRoutingData(mapId).then(response => {
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 = '';
// const name = elem.name;
// let temp = '';
if (elem.right) {
temp = name.split('-')[0];
// 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].label = elem.name;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
} else {
temp = name.split('-')[1];
// 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].label = elem.name;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].value = elem.endSectionCode + '-' + elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].runningRouting2 = elem.code;
}
}
});
this.runningRoutingMap = runningRoutingMap;
this.dataLoading = false;
}).catch(() => {
this.dataLoading = false;
this.$messageBox(`获取交路列表失败`);
});
}

View File

@ -10,7 +10,7 @@
:modal="false"
:close-on-click-modal="false"
>
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<data-form ref="dataform" v-loading="dataLoading" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="doClose">{{ $t('global.cancel') }}</el-button>
<el-button type="primary" size="medium" :loading="loading" @click="handleCommit">{{ $t('global.confirm') }}</el-button>
@ -35,6 +35,7 @@ export default {
// stationList: [],
// routingList: [],
loading: false,
dataLoading:false,
runningRoutingMap:{},
formModel: {
stationRunningTime: 60, //
@ -127,37 +128,39 @@ export default {
const mapId = this.$route.query.mapId;
if (mapId) {
const runningRoutingMap = {};
this.dataLoading = true;
listUserRoutingData(mapId).then(response => {
const list = response.data;
list.forEach(elem=>{
if (elem.routingType === 'LOOP') {
const name = elem.name;
let temp = '';
// const name = elem.name;
// let temp = '';
if (elem.right) {
temp = name.split('-')[0];
// 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].label = elem.name;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].value = elem.startSectionCode + '-' + elem.endSectionCode;
runningRoutingMap[elem.startSectionCode + '-' + elem.endSectionCode].runningRouting1 = elem.code;
} else {
temp = name.split('-')[1];
// 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].label = elem.name;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].value = elem.endSectionCode + '-' + elem.startSectionCode;
runningRoutingMap[elem.endSectionCode + '-' + elem.startSectionCode].runningRouting2 = elem.code;
}
}
});
this.runningRoutingMap = runningRoutingMap;
this.dialogShow = true;
this.dataLoading = false;
}).catch(() => {
this.dialogShow = true;
this.dataLoading = false;
this.$messageBox(`获取交路列表失败`);
});
this.dialogShow = true;
}
},
doClose() {