From 92ca6bd9fa4d1dd0cb04834c238aa0f5e9c28385 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 07 七月 2025 16:46:45 +0800
Subject: [PATCH] fix: 江佑保系统健壮性修复

---
 src/views/Home/components/InsureOrderInfoView.vue |  322 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 264 insertions(+), 58 deletions(-)

diff --git a/src/views/Home/components/InsureOrderInfoView.vue b/src/views/Home/components/InsureOrderInfoView.vue
index 0d80311..ab32e98 100644
--- a/src/views/Home/components/InsureOrderInfoView.vue
+++ b/src/views/Home/components/InsureOrderInfoView.vue
@@ -1,12 +1,21 @@
 <template>
   <LoadingLayout :loading="state.loading">
-    <AppScrollContainer>
+    <AppContainer>
       <ChunkCell title="">
         <ProForm :model="detail" ref="formRef" label-width="120px" :is-read="true">
           <ProFormCol>
             <ProFormColItem :span="8">
               <ProFormItemV2 label="淇濆崟鍙�:" prop="insureBillNo">
-                <ProFormText v-model.trim="detail.insureBillNo" />
+                <div class="pro-from-item-read-content-wrapper" v-if="!!detail.insureBillNo">
+                  {{ detail.insureBillNo }}
+                  <el-button
+                    type="primary"
+                    link
+                    @click="handleGoStampFiles(id)"
+                    v-if="detail.productOnline && detail.anyPayComplete"
+                    >璇︽儏</el-button
+                  >
+                </div>
               </ProFormItemV2>
             </ProFormColItem>
             <ProFormColItem :span="8">
@@ -51,6 +60,22 @@
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
+          <ProFormCol v-if="detail.productOnline">
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎬讳繚璐�:" prop="amount">
+                <ProFormInputNumber v-model="detail.amount" unit="鍏�" formatValue="money" />
+              </ProFormItemV2>
+            </ProFormColItem>
+            <ProFormColItem :span="8">
+              <ProFormItemV2 label="鎬讳繚棰�:" prop="sumInsured">
+                <ProFormInputNumber
+                  v-model.trim="detail.sumInsured"
+                  unit="鍏�"
+                  formatValue="money"
+                />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="8">
               <ProFormItemV2 label="鎶曚繚浜�:" prop="insurerName">
@@ -65,8 +90,11 @@
           </ProFormCol>
         </ProForm>
       </ChunkCell>
-      <ChunkCell title="浜哄憳淇℃伅">
-        <template #titleRight v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect">
+      <ChunkCell title="浜哄憳淇℃伅" class="full-table-chunk">
+        <template
+          #titleRight
+          v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect && !detail.productOnline"
+        >
           <el-button type="primary" @click="handleBatchChange">鎵规敼鐢宠</el-button>
         </template>
         <ProTableQueryFilterBar @on-reset="reset">
@@ -82,43 +110,65 @@
             </QueryFilterItem>
           </template>
           <template #btn>
-            <template v-if="detail.status === InsurancePolicyStatusEnum.WaitEffect">
-              <el-button @click="handleTemplateDownload()" link type="primary">妯℃澘涓嬭浇</el-button>
-              <BlFileUpload
-                :limitFileSize="10"
-                accept="xls,xlsx"
-                :showTip="false"
-                :show-file-list="false"
-                :on-success="handleUploadSuccess"
-                style="margin-right: 10px; margin-left: 10px"
+            <template v-if="detail.productOnline">
+              <el-button
+                v-if="detail.auditStatus === InsurancePolicyAuditStatusEnum.Pass"
+                @click="handleSupplySubmit()"
+                type="primary"
+                >琛ユ彁</el-button
               >
-                <template #default>
-                  <el-button icon="Plus" type="primary">瀵煎叆</el-button>
-                </template>
-              </BlFileUpload>
-              <el-button @click="handleClear()" type="primary">娓呯┖鏁版嵁</el-button>
+              <el-button @click="handleExport(InsuranceDetailStatusEnum.Effecting)" type="primary"
+                >瀵煎嚭鍦ㄤ繚浜哄憳</el-button
+              >
+              <el-button @click="handleExport(InsuranceDetailStatusEnum.Fail)" type="primary"
+                >瀵煎嚭閿欒浜哄憳</el-button
+              >
+              <template v-if="detail.status !== InsurancePolicyStatusEnum.WaitEffect">
+                <el-button @click="handleGoStampFiles(id)" type="primary">涓嬭浇淇濆崟</el-button>
+                <el-button @click="handleGoDownloadInvoice(id)" type="primary">涓嬭浇鍙戠エ</el-button>
+              </template>
             </template>
             <template v-else>
-              <el-button @click="handleDownloadPerson()" type="primary">涓嬭浇浜哄憳娓呭崟</el-button>
-              <el-button @click="handleDownloadOrder()" type="primary">涓嬭浇淇濆崟</el-button>
+              <template v-if="detail.status === InsurancePolicyStatusEnum.WaitEffect">
+                <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 v-else>
+                <el-button @click="handleExport(null)" type="primary">涓嬭浇浜哄憳娓呭崟</el-button>
+                <el-button @click="handleDownloadOrder()" type="primary">涓嬭浇淇濆崟</el-button>
+              </template>
             </template>
           </template>
         </ProTableQueryFilterBar>
-        <ProTableV2
-          v-bind="proTableProps"
-          :columns="column"
-          :operationBtns="operationBtns"
-          :auto-height="false"
-          ref="proTable"
-          :tableProps="{
-            maxHeight: '400px',
-          }"
-        >
-        </ProTableV2>
+        <div class="full-table-chunk-table">
+          <ProTableV2
+            v-bind="proTableProps"
+            :columns="column"
+            :operationBtns="operationBtns"
+            ref="proTable"
+          >
+          </ProTableV2>
+        </div>
       </ChunkCell>
       <ChangePersonInfoDialog v-bind="dialogProps"></ChangePersonInfoDialog>
       <InsureClaimDetailDialog v-bind="dialogInsureClaimProps"></InsureClaimDetailDialog>
-    </AppScrollContainer>
+      <UploadInsurePersonDialog v-bind="dialogSupplyProps" isSupply />
+    </AppContainer>
   </LoadingLayout>
 </template>
 
@@ -151,6 +201,9 @@
   insuranceTypeText,
   InsurancePolicyStatusEnum,
   InsurancePolicyStatusEnumText,
+  InsurancePolicyAuditStatusEnum,
+  InsuranceDetailStatusEnumText,
+  InsuranceDetailStatusEnum,
 } from '@/constants';
 import ChangePersonInfoDialog from './ChangePersonInfoDialog.vue';
 import InsureClaimDetailDialog from './InsureClaimDetailDialog.vue';
@@ -159,6 +212,13 @@
 import { useQuery, useQueryClient } from '@tanstack/vue-query';
 import { downloadFile, downloadFileByUrl, Message, OrderInputType } from '@bole-core/core';
 import { setOSSLink } from '@/utils';
+import dayjs from 'dayjs';
+import {
+  useInsureActions,
+  useInsureProductSchemeAllList,
+  useUserInsureProductSetting,
+} from '@/hooks';
+import UploadInsurePersonDialog from './UploadInsurePersonDialog.vue';
 
 defineOptions({
   name: 'InsureOrderInfoView',
@@ -194,6 +254,16 @@
     name: '闆囧憳宸ョ',
   },
   {
+    id: '51',
+    enCode: 'occupationType',
+    name: '鑱屼笟绫诲瀷',
+  },
+  {
+    id: '52',
+    enCode: 'occupationCode',
+    name: '鑱屼笟鐮佸��',
+  },
+  {
     id: '6',
     enCode: 'userEmploer',
     name: '鐢ㄥ伐鍗曚綅',
@@ -222,6 +292,24 @@
     width: 140,
   },
   {
+    id: '101',
+    enCode: 'payOrder',
+    name: '鎵规鍙�',
+    width: 140,
+  },
+  {
+    id: '102',
+    enCode: 'status',
+    name: '鎶曚繚鐘舵��',
+    width: 140,
+  },
+  {
+    id: '103',
+    enCode: 'auditRemark',
+    name: '澶囨敞',
+    width: 140,
+  },
+  {
     id: '11',
     enCode: 'claimCount',
     name: '鐞嗚禂',
@@ -240,7 +328,9 @@
     },
     extraProps: {
       hide: (row: API.GetInsuranceStaffPageTemplate) =>
-        detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect,
+        detail.value?.productOnline ||
+        detail.value?.status !== InsurancePolicyStatusEnum.WaitEffect ||
+        detail.value?.auditStatus === InsurancePolicyAuditStatusEnum.Pass,
     },
   },
   {
@@ -312,6 +402,7 @@
       let res = await insuranceOrderServices.getInsuranceStaffList(params, {
         showLoading: !state.loading,
       });
+      console.log('res: ', res);
       return res;
     } catch (error) {}
   },
@@ -320,7 +411,12 @@
       keyWord: '',
       orderInput: [{ property: 'id', order: OrderInputType.Asc }],
     },
-    columnsRenderProps: {},
+    columnsRenderProps: {
+      status: {
+        type: 'enum',
+        valueEnum: InsuranceDetailStatusEnumText,
+      },
+    },
   }
 );
 
@@ -365,39 +461,28 @@
           note: '澶囨敞',
         },
       });
-    } else {
-      await Message.tipMessage('鏄惁瑕嗙洊褰撳墠浜哄憳娓呭崟淇℃伅?');
-      queryClient.invalidateQueries({
-        queryKey: ['insuranceOrderServices/getInsuranceStaffList'],
-      });
-      getInsuranceStaffList();
     }
+    queryClient.invalidateQueries({
+      queryKey: ['insuranceOrderServices/getInsuranceStaffList'],
+    });
+    getInsuranceStaffList();
   } 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));
 }
 
+const { handleGoDownloadInvoice, handleGoStampFiles } = useInsureActions();
+
 function handleBatchChange() {
+  if (
+    dayjs(detail.value?.effectEndTime).isBefore(dayjs()) ||
+    dayjs(detail.value?.effectEndTime).isSame(dayjs(), 'day')
+  ) {
+    Message.errorMessage('淇濋櫓浠婂ぉ鍒版湡锛屾棤娉曟壒鏀�');
+    return;
+  }
   router.push({
     name: 'BatchChange',
     params: {
@@ -473,8 +558,129 @@
     });
   } 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) {}
+}
+
+const { getInsureProductIdByIdNumber } = useUserInsureProductSetting();
+const { getInsureProductSchemeByCode } = useInsureProductSchemeAllList({
+  insureProductId: computed(() => getInsureProductIdByIdNumber(detail.value.productIdNumber)),
+});
+
+function handleSupplySubmit() {
+  handleSupplyAdd({
+    serialNum: detail.value.serialNum,
+    productIdNumber: detail.value.productIdNumber,
+    productSchemeIdNumber: getInsureProductSchemeByCode(detail.value.productSchemeCode)?.idNumber,
+    effectStartTime: detail.value.effectStartTime,
+  });
+}
+
+const {
+  dialogProps: dialogSupplyProps,
+  handleAdd: handleSupplyAdd,
+  editForm: supplyForm,
+  dialogState: dialogSupplyState,
+} = useFormDialog({
+  onConfirm: supplySubmit,
+  defaultFormParams: {
+    serialNum: '',
+    url: [] as UploadUserFile[],
+    productIdNumber: '',
+    productSchemeIdNumber: '',
+    effectStartTime: dayjs().add(1, 'day').format('YYYY-MM-DD'),
+  },
+  closeAfterConfirm: false,
+});
+
+async function supplySubmit() {
+  try {
+    let params: API.FillInsStaffToListFrontInput = {
+      insurancePolicyId: id,
+      url: supplyForm.url?.[0]?.path,
+    };
+    let res = await insuranceOrderServices.fillInsStaffToList(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) {}
+      dialogSupplyState.dialogVisible = false;
+      getInsuranceStaffList(paginationState.pageIndex);
+    }
+  } catch (error) {}
+}
 </script>
 
 <style lang="scss" scoped>
 @use '@/style/common.scss' as *;
+
+.full-table-chunk {
+  display: flex;
+  min-height: 0;
+  flex: 1;
+  flex-direction: column;
+
+  :deep() {
+    .chunk-cell-content {
+      display: flex;
+      flex-direction: column;
+      flex: 1;
+      min-height: 0;
+    }
+  }
+
+  .full-table-chunk-table {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+    min-height: 0;
+  }
+}
 </style>

--
Gitblit v1.9.1