From d40fa6a75abedca6d0849b38195e428ade19c702 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期五, 04 七月 2025 17:51:30 +0800
Subject: [PATCH] fix: bug

---
 src/views/Home/Home.vue |   99 ++++++++++++++++++++++++++++++++++---------------
 1 files changed, 69 insertions(+), 30 deletions(-)

diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index 3bc4ade..de84ceb 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()"
@@ -58,12 +58,13 @@
             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
@@ -137,7 +138,14 @@
 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,
@@ -146,6 +154,7 @@
   InsurancePolicyStatusEnum,
   AppType,
   InsurancePolicyAuditStatusEnumText,
+  InsurancePolicyAuditStatusEnumTextForFilter,
   InsurancePolicyAuditStatusEnum,
   InsurancePolicyProductIdNumberEnum,
   InsurancePolicyListPayStatusEnum,
@@ -155,6 +164,7 @@
 import dayjs from 'dayjs';
 import _ from 'lodash';
 import InsureInstructionsDialog from './components/InsureInstructionsDialog.vue';
+import { useUserInsureProductSetting } from '@/hooks';
 // import { Recorder } from '@/utils/record';
 
 defineOptions({
@@ -268,7 +278,7 @@
 onMounted(async () => {
   await getList();
   state.loading = false;
-  handleOpenInstructions();
+  // handleOpenInstructions();
 
   // setTimeout(() => {
   //   // recorder.value.init();
@@ -350,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) {
@@ -376,42 +387,70 @@
 
 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,
+    });
+    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) {}
 }
 
-const { dialogProps: dialogInstructionsProps, dialogState: dialogInstructionsState } = useDialog();
+const { dialogProps: dialogInstructionsProps, dialogState: dialogInstructionsState } = useDialog({
+  onConfirm: handleUpload,
+});
+
+const { isSjbAccount } = useUserInsureProductSetting();
 
 function handleOpenInstructions() {
-  dialogInstructionsState.dialogVisible = true;
+  if (isSjbAccount.value) {
+    dialogInstructionsState.dialogVisible = true;
+  } else {
+    handleUpload();
+  }
 }
 
-function handleUpload() {
+async function handleUpload() {
   handleAdd({
     serialNum: `${dayjs().format('YYYYMMDD')}${_.random(0, 9999).toString().padStart(4, '0')}`,
     url: [] as UploadUserFile[],
@@ -499,7 +538,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) {

--
Gitblit v1.9.1