Browse Source

重复门店经销商维护

zhujindu 9 months ago
parent
commit
5715964140
1 changed files with 18 additions and 7 deletions
  1. 18 7
      src/views/storeManagement/chainMaintain.vue

+ 18 - 7
src/views/storeManagement/chainMaintain.vue

@@ -828,17 +828,28 @@ export default {
           });
           });
           this.showPickerChainsList = true;
           this.showPickerChainsList = true;
           this.treeSelect = res.data;
           this.treeSelect = res.data;
+          // 相同的分类(如涂料)需要合并,
+          // isCheck 禁止选择
           this.sfaStoreChainsContactList.forEach((val) => {
           this.sfaStoreChainsContactList.forEach((val) => {
             this.treeSelect.find((item) => {
             this.treeSelect.find((item) => {
               if (item.code == val.categoryCode) {
               if (item.code == val.categoryCode) {
-                item.isCheck = true;
-                item.children.push({
-                  isCheck: true,
-                  categoryCode: val.categoryCode,
-                  categoryDescribe: val.categoryDescribe,
-                  chainCode: val.chainCode,
-                  chainName: val.chainName,
+                let result = item.children.find((childrenItem) => {
+                  if (childrenItem.chainCode == val.chainCode) {
+                    item.isCheck = true;
+                    childrenItem.isCheck = true;
+                    return true;
+                  }
                 });
                 });
+                if (!result) {
+                  item.isCheck = true;
+                  item.children.push({
+                    isCheck: true,
+                    categoryCode: val.categoryCode,
+                    categoryDescribe: val.categoryDescribe,
+                    chainCode: val.chainCode,
+                    chainName: val.chainName,
+                  });
+                }
               }
               }
             });
             });
           });
           });