Jelajahi Sumber

Merge branch 'develop_yh13' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_yh13

lilei 2 tahun lalu
induk
melakukan
ec3beedc49

+ 24 - 34
src/views/dealerManagement/businessOwnerSettings/chooseAreaModal.vue

@@ -83,9 +83,9 @@ export default {
               })
             }
           })
-          if(this.chooseData && this.chooseData.checked && this.chooseData.checked.length > 0){
-             this.handleChooseData(res.data)
-          }else{
+          if (this.chooseData && this.chooseData.checked && this.chooseData.checked.length > 0) {
+            this.handleChooseData(res.data)
+          } else {
             this.subregionData = res.data
           }
           // this.checkedKeys = this.chooseData ? this.chooseData : []
@@ -94,39 +94,29 @@ export default {
     },
     // 将选择过的禁用掉
     handleChooseData (subregionData) {
-     var area = [] // 区域
-     var zone = []// 分区
-     this.chooseData.checked.forEach(con => {
-       if (con.indexOf('_') == -1) {
-         area.push(con)
-       } else {
-         zone.push(con)
-       }
-     })
+      var area = [] // 区域
+      var zone = []// 分区
+      this.chooseData.checked.forEach(con => {
+        if (con.indexOf('_') == -1) {
+          area.push(con)
+        } else {
+          zone.push(con)
+        }
+      })
       if (subregionData && subregionData.length > 0) {
-         subregionData.forEach(item => {
-        if (area && area.length > 0) {
-            area.forEach(list => {
-              if (item.areaSn == list) {
-                item.disabled = true
-              } else {
-                item.disabled = false
-              }
+        subregionData.forEach(item => {
+          if (area && area.length > 0) {
+            item.disabled = area.includes(item.areaSn)
+            item.disableCheckbox = area.includes(item.areaSn)
+          }
+          if (item.subareaAreaList && item.subareaAreaList.length > 0) {
+            item.subareaAreaList.forEach(con => {
+              con.disabled = zone.includes(con.areaSn)
+              con.disableCheckbox = zone.includes(con.areaSn)
             })
-            }
-            if (item.subareaAreaList && item.subareaAreaList.length > 0 && zone && zone.length > 0 ) {
-              item.subareaAreaList.forEach(con => {
-                zone.forEach(row => {
-                  if (con.areaSn == row) {
-                    con.disableCheckbox = true
-                  } else {
-                    con.disableCheckbox = false
-                  }
-                })
-              })
-            }
-          })
-        }
+          }
+        })
+      }
       this.subregionData = subregionData
     },
     save () {