From 12cce14bc30a85bbf96b5b30bb1aff1fc354091a Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 27 三月 2025 15:07:21 +0800
Subject: [PATCH] feat: 接口对接

---
 src/views/Home/components/InsureOrderInfoView.vue |  395 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 253 insertions(+), 142 deletions(-)

diff --git a/src/views/Home/components/InsureOrderInfoView.vue b/src/views/Home/components/InsureOrderInfoView.vue
index fba6353..18afc27 100644
--- a/src/views/Home/components/InsureOrderInfoView.vue
+++ b/src/views/Home/components/InsureOrderInfoView.vue
@@ -1,111 +1,122 @@
 <template>
-  <AppScrollContainer>
-    <ChunkCell title="">
-      <ProForm :model="detail" ref="formRef" label-width="120px" :is-read="true">
-        <ProFormCol>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="淇濆崟鍙�:" prop="orderNo">
-              <ProFormText v-model.trim="detail.orderNo" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鐢熸晥鐘舵��:" prop="insuranceTypeCode">
-              <ProFormRadio v-model="detail.insuranceType" :value-enum="insuranceTypeText" />
-            </ProFormItemV2>
-          </ProFormColItem>
-        </ProFormCol>
-        <ProFormCol>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="淇濋櫓璧锋湡:" prop="applyTime">
-              <ProFormDatePicker v-model.trim="detail.createTime" format="YYYY-MM-DD HH:mm" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="淇濋櫓姝㈡湡:" prop="insuranceTypeCode">
-              <ProFormDatePicker v-model.trim="detail.createTime" format="YYYY-MM-DD HH:mm" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鎶曚繚鏂瑰紡:" prop="insureWay">
-              <ProFormRadio v-model="detail.insuranceType" :value-enum="insuranceTypeText" />
-            </ProFormItemV2>
-          </ProFormColItem>
-        </ProFormCol>
-        <ProFormCol>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鍙備繚鏈烘瀯:" prop="applyTime">
-              <ProFormText v-model.trim="detail.orderNo" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鎶曚繚鏂规:" prop="applyTime">
-              <ProFormText v-model.trim="detail.orderNo" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鎶曚繚浜烘暟:" prop="numberOfFailed">
-              <ProFormInputNumber v-model.trim="detail.incDecAmount" unit="浜�" />
-            </ProFormItemV2>
-          </ProFormColItem>
-        </ProFormCol>
-        <ProFormCol>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="鎶曚繚浜�:" prop="companyName">
-              <ProFormText v-model.trim="detail.orderNo" />
-            </ProFormItemV2>
-          </ProFormColItem>
-          <ProFormColItem :span="8">
-            <ProFormItemV2 label="琚繚浜�:" prop="insuranceTypeCode">
-              <ProFormText v-model.trim="detail.orderNo" />
-            </ProFormItemV2>
-          </ProFormColItem>
-        </ProFormCol>
-      </ProForm>
-    </ChunkCell>
-    <ChunkCell title="浜哄憳淇℃伅">
-      <template #titleRight>
-        <el-button type="primary" @click="handleBatchChange">鎵规敼鐢宠</el-button>
-      </template>
-      <ProTableQueryFilterBar @on-reset="reset">
-        <template #query>
-          <QueryFilterItem>
-            <SearchInput
-              v-model="extraParamState.keyWord"
-              style="width: 300px"
-              placeholder="浜哄憳濮撳悕/韬唤璇佸彿/鎵嬫満鍙�"
-              @on-click-search="getBatchRefundInfoDetail"
-            >
-            </SearchInput>
-          </QueryFilterItem>
+  <LoadingLayout :loading="state.loading">
+    <AppScrollContainer>
+      <ChunkCell title="">
+        <ProForm :model="detail" ref="formRef" label-width="120px" :is-read="true">
+          <ProFormCol>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="淇濆崟鍙�:" prop="insureBillNo">
+                <ProFormText v-model.trim="detail.insureBillNo" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鐢熸晥鐘舵��:" prop="status">
+                <ProFormRadio v-model="detail.status" :value-enum="InsurancePolicyStatusEnumText" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <ProFormCol>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="淇濋櫓璧锋湡:" prop="effectStartTime">
+                <ProFormDatePicker v-model.trim="detail.effectStartTime" format="YYYY-MM-DD" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="淇濋櫓姝㈡湡:" prop="effectEndTime">
+                <ProFormDatePicker v-model.trim="detail.effectEndTime" format="YYYY-MM-DD" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎶曚繚鏂瑰紡:" prop="insurancePeriod">
+                <ProFormRadio v-model="detail.insurancePeriod" :value-enum="insuranceTypeText" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <ProFormCol>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鍙備繚鏈烘瀯:" prop="insuranceOrg">
+                <ProFormRadio v-model="detail.insuranceOrg" :value-enum="InsuredInstitutionEnum" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎶曚繚鏂规:" prop="insuranceScheme">
+                <ProFormRadio v-model="detail.insuranceScheme" :value-enum="InsuranceSchemeEnum" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎶曚繚浜烘暟:" prop="insureCount">
+                <ProFormInputNumber v-model.trim="detail.insureCount" unit="浜�" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <ProFormCol>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎶曚繚浜�:" prop="insurerName">
+                <ProFormText v-model.trim="detail.insurerName" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="琚繚浜�:" prop="policyerName">
+                <ProFormText v-model.trim="detail.policyerName" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+        </ProForm>
+      </ChunkCell>
+      <ChunkCell title="浜哄憳淇℃伅">
+        <template #titleRight v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect">
+          <el-button type="primary" @click="handleBatchChange">鎵规敼鐢宠</el-button>
         </template>
-        <template #btn>
-          <el-button @click="handleTemplateDownload()" icon="Download" type="primary"
-            >妯℃澘涓嬭浇</el-button
-          >
-          <el-button @click="handleImport()" icon="Download" type="primary">瀵煎叆</el-button>
-          <el-button @click="handleClear()" icon="Download" type="primary">娓呯┖鏁版嵁</el-button>
-          <el-button @click="handleDownloadPerson()" icon="Download" type="primary"
-            >浜哄憳娓呭崟涓嬭浇</el-button
-          >
-          <el-button @click="handleDownloadOrder()" icon="Download" type="primary"
-            >淇濆崟涓嬭浇</el-button
-          >
-        </template>
-      </ProTableQueryFilterBar>
-      <ProTableV2
-        v-bind="proTableProps"
-        :columns="column"
-        :operationBtns="operationBtns"
-        :auto-height="false"
-        ref="proTable"
-        :tableProps="{
-          maxHeight: '400px',
-        }"
-      >
-      </ProTableV2>
-    </ChunkCell>
-    <ChangePersonInfoDialog v-bind="dialogProps"></ChangePersonInfoDialog>
-  </AppScrollContainer>
+        <ProTableQueryFilterBar @on-reset="reset">
+          <template #query>
+            <QueryFilterItem>
+              <SearchInput
+                v-model="extraParamState.keyWord"
+                style="width: 300px"
+                placeholder="濮撳悕/韬唤璇佸彿/鎵嬫満鍙�"
+                @on-click-search="getInsuranceStaffList"
+              >
+              </SearchInput>
+            </QueryFilterItem>
+          </template>
+          <template #btn>
+            <template v-if="detail.status === InsurancePolicyStatusEnum.WaitEffect">
+              <el-button @click="handleTemplateDownload()" link type="primary">妯℃澘涓嬭浇</el-button>
+              <BlFileUpload
+                :limitFileSize="10"
+                accept="xls,xlsx"
+                :showTip="false"
+                :show-file-list="false"
+                :on-success="handleUploadSuccess"
+                style="margin-right: 10px; margin-left: 10px"
+              >
+                <template #default>
+                  <el-button icon="Plus" type="primary">瀵煎叆</el-button>
+                </template>
+              </BlFileUpload>
+              <el-button @click="handleClear()" type="primary">娓呯┖鏁版嵁</el-button>
+            </template>
+            <template v-else>
+              <el-button @click="handleDownloadPerson()" type="primary">涓嬭浇浜哄憳娓呭崟</el-button>
+              <el-button @click="handleDownloadOrder()" type="primary">涓嬭浇淇濆崟</el-button>
+            </template>
+          </template>
+        </ProTableQueryFilterBar>
+        <ProTableV2
+          v-bind="proTableProps"
+          :columns="column"
+          :operationBtns="operationBtns"
+          :auto-height="false"
+          ref="proTable"
+          :tableProps="{
+            maxHeight: '400px',
+          }"
+        >
+        </ProTableV2>
+      </ChunkCell>
+      <ChangePersonInfoDialog v-bind="dialogProps"></ChangePersonInfoDialog>
+    </AppScrollContainer>
+  </LoadingLayout>
 </template>
 
 <script setup lang="ts">
@@ -126,15 +137,24 @@
   useTable,
   ProTableV2,
   ProFormRadio,
-  FieldSelect,
   defineOperationBtns,
   useFormDialog,
+  BlFileUpload,
+  UploadUserFile,
 } from '@bole-core/components';
-import { insuranceTypeText } from '@/constants';
+import {
+  InsuranceOrderTempPath,
+  insuranceTypeText,
+  InsuredInstitutionEnum,
+  InsuranceSchemeEnum,
+  InsurancePolicyStatusEnum,
+  InsurancePolicyStatusEnumText,
+} from '@/constants';
 import ChangePersonInfoDialog from './ChangePersonInfoDialog.vue';
 import * as insuranceOrderServices from '@/services/api/InsuranceOrder';
 import { useQuery, useQueryClient } from '@tanstack/vue-query';
-import { OrderInputType } from '@bole-core/core';
+import { downloadFile, downloadFileByUrl, Message, OrderInputType } from '@bole-core/core';
+import { setOSSLink } from '@/utils';
 
 defineOptions({
   name: 'InsureOrderInfoView',
@@ -148,53 +168,60 @@
   },
   {
     id: '2',
-    enCode: 'name',
+    enCode: 'gender',
     name: '鎬у埆',
+    width: 80,
   },
   {
     id: '3',
-    enCode: 'name',
+    enCode: 'certType',
     name: '璇佷欢绫诲瀷',
+    width: 100,
   },
   {
     id: '4',
-    enCode: 'idNumber',
+    enCode: 'certNo',
     name: '璇佷欢鍙风爜',
+    width: 180,
   },
   {
     id: '5',
-    enCode: 'idNumber',
+    enCode: 'jobName',
     name: '闆囧憳宸ョ',
   },
   {
     id: '6',
-    enCode: 'idNumber',
+    enCode: 'userEmploer',
     name: '鐢ㄥ伐鍗曚綅',
   },
   {
     id: '7',
-    enCode: 'idNumber',
+    enCode: 'address',
     name: '鐢ㄥ伐鍦扮偣',
   },
   {
     id: '8',
-    enCode: 'idNumber',
+    enCode: 'age',
     name: '骞撮緞',
+    width: 80,
   },
   {
     id: '9',
-    enCode: 'idNumber',
+    enCode: 'birthDay',
     name: '鍑虹敓鏃ユ湡',
+    width: 120,
   },
   {
     id: '10',
-    enCode: 'idNumber',
+    enCode: 'phone',
     name: '鎵嬫満鍙风爜',
+    width: 140,
   },
   {
     id: '11',
-    enCode: 'idNumber',
+    enCode: 'serialNumber',
     name: '鐞嗚禂',
+    width: 100,
   },
 ];
 
@@ -208,7 +235,8 @@
       onClick: (role) => handleChangeInfo(role),
     },
     extraProps: {
-      hide: (row: API.InsuranceOrderListOutput) => !row.orderBillFile,
+      hide: (row: API.GetInsuranceStaffPageTemplate) =>
+        detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect,
     },
   },
   {
@@ -217,10 +245,11 @@
       name: '鐞嗚禂璇︽儏',
     },
     emits: {
-      onClick: (role) => handleInsureClaimDetail(),
+      onClick: (role) => handleInsureClaimDetail(role),
     },
     extraProps: {
-      hide: (row: API.InsuranceOrderListOutput) => !row.orderBillFile,
+      hide: (row: API.GetInsuranceStaffPageTemplate) =>
+        !(row.serialNumber && detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect),
     },
   },
 ]);
@@ -235,16 +264,16 @@
 const state = reactive({ ...BaseState });
 
 const { data: detail, isLoading } = useQuery({
-  queryKey: ['insuranceOrderServices/getInsuranceOrderDetail', id],
+  queryKey: ['insuranceOrderServices/getInsurancePolicyHeadDto', id],
   queryFn: async () => {
-    return await insuranceOrderServices.getInsuranceOrderDetail(
+    return await insuranceOrderServices.getInsurancePolicyHeadDto(
       { id: id },
       {
-        showLoading: false,
+        showLoading: !state.loading,
       }
     );
   },
-  placeholderData: () => ({} as API.InsuranceOrderListOutput),
+  placeholderData: () => ({} as API.GetInsurancePageOutput),
   enabled: !!id,
 });
 
@@ -252,13 +281,14 @@
 
 onMounted(async () => {
   await queryClient.ensureQueryData({
-    queryKey: ['insuranceOrderServices/getInsuranceOrderDetail', id],
+    queryKey: ['insuranceOrderServices/getInsurancePolicyHeadDto', id],
   });
-  getBatchRefundInfoDetail();
+  await getInsuranceStaffList();
+  state.loading = false;
 });
 
 const {
-  getDataSource: getBatchRefundInfoDetail,
+  getDataSource: getInsuranceStaffList,
   proTableProps,
   paginationState,
   extraParamState,
@@ -266,16 +296,16 @@
 } = useTable(
   async ({ pageIndex, pageSize }, extraParamState) => {
     try {
-      let params: API.QueryInsuranceOrderPageInput = {
+      let params: API.GetInsuranceStaffListInput = {
         pageModel: {
           rows: pageSize,
           page: pageIndex,
           orderInput: extraParamState.orderInput,
         },
         condition: extraParamState.keyWord,
-        // insurePolicyOperateHistoryId: id,
+        insurancePolicyId: id,
       };
-      let res = await insuranceOrderServices.getInsuranceOrderPage(params, {
+      let res = await insuranceOrderServices.getInsuranceStaffList(params, {
         showLoading: !state.loading,
       });
       return res;
@@ -290,12 +320,60 @@
   }
 );
 
-function handleTemplateDownload() {}
-function handleClear() {}
-function handleImport() {}
+function handleTemplateDownload() {
+  downloadFileByUrl(InsuranceOrderTempPath, '浜哄憳淇℃伅妯℃澘');
+}
+async function handleClear() {
+  try {
+    await Message.tipMessage('鏄惁娓呯┖浜哄憳淇℃伅');
+    let res = await insuranceOrderServices.clearInsuranceStaffData({
+      id: id,
+    });
+    if (res) {
+      Message.successMessage('鎿嶄綔鎴愬姛');
+      getInsuranceStaffList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
+async function handleUploadSuccess(response: UploadUserFile) {
+  try {
+    // let res = await insuranceOrderServices.importInsuranceOrderData(response.url, {
+    //   getResponse: true,
+    //   responseType: 'blob',
+    // });
+    // if (res?.data?.size) {
+    //   await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
+    //   downloadFile(res.data, `閿欒浜哄憳鍚嶅崟`, 'xlsx');
+    // }
+    // queryClient.invalidateQueries({
+    //   queryKey: ['insuranceOrderServices/getInsuranceStaffList'],
+    // });
+    // getInsuranceStaffList();
+  } catch (error) {}
+}
 
-function handleDownloadPerson() {}
-function handleDownloadOrder() {}
+async function handleDownloadPerson() {
+  try {
+    if (paginationState.total === 0) {
+      Message.warnMessage('娌℃湁鏁版嵁鍙互瀵煎嚭鍝');
+      return;
+    }
+    let res = await insuranceOrderServices.getInsuranceStaffListExport(
+      { id: id },
+      {
+        responseType: 'blob',
+        getResponse: true,
+      }
+    );
+    if (res) {
+      downloadFile(res.data, `浜哄憳娓呭崟`, 'xlsx');
+    }
+  } catch (error) {}
+}
+function handleDownloadOrder() {
+  downloadFileByUrl(setOSSLink(detail.value?.insureBillUrl));
+}
+
 function handleBatchChange() {
   router.push({
     name: 'BatchChange',
@@ -305,22 +383,55 @@
   });
 }
 
-const { dialogProps, handleEdit, editForm } = useFormDialog({
-  onConfirm: changeInfo,
+const { dialogProps, handleEdit, editForm, dialogState } = useFormDialog({
+  onConfirm: updateInsuranceStaffInfo,
   defaultFormParams: {
+    id: '',
     name: '',
+    idNumber: '',
+    phone: '',
   },
+  closeAfterConfirm: false,
 });
 
-function handleChangeInfo(row: API.InsuranceOrderListOutput) {
+function handleChangeInfo(row: API.GetInsuranceStaffPageTemplate) {
   handleEdit({
+    id: row.id,
     name: row.name,
+    idNumber: row.certNo,
+    phone: row.phone,
   });
 }
 
-async function changeInfo() {}
+async function updateInsuranceStaffInfo() {
+  try {
+    let params: API.UpdateInsuranceStaffInfoInput = {
+      insurancePolicyId: id,
+      id: editForm.id,
+      name: editForm.name,
+      idNumber: editForm.idNumber,
+      phone: editForm.phone,
+    };
+    let res = await insuranceOrderServices.updateInsuranceStaffInfo(params);
+    if (res) {
+      Message.successMessage('淇敼鎴愬姛');
+      dialogState.dialogVisible = false;
+      getInsuranceStaffList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
 
-function handleInsureClaimDetail() {}
+function handleInsureClaimDetail(row: API.GetInsuranceStaffPageTemplate) {
+  router.push({
+    name: 'InsuranceClaimDetail',
+    params: {
+      id: row.id,
+    },
+    query: {
+      fromRoute: 'InsuranceOrderDetail',
+    },
+  });
+}
 </script>
 
 <style lang="scss" scoped>

--
Gitblit v1.9.1