From 5cf7fd6bf3ca6e174b603c3591a3fbf699ddf976 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期二, 08 七月 2025 13:40:20 +0800
Subject: [PATCH] fix: 江佑保系统健壮性修复

---
 src/views/Home/Home.vue |  225 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 191 insertions(+), 34 deletions(-)

diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index ab3685d..3a619a3 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -27,7 +27,7 @@
           <QueryFilterItem>
             <FieldRadio
               v-model="extraParamState.auditStatus"
-              :value-enum="InsurancePolicyAuditStatusEnumText"
+              :value-enum="InsurancePolicyAuditStatusEnumTextForFilter"
               buttonStyle
               showAllBtn
               @change="getList()"
@@ -53,10 +53,18 @@
           </QueryFilterItem>
         </template>
         <template #btn>
+          <el-button
+            @click="handleDownloadOccupationType()"
+            type="primary"
+            style="margin-right: 10px"
+            link
+            v-if="isSjbAccount"
+            >鑱屼笟绫诲瀷瀵圭収琛�</el-button
+          >
           <el-button @click="handleDownload()" type="primary" style="margin-right: 10px" link
             >妯℃澘涓嬭浇</el-button
           >
-          <el-button @click="handleUpload()" type="primary" style="margin-right: 10px"
+          <el-button @click="handleOpenInstructions()" type="primary" style="margin-right: 10px"
             >瀵煎叆鎶曚繚浜哄憳</el-button
           >
           <!-- <el-button
@@ -87,8 +95,9 @@
             class="box-item"
             effect="dark"
             :content="row.auditRemark"
-            placement="top-start"
+            placement="top"
             v-if="row.auditStatus === InsurancePolicyAuditStatusEnum.Reject && row.auditRemark"
+            popper-class="max-width-popper"
           >
             <div style="display: inline-flex; align-items: center; color: inherit">
               {{ InsurancePolicyAuditStatusEnumText[row.auditStatus] }}
@@ -103,6 +112,7 @@
     </AppContainer>
     <UploadInsurePersonDialog v-bind="dialogProps" />
     <UploadStampFileDialog v-bind="dialogStampFileProps" />
+    <InsureInstructionsDialog v-bind="dialogInstructionsProps" />
   </LoadingLayout>
 </template>
 
@@ -121,13 +131,21 @@
   SearchInput,
   FieldRadio,
   XLSXUtils,
+  useDialog,
 } from '@bole-core/components';
 import * as insuranceOrderServices from '@/services/api/InsuranceOrder';
 import { Message, OrderInputType, downloadFileByUrl } from '@bole-core/core';
 import { columns } from './constants';
 import UploadInsurePersonDialog from './components/UploadInsurePersonDialog.vue';
 import UploadStampFileDialog from './components/UploadStampFileDialog.vue';
-import { format, downloadFile, setOSSLink, toThousand, convertApi2FormUrl } from '@/utils';
+import {
+  format,
+  downloadFile,
+  setOSSLink,
+  toThousand,
+  convertApi2FormUrl,
+  convertFormUrl2Api,
+} from '@/utils';
 import { ModelValueType } from 'element-plus';
 import {
   InsuranceOrderTempPath,
@@ -136,11 +154,18 @@
   InsurancePolicyStatusEnum,
   AppType,
   InsurancePolicyAuditStatusEnumText,
+  InsurancePolicyAuditStatusEnumTextForFilter,
   InsurancePolicyAuditStatusEnum,
   InsurancePolicyProductIdNumberEnum,
+  InsurancePolicyListPayStatusEnum,
+  InsurancePolicyListPayStatusEnumText,
+  InsuranceOccupationTypeTempPath,
 } from '@/constants';
 import dayjs from 'dayjs';
 import _ from 'lodash';
+import InsureInstructionsDialog from './components/InsureInstructionsDialog.vue';
+import { useUserInsureProductSetting } from '@/hooks';
+// import { Recorder } from '@/utils/record';
 
 defineOptions({
   name: 'Home',
@@ -166,8 +191,7 @@
     },
     extraProps: {
       hide: (row: API.GetInsurancePageOutput) =>
-        row.productIdNumber === InsurancePolicyProductIdNumberEnum.SJB ||
-        row.status !== InsurancePolicyStatusEnum.Effecting,
+        row.productOnline || row.status !== InsurancePolicyStatusEnum.Effecting,
     },
   },
   {
@@ -180,7 +204,6 @@
     },
     extraProps: {
       hide: (row: API.GetInsurancePageOutput) =>
-        row.auditStatus !== InsurancePolicyAuditStatusEnum.Pass ||
         row.status !== InsurancePolicyStatusEnum.WaitEffect,
     },
   },
@@ -193,9 +216,47 @@
       onClick: (role) => handleDownloadInsureFile(role),
     },
     extraProps: {
-      hide: (row: API.GetInsurancePageOutput) => !row.insureBillUrl,
+      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: 'stampFilesBtn',
+      name: '淇濆崟涓嬭浇',
+    },
+    emits: {
+      onClick: (role) => handleGoStampFiles(role),
+    },
+    extraProps: {
+      hide: (row: API.GetInsurancePageOutput) => !(row.productOnline && row.anyPayComplete),
+    },
+  },
+  {
+    data: {
+      enCode: 'downloadInvoiceBtn',
+      name: '鍙戠エ涓嬭浇',
+    },
+    emits: {
+      onClick: (role) => handleGoDownloadInvoice(role),
+    },
+    extraProps: {
+      hide: (row: API.GetInsurancePageOutput) => !(row.productOnline && row.anyPayComplete),
+    },
+  },
+
   // {
   //   data: {
   //     enCode: 'standarEndoBtn',
@@ -212,11 +273,22 @@
 };
 
 const state = reactive({ ...BaseState });
+// const recorder = ref(new Recorder());
 
 onMounted(async () => {
   await getList();
   state.loading = false;
+  // handleOpenInstructions();
+
+  // setTimeout(() => {
+  //   // recorder.value.init();
+  //   recorder.value.replaySession('9cb24e5a-0423-4dcd-abd5-fa7a4117cadc');
+  // }, 3000);
 });
+
+// onUnmounted(() => {
+//   recorder.value.stopRecordingAndSave();
+// });
 
 const {
   getDataSource: getList,
@@ -259,6 +331,7 @@
         formatter: (row: API.GetInsurancePageOutput) =>
           row.amount == null ? '' : toThousand(row.amount),
       },
+      payStatus: { type: 'enum', valueEnum: InsurancePolicyListPayStatusEnumText },
     },
   }
 );
@@ -287,15 +360,16 @@
     url: [] as UploadUserFile[],
     productIdNumber: '',
     productSchemeIdNumber: '',
+    effectStartTime: dayjs().add(1, 'day').format('YYYY-MM-DD'),
   },
   closeAfterConfirm: false,
 });
 
 async function checkInrancesSerialNumStatus() {
   try {
-    let params: API.APIimportInsStaffToListParams = {
+    let params: API.APIcheckInrancesSerialNumStatusParams = {
       serialNum: editForm.serialNum,
-      url: editForm.url?.[0]?.path,
+      // url: editForm.url?.[0]?.path,
     };
     let res = await insuranceOrderServices.checkInrancesSerialNumStatus(params);
     if (res === InsurancePolicyStatusEnum.Effecting) {
@@ -303,8 +377,12 @@
     } 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();
     }
@@ -313,36 +391,79 @@
 
 async function importInsStaffToList() {
   try {
-    let params: API.APIimportInsStaffToListParams = {
+    let params: API.ImportInsStaffToListFrontInput = {
       serialNum: editForm.serialNum,
       url: editForm.url?.[0]?.path,
       productIdNumber: editForm.productIdNumber,
       productSchemeIdNumber: editForm.productSchemeIdNumber,
+      effectStartTime: editForm.effectStartTime,
     };
-    let res = await insuranceOrderServices.importInsStaffToList(params);
-    if (res.length > 0) {
-      await Message.tipMessage('瀛樺湪閿欒鏁版嵁锛屾槸鍚﹀鍑猴紵');
-      XLSXUtils.exportToXLSX({
-        workbookDataList: res,
-        fileName: '閿欒浜哄憳鍚嶅崟',
-        workbookHeaderMap: {
-          name: '闆囧憳濮撳悕',
-          sex: '鎬у埆',
-          certType: '璇佷欢绫诲瀷',
-          certNo: '璇佷欢鍙风爜',
-          jobName: '闆囧憳宸ョ',
-          useEmploer: '鐢ㄥ伐鍗曚綅',
-          address: '鐢ㄥ伐鍦扮偣',
-          note: '澶囨敞',
-        },
-      });
+    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);
     }
-    dialogState.dialogVisible = false;
-    getList(paginationState.pageIndex);
   } catch (error) {}
 }
 
-function handleUpload() {
+const { dialogProps: dialogInstructionsProps, dialogState: dialogInstructionsState } = useDialog({
+  onConfirm: handleUpload,
+});
+
+const { isSjbAccount } = useUserInsureProductSetting();
+
+function handleOpenInstructions() {
+  if (isSjbAccount.value) {
+    dialogInstructionsState.dialogVisible = true;
+  } else {
+    handleUpload();
+  }
+}
+
+async function handleUpload() {
   handleAdd({
     serialNum: `${dayjs().format('YYYYMMDD')}${_.random(0, 9999).toString().padStart(4, '0')}`,
     url: [] as UploadUserFile[],
@@ -383,6 +504,10 @@
       downloadFile(res.data, `鍦ㄤ繚浜哄憳瀵煎嚭`, 'xlsx');
     }
   } catch (error) {}
+}
+
+function handleDownloadOccupationType() {
+  downloadFileByUrl(InsuranceOccupationTypeTempPath, '鑱屼笟绫诲瀷瀵圭収琛�');
 }
 
 function handleDownload() {
@@ -426,7 +551,7 @@
   try {
     let params: API.UploadInsuranceStampFilesInput = {
       insurancePolicyId: stampFileForm.id,
-      listFiles: stampFileForm.url?.map((x) => x.path) ?? [],
+      listFiles: convertFormUrl2Api(stampFileForm.url),
     };
     let res = await insuranceOrderServices.uploadInsuranceStampFiles(params);
     if (res) {
@@ -488,4 +613,36 @@
     // }
   } catch (error) {}
 }
+
+async function handleGoStampFiles(row: API.GetInsurancePageOutput) {
+  try {
+    router.push({
+      name: 'InsurancePolicyStampFiles',
+      params: {
+        id: row.id,
+      },
+    });
+  } catch (error) {}
+}
+
+function handlePay(row: API.GetInsurancePageOutput) {
+  router.push({
+    name: 'InsurePayDetail',
+    params: {
+      id: row.id,
+    },
+  });
+}
+
+async function handleGoDownloadInvoice(row: API.GetInsurancePageOutput) {
+  try {
+    await insuranceOrderServices.getInvoiceId({ id: row.id });
+    router.push({
+      name: 'InsureDownloadInvoice',
+      params: {
+        id: row.id,
+      },
+    });
+  } catch (error) {}
+}
 </script>

--
Gitblit v1.9.1