调整信号机接近区段颜色变化

This commit is contained in:
fan 2020-03-11 16:58:14 +08:00
parent 3273724484
commit 939360917e
3 changed files with 56 additions and 13 deletions

View File

@ -125,5 +125,7 @@ export default class defaultStyle {
export const drawSectionStyle = {
routePhysicalSection: 'rgba(255,255,0,0.5)',
continueProtectSection: 'rgba(255,0,255,0.5)',
signalNearSection: 'rgba(255, 0, 0, 0.5)'
signalNearSectionCBTC: 'rgba(255, 0, 0, 0.5)',
signalNearSectionReserve: 'rgba(160, 32, 240, 0.5)',
signalNearSection: 'rgba(124, 252, 0, 0.5)'
};

View File

@ -863,7 +863,7 @@ export default class Section extends Group {
if (this.selectedType === type) {
return;
}
if (selected && !this.selectedType) {
if (selected && type) {
this.section && this.section.setStyle({ stroke: drawSectionStyle[type] });
} else {
this.section && this.section.setStyle({ stroke: this.style.Section.line.spareColor });

View File

@ -127,6 +127,9 @@ export default {
]),
newRouteSectionList() {
return JSON.stringify(this.addModel.routeSectionList);
},
newBlockSectionList() {
return JSON.stringify(this.addModel.blockSectionList);
}
},
watch: {
@ -145,10 +148,23 @@ export default {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, false, 'signalNearSection');
this.changeSectionSelected(objOld, true);
}
if (obj && obj.length) {
this.changeSectionSelected(obj, true, 'signalNearSection');
this.changeSectionSelected(obj, true);
}
},
deep: true
},
newBlockSectionList: {
handler: function(val, old) {
const obj = JSON.parse(val);
const objOld = JSON.parse(old);
if (objOld && objOld.length) {
this.changeSectionSelected(objOld, true);
}
if (obj && obj.length) {
this.changeSectionSelected(obj, true);
}
},
deep: true
@ -209,6 +225,8 @@ export default {
} else if (selected._type.toUpperCase() === 'Section'.toUpperCase() && this.field.toUpperCase() === 'blockSectionList'.toUpperCase()) {
if ((selected.type === '01' || selected.type === '03') && this.addModel.blockSectionList.indexOf(selected.code) === -1) {
this.addModel.blockSectionList.push(selected.code);
} else if (selected.type === '02' && this.addModel.blockSectionList.indexOf(selected.parentCode) === -1) {
this.addModel.blockSectionList.push(selected.parentCode);
}
}
}
@ -262,25 +280,48 @@ export default {
}
},
batchSectionListFocus(flag) {
this.changeSectionSelected(this.addModel.routeSectionList, flag, 'signalNearSection');
this.changeSectionSelected(this.addModel.routeSectionList, flag);
this.changeSectionSelected(this.addModel.blockSectionList, flag);
this.changeSignalSelected(this.addModel.signalCode, flag, 'routeSignal');
},
changeSignalSelected(val, flag, type) {
const signal = this.$store.getters['map/getDeviceByCode'](val);
signal && signal.instance.drawBatchSelected(flag, flag ? type : '');
},
changeSectionSelected(list, flag, type) {
changeSectionSelected(list, cutOut) {
let flag = true;
let type = '';
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section && section.instance.drawBatchSelected(flag, flag ? type : '');
if (!cutOut) {
this.setSectionSelectedType(section, cutOut, '');
return;
}
if (this.addModel.routeSectionList.indexOf(item) !== -1 && this.addModel.blockSectionList.indexOf(item) !== -1) {
type = 'signalNearSection';
flag = true;
} else if (this.addModel.routeSectionList.indexOf(item) !== -1) {
type = 'signalNearSectionCBTC';
flag = true;
} else if (this.addModel.blockSectionList.indexOf(item) !== -1) {
type = 'signalNearSectionReserve';
flag = true;
} else {
type = '';
flag = false;
}
this.setSectionSelectedType(section, flag, type);
});
},
setSectionSelectedType(section, flag, type) {
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
}
}
};