Explorar el Código

数据报表-人员数据-业务员组织列表 详情接口对接

祁鹏飞 hace 1 mes
padre
commit
737798c15b

+ 18 - 17
src/views/consoleManage/personDataManage/salesmanDept/index.vue

@@ -19,22 +19,22 @@
       </template>
 
       <template #customSlot="{  bodyCell: { scope, column } }">
-        <template v-if="column.prop == 'avgOrderPersonNum'">
+        <template v-if="column.prop == 'salesmanCount'">
           <div class='pointer'>
             <el-tag
-              @click='agreementEdit(scope.row.id,"salesmanDeptDetailPerson")'>{{ scope.row.avgOrderPersonNum  }}</el-tag>
+              @click='agreementEdit(scope.row.organizationId,"salesmanDeptDetailPerson")'>{{ scope.row.salesmanCount  }}</el-tag>
           </div>
         </template>
-        <template v-if="column.prop == 'sumPremium'">
+        <template v-if="column.prop == 'totalPremium'">
           <div class='pointer'>
-            <el-tag @click='agreementEdit(scope.row.id,"salesmanDeptDetail")'
-              type="success">{{ scope.row.sumPremium  }}</el-tag>
+            <el-tag @click='agreementEdit(scope.row.organizationId,"salesmanDeptDetail")'
+              type="success">{{ scope.row.totalPremium  }}</el-tag>
           </div>
         </template>
-        <template v-if="column.prop == 'underwriteOrderNum'">
+        <template v-if="column.prop == 'totalOrder'">
           <div class='pointer'>
-            <el-tag @click='agreementEdit(scope.row.id,"salesmanDeptDetail")'
-              type="success">{{ scope.row.underwriteOrderNum  }}</el-tag>
+            <el-tag @click='agreementEdit(scope.row.organizationId,"salesmanDeptDetail")'
+              type="success">{{ scope.row.totalOrder  }}</el-tag>
           </div>
 
         </template>
@@ -77,12 +77,12 @@ const listOption = reactive({
   // 表格列
   columns: [
     {
-      prop: "salesmanTypeName",
+      prop: "attribute",
       label: "类型",
       width: "100",
     },
     {
-      prop: "salesmanTypeDeptName",
+      prop: "name",
       label: "名称",
       width: "200",
     },
@@ -92,12 +92,12 @@ const listOption = reactive({
       width: "",
     },
     {
-      prop: "areaName",
+      prop: "area",
       label: "所在地区",
       width: "180",
     },
     {
-      prop: "avgOrderPersonNum",
+      prop: "salesmanCount",
       label: "出单人力",
       width: "180",
       align: "right",
@@ -105,7 +105,7 @@ const listOption = reactive({
       component: "customSlot",
     },
     {
-      prop: "sumPremium",
+      prop: "totalPremium",
       label: "保费",
       width: "180",
       align: "right",
@@ -113,7 +113,7 @@ const listOption = reactive({
       component: "customSlot",
     },
     {
-      prop: "underwriteOrderNum",
+      prop: "totalOrder",
       label: "承保订单",
       width: "180",
       align: "right",
@@ -121,7 +121,7 @@ const listOption = reactive({
       component: "customSlot",
     },
     {
-      prop: "sumPersonNum",
+      prop: "salesmanNum",
       label: "出单人数",
       width: "180",
       align: "right",
@@ -270,11 +270,12 @@ const downloadFile = async () => {
   userStore.count++;
 };
 
-const agreementEdit = (id, name) => {
+const agreementEdit = (organizationId, name) => {
   router.push({
     name,
     query: {
-      id: id,
+      organizationId,
+      ...queryFormRes.value
     },
   });
 };

+ 69 - 51
src/views/consoleManage/personDataManage/salesmanDept/salesmanDeptDetail.vue

@@ -1,33 +1,33 @@
 <template>
   <div class="log">
     <PageMain class="vh100">
-    <div class='btn-box'>
-      <el-button type="primary" plain class='query-btn'
-        @click='dialogShow'>{{selectedKeys.length?`已选${selectedKeys.length}项`:'筛选条件'}}</el-button>
-      <div class='query-btn'>
-        <DowButton @endAnim='downloadFile'></DowButton>
+      <div class='btn-box'>
+        <el-button type="primary" plain class='query-btn'
+          @click='dialogShow'>{{ selectedKeys.length ? `已选${selectedKeys.length}项` : '筛选条件' }}</el-button>
+        <div class='query-btn'>
+          <DowButton @endAnim='downloadFile'></DowButton>
+        </div>
       </div>
-    </div>
-    <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
+      <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
 
-    <!-- 表格 -->
-    <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
-      :columnwidth="120" :pageInfo="pageInfo" @getList="getList" :showOperation='false'>
-      <template v-slot:search="scope">
-        <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
-          @update:sort="handleSortUpdate"></Sort>
-      </template>
-    </ComplexTable>
+      <!-- 表格 -->
+      <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
+        :columnwidth="120" :pageInfo="pageInfo" @getList="getList" :showOperation='false'>
+        <template v-slot:search="scope">
+          <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
+            @update:sort="handleSortUpdate"></Sort>
+        </template>
+      </ComplexTable>
 
-    <FilterDialog :show='isShow' @close='isShow=false' @sure='filterSure' ref='filterDialogRef' @selectedKeys='selected'
-      routerKey='routerKey'>
-    </FilterDialog>
+      <FilterDialog :show='isShow' @close='isShow = false' @sure='filterSure' ref='filterDialogRef'
+        @selectedKeys='selected' routerKey='routerKey'>
+      </FilterDialog>
     </PageMain>
   </div>
 </template>
 
 <script setup lang="ts">
-import { useRouter } from "vue-router";
+import { useRoute } from "vue-router";
 import api from "@/api";
 import QueryForm from "../../components/queryForm.vue";
 import FilterDialog from "../../components/filterDialog.vue";
@@ -37,7 +37,7 @@ import useUserStore from "@/store/modules/message";
 import PageInfo from "@/api/types/agreementTypes";
 import { ElMessage } from "element-plus";
 
-const router = useRouter();
+const route = useRoute();
 const userStore = useUserStore();
 const isShow = ref(false);
 
@@ -55,12 +55,12 @@ const listOption = reactive({
   // 表格列
   columns: [
     {
-      prop: "salesmanName",
+      prop: "name",
       label: "业务员",
-      width: "100",
+      width: "120",
     },
     {
-      prop: "salesmanPhone",
+      prop: "mobile",
       label: "手机号",
       width: "120",
     },
@@ -70,7 +70,7 @@ const listOption = reactive({
       width: "120",
     },
     {
-      prop: "partnerCompanyName",
+      prop: "partnerCompany",
       label: "合作保险公司",
       width: "300",
     },
@@ -85,44 +85,29 @@ const listOption = reactive({
       width: "180",
     },
     {
-      prop: "orderTypeName",
+      prop: "entryStatus",
       label: "订单类型",
       width: "180",
     },
     {
-      prop: "riskName",
+      prop: "productName",
       label: "险种",
       width: "180",
     },
     {
-      prop: "sumPremium",
+      prop: "premium",
       label: "保费",
       width: "180",
       align: "right",
       sortable: true,
     },
     {
-      prop: "orderCommissionPremium",
+      prop: "commission",
       label: "出单佣金",
       width: "180",
       align: "right",
       sortable: true,
     },
-    {
-      prop: "createTime",
-      label: "录单时间",
-      width: "180",
-    },
-    {
-      prop: "recordTime",
-      label: "签单时间",
-      width: "180",
-    },
-    {
-      prop: "manegerName",
-      label: "管理人",
-      width: "180",
-    },
   ],
 });
 
@@ -139,20 +124,46 @@ const queryFormRes = ref();
 const routerKey = ref("salesmanBusinessDetail");
 const defaultList = ref();
 const pageHiddenList = ref([]); //页面不显示的数据
+const isFilterFrom = ref(); //主页面查询条件且在过滤中不存在
+
 const initDefaultList = async () => {
   const { data } = await api.manageApi.getSearchDefaultList({
     routerKey: routerKey.value,
     userId: phone,
   });
-  listOption.queryFormFields = data.filter((e) => e.showFlag);
 
-  pageHiddenList.value = data.filter((e) => !e.showFlag);
-  defaultList.value = data.map((e) => e.id);
+  const queryParamsMap = route.query;
+  const processedData = data.map((item) => {
+    if (queryParamsMap.hasOwnProperty(item.key)) {
+      let defaultValue = queryParamsMap[item.key]
+      return { ...item, defaultValue };
+    }
+    return item;
+  });
+
+  let filterFrom = {};
+  processedData.map((item) => {
+    filterFrom[item.key] = item.defaultValue;
+  });
+  isFilterFrom.value = getUniqueProperties(queryParamsMap, filterFrom);
+
+  listOption.queryFormFields = processedData.filter((e) => e.showFlag);
+  pageHiddenList.value = processedData.filter((e) => !e.showFlag);
+  defaultList.value = processedData.map((e) => e.id);
   selectedKeys.value = defaultList.value;
   queryFormRes.value = queryFormRef.value?.initDefaultSaveForm();
   queryList();
 };
 
+const getUniqueProperties = (obj1, obj2) => {
+  const uniqueProps = {};
+  Object.keys(obj1).forEach((key) => {
+    if (!(key in obj2) || obj2[key] == undefined) {
+      uniqueProps[key] = obj1[key];
+    }
+  });
+  return uniqueProps;
+};
 //删除
 const filterDialogRef = ref();
 const delSelect = (id) => {
@@ -216,16 +227,18 @@ const query = (item) => {
 //数据查询
 const tableData = ref([]);
 const queryList = async () => {
-  let query = { ...queryFormRes.value };
-  const { data } = await api.manageApi.salesmanBusinessDetailPageList({
+  let query = { ...queryFormRes.value, ...isFilterFrom.value };
+  const { data } = await api.manageApi.salesmanReportDetailPageList({
     pageNo: pageInfo.value.pageNum,
     pageSize: pageInfo.value.pageSize,
     routerKey: routerKey.value,
-    userId: phone,
+    systemCode: localStorage.getItem('login_system'),
     orderType: globalSortKey.value
       ? globalSortKey.value + " " + globalSortOrder.value
       : "",
     ...query,
+    signTimeBegin: query.createTime[0] ?? '',
+    signTimeEnd: query.createTime[1] ?? '',
   });
   tableData.value = data.records;
   pageInfo.value.pageNum = data.current;
@@ -242,16 +255,19 @@ function getList(item: PageInfo) {
 
 //导出
 const downloadFile = async () => {
-  let query = { ...queryFormRes.value };
-  const { data, msg } = await api.manageApi.salesmanBusinessDetailToTask({
+  let query = { ...queryFormRes.value, ...isFilterFrom.value };
+  const { data, msg } = await api.manageApi.salesmanReportDetailToTask({
     pageNo: pageInfo.value.pageNum,
     pageSize: pageInfo.value.pageSize,
     routerKey: routerKey.value,
+    systemCode: localStorage.getItem('login_system'),
     userId: phone,
     orderType: globalSortKey.value
       ? globalSortKey.value + " " + globalSortOrder.value
       : "",
     ...query,
+    signTimeBegin: query.createTime[0] ?? '',
+    signTimeEnd: query.createTime[1] ?? '',
   });
   ElMessage({
     message: msg,
@@ -270,6 +286,7 @@ onMounted(() => {
   .query-btn {
     margin-left: 20px;
   }
+
   .btn-box {
     padding-bottom: 15px;
     margin-bottom: 24px;
@@ -278,6 +295,7 @@ onMounted(() => {
     justify-content: flex-end;
   }
 }
+
 :deep(.caret-wrapper) {
   display: none !important;
 }

+ 75 - 61
src/views/consoleManage/personDataManage/salesmanDept/salesmanDeptDetailPerson.vue

@@ -1,39 +1,39 @@
 <template>
   <div class="log">
     <PageMain class="vh100">
-    <div class='btn-box'>
-      <el-button type="primary" plain class='query-btn'
-        @click='dialogShow'>{{selectedKeys.length?`已选${selectedKeys.length}项`:'筛选条件'}}</el-button>
-      <div class='query-btn'>
-        <DowButton @endAnim='downloadFile'></DowButton>
+      <div class='btn-box'>
+        <el-button type="primary" plain class='query-btn'
+          @click='dialogShow'>{{ selectedKeys.length ? `已选${selectedKeys.length}项` : '筛选条件' }}</el-button>
+        <div class='query-btn'>
+          <DowButton @endAnim='downloadFile'></DowButton>
+        </div>
       </div>
-    </div>
-    <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
+      <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
 
-    <!-- 表格 -->
-    <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
-      :columnwidth="120" :pageInfo="pageInfo" @getList="getList" :showOperation='false'>
-      <template v-slot:search="scope">
-        <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
-          @update:sort="handleSortUpdate"></Sort>
-      </template>
+      <!-- 表格 -->
+      <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
+        :columnwidth="120" :pageInfo="pageInfo" @getList="getList" :showOperation='false'>
+        <template v-slot:search="scope">
+          <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
+            @update:sort="handleSortUpdate"></Sort>
+        </template>
 
-      <template #customSlot="{  bodyCell: { scope, column } }">
-        <template v-if="column.prop == 'underwriteOrderNum'">
-          {{ scope.row.underwriteOrderNum }} 笔
+        <template #customSlot="{ bodyCell: { scope, column } }">
+          <template v-if="column.prop == 'totalOrder'">
+            {{ scope.row.totalOrder }} 笔
+          </template>
         </template>
-      </template>
-    </ComplexTable>
+      </ComplexTable>
 
-    <FilterDialog :show='isShow' @close='isShow=false' @sure='filterSure' ref='filterDialogRef' @selectedKeys='selected'
-      routerKey='routerKey'>
-    </FilterDialog>
+      <FilterDialog :show='isShow' @close='isShow = false' @sure='filterSure' ref='filterDialogRef'
+        @selectedKeys='selected' routerKey='routerKey'>
+      </FilterDialog>
     </PageMain>
   </div>
 </template>
 
 <script setup lang="ts">
-import { useRouter } from "vue-router";
+import { useRoute } from "vue-router";
 import api from "@/api";
 import QueryForm from "../../components/queryForm.vue";
 import FilterDialog from "../../components/filterDialog.vue";
@@ -43,7 +43,7 @@ import useUserStore from "@/store/modules/message";
 import PageInfo from "@/api/types/agreementTypes";
 import { ElMessage } from "element-plus";
 
-const router = useRouter();
+const route = useRoute();
 const userStore = useUserStore();
 const isShow = ref(false);
 
@@ -61,32 +61,27 @@ const listOption = reactive({
   // 表格列
   columns: [
     {
-      prop: "salesmanName",
+      prop: "name",
       label: "姓名",
-      width: "100",
+      width: "120",
     },
     {
-      prop: "salesmanPhone",
+      prop: "mobile",
       label: "手机号",
       width: "120",
     },
     {
       prop: "deptName",
       label: "所属机构",
-      width: "300",
-    },
-    {
-      prop: "salesmanTypeName",
-      label: "类型",
-      width: "180",
+      minWidth: "300",
     },
     {
-      prop: "salesmanTypeDeptName",
-      label: "归属",
+      prop: "area",
+      label: "所在地区",
       width: "180",
     },
     {
-      prop: "underwriteOrderNum",
+      prop: "totalOrder",
       label: "承保订单",
       width: "180",
       align: "right",
@@ -94,41 +89,26 @@ const listOption = reactive({
       component: "customSlot",
     },
     {
-      prop: "sumPremium",
+      prop: "totalAmount",
       label: "保费",
       width: "180",
       align: "right",
       sortable: true,
     },
     {
-      prop: "orderCommissionPremium",
+      prop: "totalBrokerage",
       label: "出单佣金",
       width: "180",
       align: "right",
       sortable: true,
     },
     {
-      prop: "avgOrderNumPremium",
+      prop: "averagePremium",
       label: "单均保费",
       width: "180",
       align: "right",
       sortable: true,
     },
-    {
-      prop: "manegerName",
-      label: "管理人",
-      width: "180",
-    },
-    {
-      prop: "personStatus",
-      label: "人员状态",
-      width: "180",
-    },
-    {
-      prop: "accountStatus",
-      label: "账号状态",
-      width: "180",
-    },
   ],
 });
 
@@ -145,20 +125,46 @@ const queryFormRes = ref();
 const routerKey = ref("salesmanDeptDetail");
 const defaultList = ref();
 const pageHiddenList = ref([]); //页面不显示的数据
+const isFilterFrom = ref(); //主页面查询条件且在过滤中不存在
+
 const initDefaultList = async () => {
   const { data } = await api.manageApi.getSearchDefaultList({
     routerKey: routerKey.value,
     userId: phone,
   });
-  listOption.queryFormFields = data.filter((e) => e.showFlag);
 
-  pageHiddenList.value = data.filter((e) => !e.showFlag);
-  defaultList.value = data.map((e) => e.id);
+  const queryParamsMap = route.query;
+  const processedData = data.map((item) => {
+    if (queryParamsMap.hasOwnProperty(item.key)) {
+      let defaultValue = queryParamsMap[item.key]
+      return { ...item, defaultValue };
+    }
+    return item;
+  });
+
+  let filterFrom = {};
+  processedData.map((item) => {
+    filterFrom[item.key] = item.defaultValue;
+  });
+  isFilterFrom.value = getUniqueProperties(queryParamsMap, filterFrom);
+
+  listOption.queryFormFields = processedData.filter((e) => e.showFlag);
+  pageHiddenList.value = processedData.filter((e) => !e.showFlag);
+  defaultList.value = processedData.map((e) => e.id);
   selectedKeys.value = defaultList.value;
   queryFormRes.value = queryFormRef.value?.initDefaultSaveForm();
   queryList();
 };
 
+const getUniqueProperties = (obj1, obj2) => {
+  const uniqueProps = {};
+  Object.keys(obj1).forEach((key) => {
+    if (!(key in obj2) || obj2[key] == undefined) {
+      uniqueProps[key] = obj1[key];
+    }
+  });
+  return uniqueProps;
+};
 //删除
 const filterDialogRef = ref();
 const delSelect = (id) => {
@@ -222,16 +228,19 @@ const query = (item) => {
 //数据查询
 const tableData = ref([]);
 const queryList = async () => {
-  let query = { ...queryFormRes.value };
-  const { data } = await api.manageApi.salesmanDeptDetailPageList({
+  let query = { ...queryFormRes.value, ...isFilterFrom.value };
+  const { data } = await api.manageApi.salesmanReportPageList({
     pageNo: pageInfo.value.pageNum,
     pageSize: pageInfo.value.pageSize,
     routerKey: routerKey.value,
+    systemCode: localStorage.getItem('login_system'),
     userId: phone,
     orderType: globalSortKey.value
       ? globalSortKey.value + " " + globalSortOrder.value
       : "",
     ...query,
+    signTimeBegin: query.createTime[0] ?? '',
+    signTimeEnd: query.createTime[1] ?? '',
   });
   tableData.value = data.records;
   pageInfo.value.pageNum = data.current;
@@ -248,16 +257,19 @@ function getList(item: PageInfo) {
 
 //导出
 const downloadFile = async () => {
-  let query = { ...queryFormRes.value };
-  const { data, msg } = await api.manageApi.salesmanDeptDetailToTask({
+  let query = { ...queryFormRes.value, ...isFilterFrom.value };
+  const { data, msg } = await api.manageApi.salesmanReportToTask({
     pageNo: pageInfo.value.pageNum,
     pageSize: pageInfo.value.pageSize,
     routerKey: routerKey.value,
+    systemCode: localStorage.getItem('login_system'),
     userId: phone,
     orderType: globalSortKey.value
       ? globalSortKey.value + " " + globalSortOrder.value
       : "",
     ...query,
+    signTimeBegin: query.createTime[0] ?? '',
+    signTimeEnd: query.createTime[1] ?? '',
   });
   ElMessage({
     message: msg,
@@ -276,6 +288,7 @@ onMounted(() => {
   .query-btn {
     margin-left: 20px;
   }
+
   .btn-box {
     padding-bottom: 15px;
     margin-bottom: 24px;
@@ -284,6 +297,7 @@ onMounted(() => {
     justify-content: flex-end;
   }
 }
+
 :deep(.caret-wrapper) {
   display: none !important;
 }