This commit is contained in:
zyy 2019-12-23 10:36:40 +08:00
commit d62b023d52
3 changed files with 44 additions and 55 deletions

View File

@ -215,28 +215,10 @@ export default {
}, },
'addOverlapModel.routeOverlapSectionList': function (val, old) { 'addOverlapModel.routeOverlapSectionList': function (val, old) {
if (old && old.length) { if (old && old.length) {
old.forEach((item) => { this.changeSectionSelected(old, false, 'continueProtectSection' );
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(false, '');
});
} else {
section.instance.drawBatchSelected(false, '');
}
});
} }
if (val && val.length) { if (val && val.length) {
val.forEach((item) => { this.changeSectionSelected(val, true, 'continueProtectSection' );
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true, 'continueProtectSection');
});
} else {
section.instance.drawBatchSelected(true, 'continueProtectSection');
}
});
} }
} }
@ -392,6 +374,21 @@ export default {
}; };
this.overlapCode = ''; this.overlapCode = '';
this.overlapType = ''; this.overlapType = '';
},
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section.instance.drawBatchSelected(flag, flag ? type : '');
}
});
},
routeSectionListFocus(flag) {
this.changeSectionSelected(this.addOverlapModel.routeOverlapSectionList, flag, 'continueProtectSection');
} }
} }
}; };

View File

@ -347,31 +347,13 @@ export default {
}, },
'addModel.routeSectionList': function(val, old) { 'addModel.routeSectionList': function(val, old) {
if (old && old.length) { if (old && old.length) {
old.forEach((item) => { this.changeSectionSelected(old, false, 'routePhysicalSection');
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(false, '');
});
} else {
section.instance.drawBatchSelected(false, '');
}
});
} }
if (val && val.length) { if (val && val.length) {
if (!this.addModel.code) { if (!this.addModel.code) {
this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1]; this.$refs.protect.addModel.unlockSectionCode = val[val.length - 1];
} }
val.forEach((item) => { this.changeSectionSelected(val, true, 'routePhysicalSection');
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(true, 'routePhysicalSection');
});
} else {
section.instance.drawBatchSelected(true, 'routePhysicalSection');
}
});
} }
} }
}, },
@ -496,9 +478,19 @@ export default {
}); });
}, },
routeSectionListFocus(flag) { routeSectionListFocus(flag) {
this.addModel.routeSectionList.forEach((item) => { this.changeSectionSelected(this.addModel.routeSectionList, flag, 'routePhysicalSection');
this.$refs['protect'].routeSectionListFocus(flag);
},
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item); const section = this.$store.getters['map/getDeviceByCode'](item);
section.instance.drawBatchSelected(flag); if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section.instance.drawBatchSelected(flag, flag ? type : '');
}
}); });
}, },
setSelected(selected) { setSelected(selected) {

View File

@ -41,7 +41,7 @@
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '03'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode"> <el-form-item v-if="createModel.type == '03'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable> <el-select v-model="createModel.leftSectionCode" filterable>
<el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" /> <el-option v-for="item in switchAndPhySicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
</el-select> </el-select>
<el-button <el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'" :type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -54,7 +54,7 @@
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '02' || createModel.type == '04'" label="起始区段:" prop="leftSectionCode"> <el-form-item v-if="createModel.type == '02' || createModel.type == '04'" label="起始区段:" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable> <el-select v-model="createModel.leftSectionCode" filterable>
<el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" /> <el-option v-for="item in switchAndPhySicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
</el-select> </el-select>
<el-button <el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'" :type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -65,7 +65,7 @@
<el-form-item v-if="createModel.type == '02'" :label="$t('map.rightAssociatedSection')" prop="rightSectionCode"> <el-form-item v-if="createModel.type == '02'" :label="$t('map.rightAssociatedSection')" prop="rightSectionCode">
<el-select v-model="createModel.rightSectionCode" filterable> <el-select v-model="createModel.rightSectionCode" filterable>
<el-option <el-option
v-for="item in PhysicalSectionList" v-for="item in switchAndPhySicalSectionList"
:key="item.code" :key="item.code"
:label="item.name" :label="item.name"
:value="item.code" :value="item.code"
@ -381,8 +381,8 @@ export default {
{ prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' } { prop: 'namePosition.y', firstLevel: 'namePosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '25px' }
] }, ] },
{ prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList}, { prop: 'type', label: this.$t('map.sectionType'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionTypeList},
{ prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.PhysicalSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow, isHidden: !this.hasAssociatedSection}, { prop: 'leftSectionCode', label: this.$t('map.leftAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.switchAndPhySicalSectionList, hover: this.hover, buttonType: 'leftSection', buttonShowType: this.isLeftSectionButtonShow, isHidden: !this.hasAssociatedSection},
{ prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.PhysicalSectionList, hover: this.hover, buttonType: 'rightSection', buttonShowType: this.isRightSectionButtonShow, isHidden: !this.hasAssociatedSection}, { prop: 'rightSectionCode', label: this.$t('map.rightAssociatedSection'), type: 'selectHover', optionLabel: 'name&&code', optionValue: 'code', clearable: true, options: this.switchAndPhySicalSectionList, hover: this.hover, buttonType: 'rightSection', buttonShowType: this.isRightSectionButtonShow, isHidden: !this.hasAssociatedSection},
{ prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode }, { prop: 'parentCode', label: this.$t('map.associatedSection'), type: 'select', mode: true, optionLabel: 'name&&code', optionValue: 'code', disabled: true, options: this.sectionList, isHidden: !this.isParentCode },
{ prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType }, { prop: 'sepTypeLeft', label: this.$t('map.sepTypeLeft'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
{ prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType }, { prop: 'sepTypeRight', label: this.$t('map.sepTypeRight'), type: 'select', optionLabel: 'name', optionValue: 'code', options: this.SectionSepTypeList, isHidden: !this.isSwitchSectionType },
@ -521,6 +521,13 @@ export default {
} }
return list; return list;
}, },
switchAndPhySicalSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '01' || elem.type === '03'; });
}
return list;
},
switchSectionList() { switchSectionList() {
let list = []; let list = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
@ -1080,7 +1087,7 @@ export default {
const models = []; const models = [];
let rsection = null; let rsection = null;
let lsection = null; let lsection = null;
this.PhysicalSectionList.forEach(section => { this.switchAndPhySicalSectionList.forEach(section => {
if (section.code === this.mergeModel.lsectioncode) { if (section.code === this.mergeModel.lsectioncode) {
lsection = section; lsection = section;
} }
@ -1187,13 +1194,6 @@ export default {
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
} }
this.PhysicalSectionList.forEach(lsection => {
if (lsection.code === this.mergeModel.lsectioncode) {
this.PhysicalSectionList.forEach(rsection => {
});
}
});
} }
} }
}); });