增加非空校验

This commit is contained in:
fan 2019-12-26 11:04:21 +08:00
parent 6ff30c5b63
commit 8431ff8cc4
3 changed files with 8 additions and 7 deletions

View File

@ -388,12 +388,13 @@ export default {
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
if (section && section.logicSectionCodeList && section.logicSectionCodeList.length) {
section.logicSectionCodeList.forEach( (logicSectionCode) => {
this.$store.getters['map/getDeviceByCode'](logicSectionCode).instance.drawBatchSelected(flag, flag ? type : '');
const logicSection = this.$store.getters['map/getDeviceByCode'](logicSectionCode);
logicSection && logicSection.instance.drawBatchSelected(flag, flag ? type : '');
});
} else {
section.instance.drawBatchSelected(flag, flag ? type : '');
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
});
},

View File

@ -512,13 +512,13 @@ export default {
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length > 0) {
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.instance.drawBatchSelected(flag, flag ? type : '');
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
});
},

View File

@ -233,13 +233,13 @@ export default {
changeSectionSelected(list, flag, type) {
list && list.forEach((item) => {
const section = this.$store.getters['map/getDeviceByCode'](item);
if (section.logicSectionCodeList && section.logicSectionCodeList.length) {
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.instance.drawBatchSelected(flag, flag ? type : '');
section && section.instance.drawBatchSelected(flag, flag ? type : '');
}
});
}