Parcourir la source

fix:业务数据代理人树形更改

刘恒 il y a 2 ans
Parent
commit
68dffd266a

+ 145 - 0
src/components/tree/agentChanell.vue

@@ -0,0 +1,145 @@
+
+<template>
+  <div class="tree">
+    <a-tree
+      v-if="treeData && treeData.length > 0 && type"
+      :tree-data="treeData"
+      :title="'11'"
+      :replaceFields="replaceFields"
+      @select="onSelect"
+      :checkable="checkable"
+      @check="onCheck"
+      v-model="checkList"
+      :auto-expand-parent="autoExpandParent"
+      :expanded-keys="expandedKeys"
+      @expand="onExpand"
+      ref="tree"
+    >
+      <template slot="custom" slot-scope="item">
+        <span>{{ item }}</span>
+        <!-- <span style="color: #f50">({{ item.num }})</span> -->
+      </template>
+    </a-tree>
+    <a-tree
+      v-if="userTreeData && userTreeData.length > 0 && type == false"
+      :tree-data="userTreeData"
+      :title="'11'"
+      :replaceFields="replaceFields"
+      @select="onSelect"
+      :checkable="checkable"
+      @check="onCheck"
+      v-model="checkList"
+      :auto-expand-parent="autoExpandParent"
+      :expanded-keys="expandedKeys"
+      @expand="onExpand"
+      ref="tree"
+    >
+      <template slot="custom" slot-scope="item">
+        <span>{{ item }}</span>
+        <!-- <span style="color: #f50">({{ item.num }})</span> -->
+      </template>
+    </a-tree>
+  </div>
+</template>
+      
+      <script>
+// import mixin from "../../minins/mixin";
+import { mapState } from "vuex";
+export default {
+  name: "FormRow",
+  //   mixins: [mixin],
+  props: {
+    checkable: {
+      default: false,
+    },
+    type: {
+      default: true,
+    },
+    // defaultCheckList: {
+    //   default: [],
+    // },
+  },
+  data() {
+    return {
+      treeData: [],
+      userTreeData: [],
+      replaceFields: {
+        children: "children",
+        title: "name",
+        key: "id",
+      },
+      checkList: [],
+      autoExpandParent: true,
+      expandedKeys: [],
+    };
+  },
+
+  computed: {
+    ...mapState("setting", ["userInfo"]),
+  },
+  watch: {
+    // type(val) {
+    //   //
+    //   console.log(val);
+    // },
+  },
+  created() {},
+  mounted() {
+    this.getUserTree();
+  },
+  methods: {
+    onExpand(expandedKeys) {
+      this.expandedKeys = expandedKeys;
+      //expandedKeys
+      this.autoExpandParent = true;
+    },
+    setExpandKys(item) {
+      this.$nextTick(() => {
+        // this.$refs.tree.expandedKeys = ["99D17"];
+        // this.$refs.tree.defaultExpandedKeys = ["99D17"];
+        // console.log(this.$refs.tree);
+        // this.expandedKeys = ["99D17"];
+        // this.checkList = ["99D17"];
+        this.$API.sysManage
+          .getUserItem({
+            userId: item.userId,
+          })
+          .then((res) => {
+            if (res.data.code === 200) {
+              this.expandedKeys = res.data.data.deptIds;
+              this.checkList = res.data.data.deptIds;
+            }
+          });
+      });
+    },
+    getUserTree() {
+      // console.log(this.userInfo);
+      this.$API.business.findAgentChanellTree({}).then((res) => {
+        if (res.data.code === 200) {
+          this.$emit("showTab", res.data.data.type);
+          this.userTreeData = res.data.data.userList;
+
+          this.treeData = res.data.data.deptList;
+        }
+      });
+    },
+
+    onSelect(keys) {
+      this.$emit("getList", { id: keys[0], type: this.$props.type });
+    },
+    onCheck(checkedKeys) {
+      this.$emit("checkTree", checkedKeys);
+
+      // this.checkedKeys = checkedKeys;
+    },
+  },
+};
+</script>
+      
+    <style lang="less" scoped>
+.tree {
+  height: 100%;
+  // overflow-y: auto;
+}
+</style>
+      

+ 60 - 8
src/pages/business/agent.vue

@@ -1,10 +1,23 @@
 <template>
   <div class="quote">
     <div class="quote-tree" style="border-radius: 8px">
-      <div><h2>组织树</h2></div>
+      <div>
+        <h2>组织树</h2>
+        <!-- <a-tabs default-active-key="1" :tab-position="tabPosition">
+          <a-tab-pane key="1" tab="Tab 1"> 部门 </a-tab-pane>
+          <a-tab-pane key="2" tab="Tab 2"> 人员 </a-tab-pane>
+        </a-tabs> -->
+        <a-switch
+          v-model="radio"
+          checked-children="机构"
+          un-checked-children="人员"
+          default-checked
+          :disabled="disabled"
+        />
+      </div>
       <div>
         <!-- <a-tree  :tree-data="treeData" /> -->
-        <tree @getList="chooseUser"></tree>
+        <tree @getList="chooseUser" :type="radio" @showTab="showTab"></tree>
       </div>
     </div>
     <div class="back-line-main">
@@ -12,6 +25,12 @@
         <div class="back-line-header-title">
           <h2>合计</h2>
           <div>
+            <dl>
+              <dt><span>总人数</span></dt>
+              <dd>
+                <span>{{ amount.sumPremium || 0 }}</span>
+              </dd>
+            </dl>
             <dl>
               <dt><span>签单保费</span></dt>
               <dd>
@@ -32,7 +51,7 @@
               <dt><span>交强险保费</span></dt>
               <dd>
                 <span>
-                  {{ amount.jqpremium }}
+                  {{ amount.jqpremium || 0 }}
                 </span>
               </dd>
             </dl>
@@ -40,7 +59,7 @@
               <dt><span>车船税</span></dt>
               <dd>
                 <span>
-                  {{ amount.taxamount }}
+                  {{ amount.taxamount || 0 }}
                 </span>
               </dd>
             </dl>
@@ -174,7 +193,7 @@
   <script>
 import StandardTable from "@/components/table/StandardTable";
 // import mixin from "../../minins/mixin";
-import tree from "@/components/tree/userTree";
+import tree from "@/components/tree/agentChanell";
 import moment from "moment";
 
 const columns = [
@@ -186,7 +205,10 @@ const columns = [
   {
     title: "工号",
     dataIndex: "userId",
-    // scopedSlots: { customRender: "parterCompanyName" },
+  },
+  {
+    title: "归属机构",
+    dataIndex: "userId",
   },
 
   {
@@ -224,6 +246,7 @@ export default {
   //   mixins: [mixin],
   data() {
     return {
+      radio: true,
       formState: {
         dateType: undefined,
         time: [moment().format("YYYY-MM-DD"), moment().format("YYYY-MM-DD")],
@@ -259,6 +282,8 @@ export default {
         { title: "Tree Node", key: "2", isLeaf: true },
       ],
       amount: {},
+      disabled: false,
+      treeType: "",
     };
   },
   mounted() {
@@ -267,8 +292,19 @@ export default {
     // }, 1000);
   },
   methods: {
+    showTab(val) {
+      // console.log(val);
+      if (val == 1) {
+        this.disabled = true;
+      }
+    },
     chooseUser(val) {
-      this.formState.treeUserId = val;
+      this.formState.treeUserId = val.id;
+      if (val.type) {
+        this.treeType = 1;
+      } else {
+        this.treeType = 2;
+      }
       this.getVerification();
     },
     getList() {
@@ -308,6 +344,7 @@ export default {
           pageSize: this.pagination.defaultPageSize,
           ...this.formState,
           managementSource: 2,
+          treeType: this.treeType,
         })
         .then((res) => {
           if (res.data.code === 200) {
@@ -324,6 +361,7 @@ export default {
         .getBusinessAgentTotalList({
           ...this.formState,
           managementSource: 2,
+          treeType: this.treeType,
         })
         .then((res) => {
           if (res.data.code === 200) {
@@ -363,7 +401,17 @@ export default {
     flex-direction: column;
     //
     > div:first-child {
+      display: flex;
+      align-items: center;
+      h2 {
+        margin: 0;
+      }
       border-bottom: 1px solid #f0f0f0;
+      padding-bottom: 5px;
+      box-sizing: border-box;
+      .ant-switch {
+        margin-left: 10px;
+      }
     }
     > div:last-child {
       flex: 1;
@@ -397,7 +445,7 @@ export default {
         justify-content: space-between;
         > dl {
           flex: none;
-          width: 180px;
+          width: 150px;
           height: 80px;
           display: flex;
           //   align-items: center;
@@ -445,6 +493,10 @@ export default {
           background: url("../../assets/img/business6.png");
           color: #47a2eb;
         }
+        > dl:nth-child(7) {
+          background: url("../../assets/img/business6.png");
+          color: #f879cd;
+        }
       }
       span {
         display: block;

+ 8 - 1
src/services/business.js

@@ -30,6 +30,12 @@ export async function findNextAgentTree(data) {
     return request("/user/findNextAgentTree", METHOD.GET, data)
 }
 
+//获取树形结构代理人及渠道
+export async function findAgentChanellTree(data) {
+    return request("/dept/getUserDeptTree", METHOD.POST, data)
+}
+
+
 
 
 
@@ -40,5 +46,6 @@ export default {
     getBusinessAgentTotalList,
     getUserTree,
     getBusinessAgentTotalDetails,
-    findNextAgentTree
+    findNextAgentTree,
+    findAgentChanellTree
 }

BIN
控制台-生产.zip