From d54c9c48c0b4f7c609e0aa65671a6c3fd26f94b4 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期五, 04 七月 2025 13:19:29 +0800
Subject: [PATCH] fix: 江佑保系统健壮性修复

---
 src/hooks/dic.ts                                  |   13 ++
 src/constants/insuranceClaim.ts                   |    3 
 src/services/api/typings.d.ts                     |   50 ++++++++-
 src/views/Home/components/InsureOrderInfoView.vue |  108 +++++++++++----------
 src/hooks/insuranceClaim.ts                       |   31 ++++++
 src/views/Home/Home.vue                           |   10 +
 src/services/api/InsuranceOrder.ts                |   58 ++++++++++-
 7 files changed, 208 insertions(+), 65 deletions(-)

diff --git a/src/constants/insuranceClaim.ts b/src/constants/insuranceClaim.ts
index 933f583..5ec5d81 100644
--- a/src/constants/insuranceClaim.ts
+++ b/src/constants/insuranceClaim.ts
@@ -92,6 +92,8 @@
   Reject = -10,
   /**寰呭鏍� */
   WaitAudit = 10,
+  /**瀹℃牳涓� */
+  Auditing = 15,
   /**閫氳繃 */
   Pass = 20,
 }
@@ -99,6 +101,7 @@
 export const InsurancePolicyAuditStatusEnumText = {
   [InsurancePolicyAuditStatusEnum.Reject]: '椹冲洖',
   [InsurancePolicyAuditStatusEnum.WaitAudit]: '寰呭鏍�',
+  [InsurancePolicyAuditStatusEnum.Auditing]: '瀹℃牳涓�',
   [InsurancePolicyAuditStatusEnum.Pass]: '閫氳繃',
 };
 
diff --git a/src/hooks/dic.ts b/src/hooks/dic.ts
index 48489a0..7c5ab3e 100644
--- a/src/hooks/dic.ts
+++ b/src/hooks/dic.ts
@@ -36,11 +36,24 @@
     return insureProduct?.id ?? '';
   }
 
+  const queryClient = useQueryClient();
+
+  function ensureUserInsureProductSetting() {
+    return queryClient.ensureQueryData<API.InsureProductSettingDto[]>({
+      queryKey: ['dictionaryServices/getUserInsureProductSetting'],
+    });
+  }
+
+  /**鏄惁鏄敓鐓庝繚璐﹀彿 */
+  const isSjbAccount = computed(() => allUserInsureProductSettingList.value.length > 0);
+
   return {
     allUserInsureProductSettingList,
     getInsureProductByIdNumber,
     getInsureProductIdByIdNumber,
     refetch,
+    ensureUserInsureProductSetting,
+    isSjbAccount,
   };
 }
 
diff --git a/src/hooks/insuranceClaim.ts b/src/hooks/insuranceClaim.ts
index 836852b..7e60a39 100644
--- a/src/hooks/insuranceClaim.ts
+++ b/src/hooks/insuranceClaim.ts
@@ -50,3 +50,34 @@
     isLoading,
   };
 }
+
+export function useInsureActions() {
+  const router = useRouter();
+  async function handleGoDownloadInvoice(id: string) {
+    try {
+      await insuranceOrderServices.getInvoiceId({ id: id });
+      router.push({
+        name: 'InsureDownloadInvoice',
+        params: {
+          id: id,
+        },
+      });
+    } catch (error) {}
+  }
+
+  async function handleGoStampFiles(id: string) {
+    try {
+      router.push({
+        name: 'InsurancePolicyStampFiles',
+        params: {
+          id: id,
+        },
+      });
+    } catch (error) {}
+  }
+
+  return {
+    handleGoDownloadInvoice,
+    handleGoStampFiles,
+  };
+}
diff --git a/src/services/api/InsuranceOrder.ts b/src/services/api/InsuranceOrder.ts
index 7e369e6..54e53d5 100644
--- a/src/services/api/InsuranceOrder.ts
+++ b/src/services/api/InsuranceOrder.ts
@@ -77,6 +77,20 @@
   });
 }
 
+/** 鑾峰彇鐢靛瓙淇濆崟 POST /api/InsuranceOrder/DownloadPolicyFile/${param0} */
+export async function downloadPolicyFileId(
+  // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄)
+  params: API.APIdownloadPolicyFileIdParams,
+  options?: API.RequestConfig
+) {
+  const { id: param0, ...queryParams } = params;
+  return request<string>(`/api/InsuranceOrder/DownloadPolicyFile/${param0}`, {
+    method: 'POST',
+    params: { ...queryParams },
+    ...(options || {}),
+  });
+}
+
 /** 鎵归噺鍑忓憳淇濆崟鏁版嵁 POST /api/InsuranceOrder/DownsizingInsuranceOrderData */
 export async function downsizingInsuranceOrderData(
   body: API.DownsizingInsuranceOrderData,
@@ -322,17 +336,17 @@
   );
 }
 
-/** 淇濆崟璇︽儏-瀵煎叆浜哄憳娓呭崟 GET /api/InsuranceOrder/GetInsuranceStaffListExport */
+/** 淇濆崟璇︽儏-瀵煎嚭浜哄憳娓呭崟 POST /api/InsuranceOrder/GetInsuranceStaffListExport */
 export async function getInsuranceStaffListExport(
-  // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄)
-  params: API.APIgetInsuranceStaffListExportParams,
+  body: API.ExportInsuranceStaffListInput,
   options?: API.RequestConfig
 ) {
   return request<any>('/api/InsuranceOrder/GetInsuranceStaffListExport', {
-    method: 'GET',
-    params: {
-      ...params,
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json',
     },
+    data: body,
     ...(options || {}),
   });
 }
@@ -416,7 +430,37 @@
   body: API.InsurancePolicyAuditInput,
   options?: API.RequestConfig
 ) {
-  return request<number>('/api/InsuranceOrder/InsurancePolicyAudit', {
+  return request<API.InsurancePolicyAuditOutput>('/api/InsuranceOrder/InsurancePolicyAudit', {
+    method: 'POST',
+    headers: {
+      'Content-Type': 'application/json',
+    },
+    data: body,
+    ...(options || {}),
+  });
+}
+
+/** 淇濆崟鍐嶅 POST /api/InsuranceOrder/InsurancePolicyAuditAgain */
+export async function insurancePolicyAuditAgain(
+  // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄)
+  params: API.APIinsurancePolicyAuditAgainParams,
+  options?: API.RequestConfig
+) {
+  return request<any>('/api/InsuranceOrder/InsurancePolicyAuditAgain', {
+    method: 'POST',
+    params: {
+      ...params,
+    },
+    ...(options || {}),
+  });
+}
+
+/** 鎶曚繚鐘舵�佽ˉ褰� POST /api/InsuranceOrder/RestorePolicyStatus */
+export async function restorePolicyStatus(
+  body: API.RestorePolicyInput,
+  options?: API.RequestConfig
+) {
+  return request<any>('/api/InsuranceOrder/RestorePolicyStatus', {
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
diff --git a/src/services/api/typings.d.ts b/src/services/api/typings.d.ts
index c168d1b..ebb87b8 100644
--- a/src/services/api/typings.d.ts
+++ b/src/services/api/typings.d.ts
@@ -192,6 +192,10 @@
     id?: string;
   }
 
+  interface APIdownloadPolicyFileIdParams {
+    id: string;
+  }
+
   interface APIexportInsuranceBatchStaffParams {
     batchBillId?: string;
   }
@@ -282,10 +286,6 @@
     id?: string;
   }
 
-  interface APIgetInsuranceStaffListExportParams {
-    id?: string;
-  }
-
   interface APIgetInsureBatchDetailParams {
     batchBillId?: string;
   }
@@ -364,6 +364,10 @@
 
   interface APIimportInsDetailStaffToListParams {
     url?: string;
+    id?: string;
+  }
+
+  interface APIinsurancePolicyAuditAgainParams {
     id?: string;
   }
 
@@ -706,6 +710,11 @@
   interface EntityExtensionDto {
     properties?: Record<string, any>;
     configuration?: Record<string, any>;
+  }
+
+  interface ExportInsuranceStaffListInput {
+    status?: InsuranceDetailStatusEnum;
+    insurancePolicyId?: string;
   }
 
   interface ExtensionEnumDto {
@@ -1458,7 +1467,7 @@
     count?: number;
   }
 
-  type InsuranceDetailStatusEnum = 10 | 12 | 14 | 20 | 30;
+  type InsuranceDetailStatusEnum = 10 | 12 | 13 | 14 | 20 | 30;
 
   interface InsuranceOrderListOutput {
     id?: string;
@@ -1556,7 +1565,18 @@
     returnUrl?: string;
   }
 
-  type InsurancePolicyAuditStatusEnum = 10 | 20 | -10;
+  interface InsurancePolicyAuditOutput {
+    /** 娑堟伅 */
+    messages?: string[];
+    /** 鎬绘姇淇濅汉鏁� */
+    totalCount?: number;
+    /** 鎶曚繚鎴愬姛 */
+    successCount?: number;
+    /** 鎶曚繚澶辫触 */
+    failCount?: number;
+  }
+
+  type InsurancePolicyAuditStatusEnum = 10 | 15 | 20 | -10;
 
   type InsurancePolicyListPayStatusEnum = 1 | 2;
 
@@ -2062,6 +2082,24 @@
     password?: string;
   }
 
+  interface RestorePolicyDto {
+    /** Id */
+    id?: string;
+    /** 璁㈠崟鍙� */
+    channelOrderNo?: string;
+    /** 淇濆崟鍙� */
+    policyNo?: string;
+    /** 鐢靛瓙淇濆崟閾炬帴 */
+    policyOssUrl?: string;
+  }
+
+  interface RestorePolicyInput {
+    /** 淇濆崟Id */
+    insurancePolicyId?: string;
+    /** 鎶曚繚鎵规 */
+    items?: RestorePolicyDto[];
+  }
+
   interface ReturnValueApiDescriptionModel {
     type?: string;
     typeSimple?: string;
diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index f6c7188..8f164ac 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -58,6 +58,7 @@
             type="primary"
             style="margin-right: 10px"
             link
+            v-if="isSjbAccount"
             >鑱屼笟绫诲瀷瀵圭収琛�</el-button
           >
           <el-button @click="handleDownload()" type="primary" style="margin-right: 10px" link
@@ -162,6 +163,7 @@
 import dayjs from 'dayjs';
 import _ from 'lodash';
 import InsureInstructionsDialog from './components/InsureInstructionsDialog.vue';
+import { useUserInsureProductSetting } from '@/hooks';
 // import { Recorder } from '@/utils/record';
 
 defineOptions({
@@ -437,8 +439,14 @@
   onConfirm: handleUpload,
 });
 
+const { isSjbAccount } = useUserInsureProductSetting();
+
 function handleOpenInstructions() {
-  dialogInstructionsState.dialogVisible = true;
+  if (isSjbAccount.value) {
+    dialogInstructionsState.dialogVisible = true;
+  } else {
+    handleUpload();
+  }
 }
 
 async function handleUpload() {
diff --git a/src/views/Home/components/InsureOrderInfoView.vue b/src/views/Home/components/InsureOrderInfoView.vue
index 229edc5..8772799 100644
--- a/src/views/Home/components/InsureOrderInfoView.vue
+++ b/src/views/Home/components/InsureOrderInfoView.vue
@@ -11,7 +11,7 @@
                   <el-button
                     type="primary"
                     link
-                    @click="handleGoStampFiles"
+                    @click="handleGoStampFiles(id)"
                     v-if="detail.productOnline && detail.anyPayComplete"
                     >璇︽儏</el-button
                   >
@@ -75,7 +75,10 @@
         </ProForm>
       </ChunkCell>
       <ChunkCell title="浜哄憳淇℃伅" class="full-table-chunk">
-        <template #titleRight v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect">
+        <template
+          #titleRight
+          v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect && !detail.productOnline"
+        >
           <el-button type="primary" @click="handleBatchChange">鎵规敼鐢宠</el-button>
         </template>
         <ProTableQueryFilterBar @on-reset="reset">
@@ -92,34 +95,41 @@
           </template>
           <template #btn>
             <template v-if="detail.status === InsurancePolicyStatusEnum.WaitEffect">
-              <el-button @click="handleTemplateDownload()" link type="primary">妯℃澘涓嬭浇</el-button>
-              <BlFileUpload
-                v-if="
-                  detail.auditStatus !== InsurancePolicyAuditStatusEnum.Pass &&
-                  !detail.productOnline
-                "
-                :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>
-              <el-button @click="handleClear()" type="primary">娓呯┖鏁版嵁</el-button>
+              <template v-if="!detail.productOnline">
+                <el-button @click="handleTemplateDownload()" link type="primary"
+                  >妯℃澘涓嬭浇</el-button
+                >
+                <BlFileUpload
+                  v-if="detail.auditStatus !== InsurancePolicyAuditStatusEnum.Pass"
+                  :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>
             <template v-else>
-              <el-button @click="handleDownloadPerson()" type="primary">涓嬭浇浜哄憳娓呭崟</el-button>
               <template v-if="detail.productOnline">
-                <el-button v-if="detail.anyPayComplete" @click="handleGoStampFiles()" type="primary"
-                  >涓嬭浇淇濆崟</el-button
+                <el-button @click="handleExport(InsuranceDetailStatusEnum.Effecting)" type="primary"
+                  >瀵煎嚭鍦ㄤ繚浜哄憳</el-button
                 >
+                <el-button @click="handleExport(InsuranceDetailStatusEnum.Fail)" type="primary"
+                  >瀵煎嚭閿欒浜哄憳</el-button
+                >
+                <el-button @click="handleGoStampFiles(id)" type="primary">涓嬭浇淇濆崟</el-button>
+                <el-button @click="handleGoDownloadInvoice(id)" type="primary">涓嬭浇鍙戠エ</el-button>
               </template>
-              <el-button v-else @click="handleDownloadOrder()" type="primary">涓嬭浇淇濆崟</el-button>
+              <template v-else>
+                <el-button @click="handleExport(null)" type="primary">涓嬭浇浜哄憳娓呭崟</el-button>
+                <el-button @click="handleDownloadOrder()" type="primary">涓嬭浇淇濆崟</el-button>
+              </template>
             </template>
           </template>
         </ProTableQueryFilterBar>
@@ -170,6 +180,7 @@
   InsurancePolicyStatusEnumText,
   InsurancePolicyAuditStatusEnum,
   InsuranceDetailStatusEnumText,
+  InsuranceDetailStatusEnum,
 } from '@/constants';
 import ChangePersonInfoDialog from './ChangePersonInfoDialog.vue';
 import InsureClaimDetailDialog from './InsureClaimDetailDialog.vue';
@@ -179,6 +190,7 @@
 import { downloadFile, downloadFileByUrl, Message, OrderInputType } from '@bole-core/core';
 import { setOSSLink } from '@/utils';
 import dayjs from 'dayjs';
+import { useInsureActions } from '@/hooks';
 
 defineOptions({
   name: 'InsureOrderInfoView',
@@ -428,36 +440,11 @@
   } catch (error) {}
 }
 
-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 handleGoStampFiles() {
-  router.push({
-    name: 'InsurancePolicyStampFiles',
-    params: {
-      id: id,
-    },
-  });
-}
+const { handleGoDownloadInvoice, handleGoStampFiles } = useInsureActions();
 
 function handleBatchChange() {
   if (
@@ -542,6 +529,25 @@
     });
   } catch (error) {}
 }
+
+async function handleExport(status: InsuranceDetailStatusEnum) {
+  try {
+    if (paginationState.total === 0) {
+      Message.warnMessage('娌℃湁鏁版嵁鍙互瀵煎嚭鍝');
+      return;
+    }
+    let res = await insuranceOrderServices.getInsuranceStaffListExport(
+      { insurancePolicyId: id, status: status },
+      {
+        responseType: 'blob',
+        getResponse: true,
+      }
+    );
+    if (res) {
+      downloadFile(res.data, `浜哄憳娓呭崟`, 'xlsx');
+    }
+  } catch (error) {}
+}
 </script>
 
 <style lang="scss" scoped>

--
Gitblit v1.9.1