运行图编制 代码调整

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

View File

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