Explorar el Código

fix: 经销商列表详情

zh hace 2 años
padre
commit
4402f8666e
Se han modificado 1 ficheros con 17 adiciones y 13 borrados
  1. 17 13
      src/views/basic_data/dealer/components/dealer_list-detail.vue

+ 17 - 13
src/views/basic_data/dealer/components/dealer_list-detail.vue

@@ -453,21 +453,25 @@ export default {
     onSubmit() {
       this.pickCategory = []
       this.frontCategory = []
-      this.dataList.map(k => {
-        this.categoryArr.map(i => {
-          if (i === k.id) {
-            if (k.isFront) {
-              this.frontCategory.push(i)
+      if (this.categoryArr.length) {
+        for (let i = 0; i < this.dataList.length; i++) {
+          const item = this.dataList[i]
+          for (let j = 0; j < this.categoryArr.length; j++) {
+            const category = this.categoryArr[j]
+            if (category === item.id) {
+              if (item.isFront) {
+                this.frontCategory.push(category)
+              }
+              if (item.isPick) {
+                this.pickCategory.push(category)
+              }
             }
-            if (k.isPick) {
-              this.pickCategory.push(i)
-            }
-          } else {
-            this.$errorMsg('必须选择产品类别')
-            return
           }
-        })
-      })
+        }
+      } else {
+        this.$errorMsg('必须选择产品类别')
+        return
+      }
 
       updatePick({
         id: this.detailsId,