From 1b0fce2d0471f266518cdd4f3eb186ec058935d2 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 30 七月 2025 17:12:55 +0800
Subject: [PATCH] fix: 新增生煎保(短期方案)

---
 src/views/Home/Home.vue |  178 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 127 insertions(+), 51 deletions(-)

diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index ddd83ce..82ba3f4 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -18,7 +18,7 @@
           <QueryFilterItem>
             <FieldRadio
               v-model="extraParamState.insurancePeriod"
-              :value-enum="insuranceTypeText"
+              :value-enum="insuranceTypeTextForFilter"
               buttonStyle
               showAllBtn
               @change="getList()"
@@ -27,7 +27,7 @@
           <QueryFilterItem>
             <FieldRadio
               v-model="extraParamState.auditStatus"
-              :value-enum="InsurancePolicyAuditStatusEnumText"
+              :value-enum="InsurancePolicyAuditStatusEnumTextForFilter"
               buttonStyle
               showAllBtn
               @change="getList()"
@@ -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
@@ -153,15 +154,19 @@
   InsurancePolicyStatusEnum,
   AppType,
   InsurancePolicyAuditStatusEnumText,
+  InsurancePolicyAuditStatusEnumTextForFilter,
   InsurancePolicyAuditStatusEnum,
   InsurancePolicyProductIdNumberEnum,
   InsurancePolicyListPayStatusEnum,
   InsurancePolicyListPayStatusEnumText,
   InsuranceOccupationTypeTempPath,
+  InsurancePeriodEnum,
+  insuranceTypeTextForFilter,
 } from '@/constants';
 import dayjs from 'dayjs';
 import _ from 'lodash';
 import InsureInstructionsDialog from './components/InsureInstructionsDialog.vue';
+import { useInsureProductSchemeAllList, useUserInsureProductSetting } from '@/hooks';
 // import { Recorder } from '@/utils/record';
 
 defineOptions({
@@ -200,8 +205,16 @@
       onClick: (role) => handleUploadStampFile(role),
     },
     extraProps: {
-      hide: (row: API.GetInsurancePageOutput) =>
-        row.status !== InsurancePolicyStatusEnum.WaitEffect,
+      hide: (row: API.GetInsurancePageOutput) => {
+        if (row.productOnline) {
+          return (
+            row.auditStatus !== InsurancePolicyAuditStatusEnum.WaitAdd &&
+            row.auditStatus !== InsurancePolicyAuditStatusEnum.WaitAudit
+          );
+        } else {
+          return row.status !== InsurancePolicyStatusEnum.WaitEffect;
+        }
+      },
     },
   },
   {
@@ -216,19 +229,19 @@
       hide: (row: API.GetInsurancePageOutput) => row.productOnline || !row.insureBillUrl,
     },
   },
-  {
-    data: {
-      enCode: 'payBtn',
-      name: '鏀粯',
-    },
-    emits: {
-      onClick: (role) => handlePay(role),
-    },
-    extraProps: {
-      hide: (row: API.GetInsurancePageOutput) =>
-        row.payStatus != InsurancePolicyListPayStatusEnum.WaitPay,
-    },
-  },
+  // {
+  //   data: {
+  //     enCode: 'payBtn',
+  //     name: '鏀粯',
+  //   },
+  //   emits: {
+  //     onClick: (role) => handlePay(role),
+  //   },
+  //   extraProps: {
+  //     hide: (row: API.GetInsurancePageOutput) =>
+  //       row.payStatus != InsurancePolicyListPayStatusEnum.WaitPay,
+  //   },
+  // },
   {
     data: {
       enCode: 'stampFilesBtn',
@@ -263,6 +276,19 @@
   //     onClick: (role) => handleStandarEndo(role),
   //   },
   // },
+  {
+    data: {
+      enCode: 'submitAuditBtn',
+      name: '鎻愪氦瀹℃牳',
+    },
+    emits: {
+      onClick: (role) => handleSubmitAuditBtn(role),
+    },
+    extraProps: {
+      hide: (row: API.GetInsurancePageOutput) =>
+        row.auditStatus != InsurancePolicyAuditStatusEnum.WaitAdd,
+    },
+  },
 ]).filter(Boolean);
 
 const BaseState = {
@@ -358,6 +384,7 @@
     productIdNumber: '',
     productSchemeIdNumber: '',
     effectStartTime: dayjs().add(1, 'day').format('YYYY-MM-DD'),
+    effectEndTime: '',
   },
   closeAfterConfirm: false,
 });
@@ -374,13 +401,23 @@
     } else if (res === InsurancePolicyStatusEnum.OutTimeEffect) {
       await Message.tipMessage('璇ユ壒娆′繚鍗曞凡澶辨晥锛岃淇敼鎵规鍙峰悗閲嶆柊瀵煎叆');
     } else if (res === InsurancePolicyStatusEnum.WaitEffect) {
-      await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛屾槸鍚﹁鐩栵紵');
-      importInsStaffToList();
+      if (isSjbAccount.value) {
+        await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛岃淇敼鎵规鍙峰悗閲嶆柊瀵煎叆');
+      } else {
+        await Message.tipMessage('瀛樺湪鐩稿悓鐨勬壒娆″彿锛屾槸鍚﹁鐩栵紵');
+        importInsStaffToList();
+      }
     } else {
       importInsStaffToList();
     }
   } catch (error) {}
 }
+
+const { isSjbAccount, getInsureProductIdByIdNumber } = useUserInsureProductSetting();
+
+const { getInsureProductSchemeByIdNumber } = useInsureProductSchemeAllList({
+  insureProductId: computed(() => getInsureProductIdByIdNumber(editForm.productIdNumber)),
+});
 
 async function importInsStaffToList() {
   try {
@@ -391,42 +428,59 @@
       productSchemeIdNumber: editForm.productSchemeIdNumber,
       effectStartTime: editForm.effectStartTime,
     };
+    const currentInsureProductScheme = getInsureProductSchemeByIdNumber(
+      editForm.productSchemeIdNumber
+    );
+    if (currentInsureProductScheme?.period === InsurancePeriodEnum['1-29D']) {
+      params.effectEndTime = editForm.effectEndTime;
+    }
     let res = await insuranceOrderServices.importInsStaffToList(params, {
       timeout: 60 * 1000 * 10,
+      customErrorHandler(error) {
+        if (error?.response?.data?.error?.code === '10001') {
+          Message.tipMessage(error.response.data?.error?.message, {
+            showCancelButton: false,
+          });
+          return true;
+        }
+        return false;
+      },
     });
     if (res) {
+      // await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
+      try {
+        if (res.errorList.length > 0) {
+          await Message.tipMessage(
+            `鎬绘姇淇濅汉鏁�${res.importAllCount}浜猴紝鎶曚繚鎴愬姛${res.successCount}浜猴紝鎶曚繚澶辫触${res.errorList.length}浜烘槸鍚﹀鍑烘姇淇濆け璐ヤ汉鍛樻竻鍗曪紵`,
+            {
+              confirmButtonText: '瀵煎嚭',
+            }
+          );
+          XLSXUtils.exportToXLSX({
+            workbookDataList: res.errorList,
+            fileName: '閿欒浜哄憳鍚嶅崟',
+            workbookHeaderMap: {
+              name: '闆囧憳濮撳悕',
+              sex: '鎬у埆',
+              certType: '璇佷欢绫诲瀷',
+              certNo: '璇佷欢鍙风爜',
+              jobName: '闆囧憳宸ョ',
+              useEmploer: '鐢ㄥ伐鍗曚綅',
+              address: '鐢ㄥ伐鍦扮偣',
+              note: '澶囨敞',
+            },
+          });
+        } else {
+          await Message.tipMessage(
+            `鎬绘姇淇濅汉鏁�${res.importAllCount}浜猴紝鎶曚繚鎴愬姛${res.successCount}浜篳,
+            {
+              showCancelButton: false,
+            }
+          );
+        }
+      } catch (error) {}
       dialogState.dialogVisible = false;
       getList(paginationState.pageIndex);
-      // await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
-      if (res.errorList.length > 0) {
-        await Message.tipMessage(
-          `鎬绘姇淇濅汉鏁�${res.importAllCount}浜猴紝鎶曚繚鎴愬姛${res.successCount}浜猴紝鎶曚繚澶辫触${res.errorList.length}浜烘槸鍚﹀鍑烘姇淇濆け璐ヤ汉鍛樻竻鍗曪紵`,
-          {
-            confirmButtonText: '瀵煎嚭',
-          }
-        );
-        XLSXUtils.exportToXLSX({
-          workbookDataList: res.errorList,
-          fileName: '閿欒浜哄憳鍚嶅崟',
-          workbookHeaderMap: {
-            name: '闆囧憳濮撳悕',
-            sex: '鎬у埆',
-            certType: '璇佷欢绫诲瀷',
-            certNo: '璇佷欢鍙风爜',
-            jobName: '闆囧憳宸ョ',
-            useEmploer: '鐢ㄥ伐鍗曚綅',
-            address: '鐢ㄥ伐鍦扮偣',
-            note: '澶囨敞',
-          },
-        });
-      } else {
-        await Message.tipMessage(
-          `鎬绘姇淇濅汉鏁�${res.importAllCount}浜猴紝鎶曚繚鎴愬姛${res.successCount}浜篳,
-          {
-            showCancelButton: false,
-          }
-        );
-      }
     }
   } catch (error) {}
 }
@@ -436,7 +490,11 @@
 });
 
 function handleOpenInstructions() {
-  dialogInstructionsState.dialogVisible = true;
+  if (isSjbAccount.value) {
+    dialogInstructionsState.dialogVisible = true;
+  } else {
+    handleUpload();
+  }
 }
 
 async function handleUpload() {
@@ -612,7 +670,12 @@
 
 async function handleGoDownloadInvoice(row: API.GetInsurancePageOutput) {
   try {
-    await insuranceOrderServices.getInvoiceId({ id: row.id });
+    await insuranceOrderServices.getInvoiceId(
+      { id: row.id },
+      {
+        timeout: 60 * 1000 * 30,
+      }
+    );
     router.push({
       name: 'InsureDownloadInvoice',
       params: {
@@ -621,4 +684,17 @@
     });
   } catch (error) {}
 }
+
+async function handleSubmitAuditBtn(row: API.GetInsurancePageOutput) {
+  try {
+    let params: API.InsurancePolicyAuditInput = {
+      insurancePolicyId: row.id,
+    };
+    let res = await insuranceOrderServices.insurancePolicyAddAudit(params);
+    if (res) {
+      Message.successMessage('涓婁紶鎴愬姛');
+      getList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
 </script>

--
Gitblit v1.9.1