tongshanglei 3 jaren geleden
bovenliggende
commit
64ab349b4d
1 gewijzigde bestanden met toevoegingen van 35 en 34 verwijderingen
  1. 35 34
      src/components/Cascader/Regionals.vue

+ 35 - 34
src/components/Cascader/Regionals.vue

@@ -184,41 +184,42 @@ export default {
          */
         getAuthedArea() {
             this.treeOptions=[]
+            this.treeOptions = this.formatAreaData(this.regionalId);
+            return
             // this.$http.get(this.loadUrl + '?token='+this.$store.state.user.token)
-            this.$http.get(this.loadUrl)
-                      .then(resp => {
-                            if (resp.code !== 10000) {
-                                this.$message.fail(resp.message)
-                            }
-                            this.userData = resp.data;
-                            // 追加数据
-                            this.userData.forEach(item => {
-                                this.appendToRegionalData(item.district_id, item)
-                                if (item.children) {
-                                    this.appendChildrenData(item.children)
-                                }
-                            })
-                            // 组装数据
-                            // 如果是超级管理员,显示所有
-                            if (this.$store.state.user.name == 'admin') {
-                                this.treeOptions = this.formatAreaData(this.regionalId);
-                            } else {
-                                // 否则仅显示授权地区
-                                this.userData.forEach(key => {
-                                    let item = {
-                                        id: key,
-                                        label: this.getAreaLabel(key),
-                                    }
-                                    let children = this.formatAreaData(key)
-                                    if (children) {
-                                        item.children = children
-                                    }
-                                    this.treeOptions.push(item);
-                                })
-                            }
-                            // 设置默认文本
-                            this.setDefaultCheckedText()
-                      })
+            // this.$http.get(this.loadUrl) .then(resp => {
+            //                 if (resp.code !== 10000) {
+            //                     this.$message.fail(resp.message)
+            //                 }
+            //                 this.userData = resp.data;
+            //                 // 追加数据
+            //                 this.userData.forEach(item => {
+            //                     this.appendToRegionalData(item.district_id, item)
+            //                     if (item.children) {
+            //                         this.appendChildrenData(item.children)
+            //                     }
+            //                 })
+            //                 // 组装数据
+            //                 // 如果是超级管理员,显示所有
+            //                 if (this.$store.state.user.name == 'admin') {
+            //                     this.treeOptions = this.formatAreaData(this.regionalId);
+            //                 } else {
+            //                     // 否则仅显示授权地区
+            //                     this.userData.forEach(key => {
+            //                         let item = {
+            //                             id: key,
+            //                             label: this.getAreaLabel(key),
+            //                         }
+            //                         let children = this.formatAreaData(key)
+            //                         if (children) {
+            //                             item.children = children
+            //                         }
+            //                         this.treeOptions.push(item);
+            //                     })
+            //                 }
+            //                 // 设置默认文本
+            //                 this.setDefaultCheckedText()
+            //           })
         },
         /**
          * 清除搜索文本