Răsfoiți Sursa

fix:优化业务数据

刘恒 1 an în urmă
părinte
comite
fd5bed5532

+ 20 - 9
src/components/datePicker/index.vue

@@ -70,6 +70,7 @@ export default {
   },
   created() {},
   mounted() {
+    console.log(this.$props.form)
     if(this.$props.form!=undefined){
       this.timeType=this.$props.form?.timeType
       this.dateType=this.$props.form?.dateType
@@ -119,16 +120,16 @@ export default {
       if (type == 2) {
         this.$emit("getList", {
           dateType: undefined,
-          signingTimeStart: this.signingTime[0],
-          signingTimeEnd: this.signingTime[1],
+          signingTimeStart: this.signingTime[0]|| moment().format("YYYY-MM-DD"),
+          signingTimeEnd: this.signingTime[1]|| moment().format("YYYY-MM-DD"),
           timeType:this.timeType
 
         });
       } else {
         this.$emit("getList", {
           dateType: undefined,
-          enterTimeStart: this.enterTime[0],
-          enterTimeEnd: this.enterTime[1],
+          enterTimeStart: this.enterTime[0]|| moment().format("YYYY-MM-DD"),
+          enterTimeEnd: this.enterTime[1]|| moment().format("YYYY-MM-DD"),
           timeType:this.timeType
 
         });
@@ -136,18 +137,28 @@ export default {
     },
     timeTypeChange(val) {
       this.dateType = undefined;
+
       if (val == 2) {
+        this.signingTime=[
+          moment().format("YYYY-MM-DD"),
+          moment().format("YYYY-MM-DD")
+        ]
         this.$emit("getList", {
           dateType: undefined,
-          signingTimeStart: this.signingTime[0],
-          signingTimeEnd: this.signingTime[1],
+          signingTimeStart: this.signingTime[0] ,
+          signingTimeEnd: this.signingTime[1] ,
+          timeType:this.timeType
         });
       } else {
+        this.enterTime=[
+          moment().format("YYYY-MM-DD"),
+          moment().format("YYYY-MM-DD")
+        ]
         this.$emit("getList", {
           dateType: undefined,
-
-          enterTimeStart: this.enterTime[0],
-          enterTimeEnd: this.enterTime[1],
+          timeType:this.timeType,
+          enterTimeStart: this.enterTime[0] ,
+          enterTimeEnd: this.enterTime[1] ,
         });
       }
     },

+ 40 - 37
src/components/tree/agentChanell.vue

@@ -2,8 +2,8 @@
 <template>
   <div class="tree">
     <a-tree
-      v-if="treeData && treeData.length > 0 && type == 'a'"
-      :tree-data="treeData"
+      v-if="list && list.length > 0 && type == 'a'"
+      :tree-data="list"
       :title="'11'"
       :replaceFields="replaceFields"
       @select="onSelect"
@@ -19,8 +19,8 @@
       </template>
     </a-tree>
     <a-tree
-      v-if="userTreeData && userTreeData.length > 0 && type == 'b'"
-      :tree-data="userTreeData"
+      v-if="list && list.length > 0 && type == 'b'"
+      :tree-data="list"
       :title="'11'"
       :replaceFields="replaceFields"
       @select="onSelect"
@@ -54,6 +54,9 @@ export default {
     managementSource: {
       default: "",
     },
+    list: {
+      default: [],
+    },
     // defaultCheckList: {
     //   default: [],
     // },
@@ -85,7 +88,7 @@ export default {
     // },
   },
   created() {
-    this.getUserTree();
+    console.log( this.$props.list)
   },
   mounted() {},
   methods: {
@@ -113,38 +116,38 @@ export default {
           });
       });
     },
-    getUserTree() {
-      // console.log(this.userInfo);
-      this.$API.business
-        .findAgentChanellTree({
-          managementSource: this.$props.managementSource,
-        })
-        .then((res) => {
-          if (res.data.code === 200) {
-            this.$emit("showTab", {
-              type: res.data.data.type,
-              userId:
-                res.data.data.userList!=null 
-                  ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
-                  : "" :'',
-              agencyId:
-                res.data.data.deptList!=null 
-                  ? res.data.data.deptList.length>0 ?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;
-          }
-        });
-    },
+    // getUserTree() {
+    //   // console.log(this.userInfo);
+    //   this.$API.business
+    //     .findAgentChanellTree({
+    //       managementSource: this.$props.managementSource,
+    //     })
+    //     .then((res) => {
+    //       if (res.data.code === 200) {
+    //         this.$emit("showTab", {
+    //           type: res.data.data.type,
+    //           userId:
+    //             res.data.data.userList!=null 
+    //               ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
+    //               : "" :'',
+    //           agencyId:
+    //             res.data.data.deptList!=null 
+    //               ? res.data.data.deptList.length>0 ?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;
+    //       }
+    //     });
+    // },
 
     onSelect(keys) {
       this.$emit("getList", { id: keys[0], type: this.$props.type });

+ 46 - 27
src/pages/business/agent.vue

@@ -31,9 +31,10 @@
         <tree
           @getList="chooseUser"
           :type="radio"
-          @showTab="showTab"
+        
           :managementSource="2"
           ref="treeManage"
+           :list="radio=='a' ?treeData :userTreeData"
         ></tree>
       </div>
     </div>
@@ -309,11 +310,7 @@ export default {
       cityList: [],
       areaList: [],
       storeList: [],
-      treeData: [
-        { title: "Expand to load", key: "0" },
-        { title: "Expand to load", key: "1" },
-        { title: "Tree Node", key: "2", isLeaf: true },
-      ],
+     
       amount: {},
       radio: "a",
       treeType: 1,
@@ -321,7 +318,9 @@ export default {
       agencyId: "",
       treeUserId:"",
       dateType:"",
-      timeType:""
+      timeType:"",
+      userTreeData:[],
+      treeData:[]
     };
   },
   created() {},
@@ -332,19 +331,47 @@ export default {
     // this.$refs.treeManage.getUserTree();
   },
   methods: {
-    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;
+    timeChange(val) {
+      // console.log(val);
+      this.dateType=val.dateType
+      this.timeType=val.timeType
+      this.formState = { ...val };
+      this.formState.treeUserId =  this.treeUserId;
 
-      this.userId = val.userId;
-      this.getList();
+      this.getUserTree();
     },
+    getUserTree() {
+      // console.log(this.userInfo);
+      this.$API.business
+        .findAgentChanellTree({
+          managementSource: 2,
+        })
+        .then((res) => {
+          if (res.data.code === 200) {
+            if (this.radio == "a") {
+              this.treeType = 1;
+              this.formState.treeUserId = res.data.data.deptList!=null 
+                  ? res.data.data.deptList.length>0 ?res.data.data.deptList[0].id
+                  : "" :''
+            } else {
+              this.treeType = 2;
+              this.formState.treeUserId = res.data.data.userList!=null 
+                  ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
+                  : "" :''
+            }
+            this.agencyId =  res.data.data.deptList!=null 
+                  ? res.data.data.deptList.length>0 ?res.data.data.deptList[0].id
+                  : "" :'';
+            this.userId = res.data.data.userList!=null 
+                  ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
+                  : "" :'';
+            this.userTreeData = res.data.data.userList;
+            this.treeData = res.data.data.deptList;
+            this.getList();
+          }
+        });
+    },
+    
     treeChange() {
       if (this.radio == "a") {
         this.treeType = 1;
@@ -355,14 +382,6 @@ export default {
       }
       this.getList();
     },
-    timeChange(val) {
-      this.dateType=val.dateType
-      this.timeType=val.timeType
-      this.formState = { ...val };
-      this.formState.treeUserId =  this.treeUserId;
-      this.getList();
-    },
-
     chooseUser(val) {
       this.formState.treeUserId = val.id;
       this.treeUserId=val
@@ -372,7 +391,7 @@ export default {
       } else {
         this.treeType = 2;
       }
-      this.getList();
+      this.getVerification();
     },
     getList() {
       this.pagination.current = 1;

+ 50 - 18
src/pages/business/channel.vue

@@ -9,6 +9,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>
@@ -19,8 +20,9 @@
         <tree
           @getList="chooseUser"
           :type="radio"
-          @showTab="showTab"
+         
           :managementSource="1"
+          :list="radio=='a' ?treeData :userTreeData"
         ></tree>
       </div>
     </div>
@@ -323,25 +325,27 @@ export default {
       cityList: [],
       areaList: [],
       storeList: [],
-      treeData: [
-        { title: "Expand to load", key: "0" },
-        { title: "Expand to load", key: "1" },
-        { title: "Tree Node", key: "2", isLeaf: true },
-      ],
+      // treeData: [
+      //   { title: "Expand to load", key: "0" },
+      //   { title: "Expand to load", key: "1" },
+      //   { title: "Tree Node", key: "2", isLeaf: true },
+      // ],
       amount: {},
       treeType: "",
       radio: "a",
       disabled: false,
       treeUserId:"",
       dateType:"",
-      timeType:""
+      timeType:"",
+      treeData: [],
+      userTreeData: [],
     };
   },
   created() {},
   mounted() {
     // setTimeout(() => {
     // }, 1000);
-    // this.getVerification();
+    // this.getUserTree()
   },
   methods: {
     timeChange(val) {
@@ -351,20 +355,48 @@ export default {
       this.formState = { ...val };
       this.formState.treeUserId =  this.treeUserId;
 
-      this.getList();
+      this.getUserTree();
     },
-    showTab(val) {
-      // console.log(val);
+    getUserTree() {
+      // console.log(this.userInfo);
+      this.$API.business
+        .findAgentChanellTree({
+          managementSource: 1,
+        })
+        .then((res) => {
+          if (res.data.code === 200) {
+            if (this.radio == "a") {
+              this.treeType = 1;
+              this.formState.treeUserId = res.data.data.deptList!=null 
+                  ? res.data.data.deptList.length>0 ?res.data.data.deptList[0].id
+                  : "" :''
+            } else {
+              this.treeType = 2;
+              this.formState.treeUserId = res.data.data.userList!=null 
+                  ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
+                  : "" :''
+            }
+            this.agencyId =  res.data.data.deptList!=null 
+                  ? res.data.data.deptList.length>0 ?res.data.data.deptList[0].id
+                  : "" :'';
+            this.userId = res.data.data.userList!=null 
+                  ? res.data.data.userList.length>0 ?res.data.data.userList[0].id
+                  : "" :'';
+            this.userTreeData = res.data.data.userList;
+            this.treeData = res.data.data.deptList;
+            this.getList();
+          }
+        });
+    },
+    
+    treeChange() {
       if (this.radio == "a") {
         this.treeType = 1;
-        this.formState.treeUserId = val.agencyId;
+        this.formState.treeUserId = this.agencyId;
       } else {
         this.treeType = 2;
-        this.formState.treeUserId = val.userId;
+        this.formState.treeUserId = this.userId;
       }
-      this.agencyId = val.agencyId;
-
-      this.userId = val.userId;
       this.getList();
     },
     chooseUser(val) {
@@ -417,7 +449,7 @@ export default {
 
     async getVerification() {
       this.loading = true;
-
+    
       this.$API.business
         .getBusinessAgentList({
           pageNum: this.pagination.current,
@@ -431,7 +463,7 @@ export default {
         .then((res) => {
           if (res.data.code === 200) {
             this.loading = false;
-            this.tableList = res.data.data.records;
+            this.tableList = res.data.data?.records || [];
             this.pagination = {
               current: res.data.data.current,
               defaultPageSize: res.data.data.size,