刘恒 1 год назад
Родитель
Сommit
422a1432ad
3 измененных файлов с 65 добавлено и 14 удалено
  1. 23 3
      src/components/tree/agentChanell.vue
  2. 32 9
      src/pages/business/agent.vue
  3. 10 2
      src/pages/business/channel.vue

+ 23 - 3
src/components/tree/agentChanell.vue

@@ -70,6 +70,8 @@ export default {
       checkList: [],
       autoExpandParent: true,
       expandedKeys: [],
+      userId: "",
+      agencyId: "",
     };
   },
 
@@ -82,10 +84,10 @@ export default {
     //   console.log(val);
     // },
   },
-  created() {},
-  mounted() {
+  created() {
     this.getUserTree();
   },
+  mounted() {},
   methods: {
     onExpand(expandedKeys) {
       this.expandedKeys = expandedKeys;
@@ -119,7 +121,25 @@ export default {
         })
         .then((res) => {
           if (res.data.code === 200) {
-            this.$emit("showTab", res.data.data.type);
+            this.$emit("showTab", {
+              type: res.data.data.type,
+              userId:
+                res.data.data.userList != null
+                  ? res.data.data.userList[0].id
+                  : "",
+              agencyId:
+                res.data.data.deptList != null
+                  ? res.data.data.deptList[0].id
+                  : "",
+            });
+            // this.userId =
+            //   res.data.data.userList != null
+            //     ? res.data.data.userList[0].id
+            //     : "";
+            // this.agencyId =
+            //   res.data.data.deptList != null
+            //     ? res.data.data.deptList[0].id
+            //     : "";
             this.userTreeData = res.data.data.userList;
             this.treeData = res.data.data.deptList;
           }

+ 32 - 9
src/pages/business/agent.vue

@@ -20,6 +20,7 @@
           v-model="radio"
           style="margin-left: 10px"
           size="small"
+          @change="treeChange"
         >
           <a-radio-button value="a"> 机构 </a-radio-button>
           <a-radio-button value="b"> 人员 </a-radio-button>
@@ -32,6 +33,7 @@
           :type="radio"
           @showTab="showTab"
           :managementSource="2"
+          ref="treeManage"
         ></tree>
       </div>
     </div>
@@ -313,27 +315,48 @@ export default {
       ],
       amount: {},
       radio: "a",
-      disabled: false,
       treeType: 1,
+      userId: "",
+      agencyId: "",
     };
   },
+  created() {},
   mounted() {
     // this.getVerification();
     // setTimeout(() => {
     // }, 1000);
+    // this.$refs.treeManage.getUserTree();
   },
   methods: {
-    timeChange(val) {
-      // console.log(val);
-      this.formState = { ...val };
+    showTab(val) {
+      if (this.radio == "a") {
+        this.treeType = 1;
+        this.formState.treeUserId = val.agencyId;
+      } else {
+        this.treeType = 2;
+        this.formState.treeUserId = val.userId;
+      }
+      this.agencyId = val.agencyId;
+
+      this.userId = val.userId;
       this.getList();
     },
-    showTab(val) {
-      // console.log(val);
-      if (val == 1) {
-        this.disabled = true;
+    treeChange() {
+      if (this.radio == "a") {
+        this.treeType = 1;
+        this.formState.treeUserId = this.agencyId;
+      } else {
+        this.treeType = 2;
+        this.formState.treeUserId = this.userId;
       }
+      this.getList();
+    },
+    timeChange(val) {
+      this.formState = { ...val };
+
+      // this.getList();
     },
+
     chooseUser(val) {
       this.formState.treeUserId = val.id;
       if (val.type == "a") {
@@ -341,7 +364,7 @@ export default {
       } else {
         this.treeType = 2;
       }
-      this.getVerification();
+      this.getList();
     },
     getList() {
       this.pagination.current = 1;

+ 10 - 2
src/pages/business/channel.vue

@@ -348,9 +348,17 @@ export default {
     },
     showTab(val) {
       // console.log(val);
-      if (val == 1) {
-        this.disabled = true;
+      if (this.radio == "a") {
+        this.treeType = 1;
+        this.formState.treeUserId = val.agencyId;
+      } else {
+        this.treeType = 2;
+        this.formState.treeUserId = val.userId;
       }
+      this.agencyId = val.agencyId;
+
+      this.userId = val.userId;
+      this.getList();
     },
     chooseUser(val) {
       this.formState.treeUserId = val.id;