From 4923681d933b455972166552dfb7538cd18f5808 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期二, 01 四月 2025 18:49:21 +0800
Subject: [PATCH] fix: bug

---
 src/views/Home/components/InsureOrderInfoView.vue |  103 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 75 insertions(+), 28 deletions(-)

diff --git a/src/views/Home/components/InsureOrderInfoView.vue b/src/views/Home/components/InsureOrderInfoView.vue
index 18afc27..258e11f 100644
--- a/src/views/Home/components/InsureOrderInfoView.vue
+++ b/src/views/Home/components/InsureOrderInfoView.vue
@@ -35,12 +35,14 @@
           <ProFormCol>
             <ProFormColItem :span="8">
               <ProFormItemV2 label="鍙備繚鏈烘瀯:" prop="insuranceOrg">
-                <ProFormRadio v-model="detail.insuranceOrg" :value-enum="InsuredInstitutionEnum" />
+                <!-- <ProFormRadio v-model="detail.insuranceOrg" :value-enum="InsuredInstitutionEnum" /> -->
+                <ProFormText v-model.trim="detail.insuranceOrg" />
               </ProFormItemV2>
             </ProFormColItem>
             <ProFormColItem :span="8">
               <ProFormItemV2 label="鎶曚繚鏂规:" prop="insuranceScheme">
-                <ProFormRadio v-model="detail.insuranceScheme" :value-enum="InsuranceSchemeEnum" />
+                <!-- <ProFormRadio v-model="detail.insuranceScheme" :value-enum="InsuranceSchemeEnum" /> -->
+                <ProFormText v-model.trim="detail.insuranceScheme" />
               </ProFormItemV2>
             </ProFormColItem>
             <ProFormColItem :span="8">
@@ -115,6 +117,7 @@
         </ProTableV2>
       </ChunkCell>
       <ChangePersonInfoDialog v-bind="dialogProps"></ChangePersonInfoDialog>
+      <InsureClaimDetailDialog v-bind="dialogInsureClaimProps"></InsureClaimDetailDialog>
     </AppScrollContainer>
   </LoadingLayout>
 </template>
@@ -141,20 +144,22 @@
   useFormDialog,
   BlFileUpload,
   UploadUserFile,
+  XLSXUtils,
 } from '@bole-core/components';
 import {
   InsuranceOrderTempPath,
   insuranceTypeText,
-  InsuredInstitutionEnum,
-  InsuranceSchemeEnum,
   InsurancePolicyStatusEnum,
   InsurancePolicyStatusEnumText,
 } from '@/constants';
 import ChangePersonInfoDialog from './ChangePersonInfoDialog.vue';
+import InsureClaimDetailDialog from './InsureClaimDetailDialog.vue';
 import * as insuranceOrderServices from '@/services/api/InsuranceOrder';
+import * as insuranceClaimServices from '@/services/api/InsuranceClaim';
 import { useQuery, useQueryClient } from '@tanstack/vue-query';
 import { downloadFile, downloadFileByUrl, Message, OrderInputType } from '@bole-core/core';
 import { setOSSLink } from '@/utils';
+import dayjs from 'dayjs';
 
 defineOptions({
   name: 'InsureOrderInfoView',
@@ -219,7 +224,7 @@
   },
   {
     id: '11',
-    enCode: 'serialNumber',
+    enCode: 'claimCount',
     name: '鐞嗚禂',
     width: 100,
   },
@@ -245,11 +250,11 @@
       name: '鐞嗚禂璇︽儏',
     },
     emits: {
-      onClick: (role) => handleInsureClaimDetail(role),
+      onClick: (role) => handleDetail(role),
     },
     extraProps: {
       hide: (row: API.GetInsuranceStaffPageTemplate) =>
-        !(row.serialNumber && detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect),
+        !(row.claimCount && detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect),
     },
   },
 ]);
@@ -325,6 +330,10 @@
 }
 async function handleClear() {
   try {
+    if (paginationState.total === 0) {
+      Message.warnMessage('娌℃湁闇�瑕佹竻绌虹殑鏁版嵁~');
+      return;
+    }
     await Message.tipMessage('鏄惁娓呯┖浜哄憳淇℃伅');
     let res = await insuranceOrderServices.clearInsuranceStaffData({
       id: id,
@@ -337,18 +346,31 @@
 }
 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();
+    let res = await insuranceOrderServices.importInsDetailStaffToList({
+      id: id,
+      url: response.url,
+    });
+    if (res?.length > 0) {
+      await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
+      XLSXUtils.exportToXLSX({
+        workbookDataList: res,
+        fileName: '閿欒浜哄憳鍚嶅崟',
+        workbookHeaderMap: {
+          name: '闆囧憳濮撳悕',
+          sex: '鎬у埆',
+          certType: '璇佷欢绫诲瀷',
+          certNo: '璇佷欢鍙风爜',
+          jobName: '闆囧憳宸ョ',
+          useEmploer: '鐢ㄥ伐鍗曚綅',
+          address: '鐢ㄥ伐鍦扮偣',
+          note: '澶囨敞',
+        },
+      });
+    }
+    queryClient.invalidateQueries({
+      queryKey: ['insuranceOrderServices/getInsuranceStaffList'],
+    });
+    getInsuranceStaffList();
   } catch (error) {}
 }
 
@@ -375,10 +397,22 @@
 }
 
 function handleBatchChange() {
+  if (
+    dayjs(detail.value?.effectEndTime).isBefore(dayjs()) ||
+    dayjs(detail.value?.effectEndTime).isSame(dayjs(), 'day')
+  ) {
+    Message.errorMessage('淇濋櫓浠婂ぉ鍒版湡锛屾棤娉曟壒鏀�');
+    return;
+  }
   router.push({
     name: 'BatchChange',
     params: {
       id: id,
+    },
+    query: {
+      insurerName: detail.value?.insurerName ?? '',
+      insureBillNo: detail.value?.insureBillNo ?? '',
+      effectEndTime: detail.value?.effectEndTime ?? '',
     },
   });
 }
@@ -421,16 +455,29 @@
   } catch (error) {}
 }
 
-function handleInsureClaimDetail(row: API.GetInsuranceStaffPageTemplate) {
-  router.push({
-    name: 'InsuranceClaimDetail',
-    params: {
+const { dialogProps: dialogInsureClaimProps, handleEdit: handleInsureClaimEdit } = useFormDialog({
+  defaultFormParams: {
+    id: '',
+    routeId: '',
+    staffList: [] as API.InsuranceClaimDetailOutput[],
+  },
+});
+
+async function getInsuranceClaimDetailList(id: string) {
+  try {
+    return await insuranceClaimServices.getInsuranceClaimDetailList({ id: id });
+  } catch (error) {}
+}
+
+async function handleDetail(row: API.GetInsuranceStaffPageTemplate) {
+  try {
+    const res = await getInsuranceClaimDetailList(row.id);
+    handleInsureClaimEdit({
       id: row.id,
-    },
-    query: {
-      fromRoute: 'InsuranceOrderDetail',
-    },
-  });
+      staffList: res,
+      routeId: id,
+    });
+  } catch (error) {}
 }
 </script>
 

--
Gitblit v1.9.1