瀏覽代碼

选择区域回显

chenrui 2 年之前
父節點
當前提交
cb0a2100e7

+ 42 - 45
src/views/dealerManagement/businessOwnerSettings/chooseAreaModal.vue

@@ -83,55 +83,52 @@ export default {
               })
             }
           })
-          this.subregionData = res.data
-
-          // this.handleChooseData()
-          this.checkedKeys = this.chooseData ? this.chooseData : []
+          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 : []
         }
       })
     },
     // 将选择过的禁用掉
-    // handleChooseData () {
-    //   console.log(area, 22222222)
-    //   if (this.chooseData && this.chooseData.checked && this.chooseData.checked.length > 0) {
-    //     var area = [] // 区域
-    //     var zone = []// 分区
-    //     this.chooseData.checked.forEach(con => {
-    //       if (con.indexOf('_') == -1) {
-    //         area.push(con)
-    //       } else {
-    //         zone.push(con)
-    //       }
-    //     })
-    //   }
-    //   console.log(area, 22222222)
-    //   console.log(zone, 33333333)
-    //   // if (this.subregionData && this.subregionData.length > 0) {
-    //   //   if (area.length > 0) {
-    //   //     this.subregionData.forEach(item => {
-    //   //       area.forEach(list => {
-    //   //         if (item.areaSn == list) {
-    //   //           item.disabled = true
-    //   //           if (item.subareaAreaList && item.subareaAreaList.length > 0 && zone.length > 0) {
-    //   //             item.subareaAreaList.forEach(con => {
-    //   //               zone.forEach(row => {
-    //   //                 if (con.areaSn == row) {
-    //   //                   con.disableCheckbox = true
-    //   //                 } else {
-    //   //                   con.disableCheckbox = false
-    //   //                 }
-    //   //               })
-    //   //             })
-    //   //           }
-    //   //         } else {
-    //   //           item.disabled = false
-    //   //         }
-    //   //       })
-    //   //     })
-    //   //   }
-    //   // }
-    //   console.log(this.subregionData, 1111111111111111)
-    // },
+    handleChooseData (subregionData) {
+     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
+              }
+            })
+            }
+            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 () {
       this.$emit('ok', this.checkedKeys)
     },

+ 1 - 1
src/views/dealerManagement/businessOwnerSettings/settingsIndex.vue

@@ -239,7 +239,6 @@ export default {
     },
     // 选择区域
     async openAreaModal () {
-      this.$refs.partQuery.pageInit()
       const _this = this
       const checkedArr = []
       const dataList = await queryAreaScope({ userSn: this.$route.query.sn })
@@ -256,6 +255,7 @@ export default {
       } else {
         this.newChooseData.checked = []
       }
+      this.$refs.partQuery.pageInit()
       _this.$nextTick(() => {
         _this.openChooseArea = true
       })