Преглед изворни кода

fix: 完善工伤认定申请

xiaweibo пре 2 месеци
родитељ
комит
4bf5ea96cb

+ 43 - 0
src/api/inventory/index.ts

@@ -30,6 +30,7 @@ export interface BusinessCertification {
   injuryReason: string; // 受伤原因
   departmentCode: string; // 部门编码
   templateId?: any; // 审批模板ID
+  departmentName?: string; // 部门名称
 }
 
 /**
@@ -92,6 +93,29 @@ export interface SaveInventoryRequest {
   trusteeIdCardUrl: string; // 被委托人员身份证正反面URL
 }
 
+/**
+ * 更新工伤认定请求参数
+ */
+export interface UpdateWorkInjuryApplyRequest {
+  id: number; // 工伤认定ID
+  applicantName: string; // 申请人姓名
+  applicantCode: string; // 申请人工号
+  injuryTime: string; // 受伤时间 (ISO 格式)
+  status: boolean; // 状态(1-启用/0-禁用)
+  injuryReason: string; // 受伤原因
+  accidentCertUrl: string; // 事故报告URL
+  powerAttorneyUrl: string; // 授权委托书URL
+  addressConfirmUrl: string; // 地址确认URL
+  applicationFormUrl: string; // 申请表URL
+  idCardUrl: string; // 身份证正反面URL
+  laborContractUrl: string; // 劳动合同URL
+  initialMedicalCertUrl: string; // 初次医疗证明URL
+  trusteeIdCardUrl: string; // 被委托人员身份证正反面URL
+  departmentName: string; // 部门名称
+  departmentCode: string | number[]; // 部门编码
+  templateId: number; // 审批模板ID
+}
+
 /**
  * 查询物品库存管理列表
  */
@@ -209,4 +233,23 @@ export function saveApproval(data: SaveApprovalReq) {
     method: 'post',
     data,
   });
+}
+
+/**
+ * 查询工伤认定详情
+ */
+export function queryWorkInjuryApplyDetail(id: number) {
+  return http.request<BusinessCertification>({
+    url: `/WorkInjuryApply/queryWorkInjuryApplyDetail?id=${id}`,
+    method: 'post',
+  });
+}
+
+/** 编辑工伤认定(保存/提交,带审批信息) */
+export function updateWorkInjuryApply(data: UpdateWorkInjuryApplyRequest) {
+  return http.request({
+    url: '/WorkInjuryApply/updateWorkInjuryApply',
+    method: 'put',
+    data,
+  });
 }

+ 1 - 0
src/api/production-safety/business-registration-application.ts

@@ -19,6 +19,7 @@ export interface InventoryItem {
   approvalOrder: number; // 审批订单
   templateId: string; // 模板ID
   injuryCategoryCode: string; // 工伤类别编码
+  rejectReason: string; // 拒绝原因
 }
 
 /**

+ 54 - 39
src/views/production-safety/risk-identification-and-control/work-injury-apply-manage/components/detail.vue

@@ -1,5 +1,13 @@
 <template>
   <main class="safety-platform-container__main">
+    <el-alert
+      v-if="rejectReason && (Number(approvalStatus) === 3)"
+      type="error"
+      :title="'不通过原因:' + rejectReason"
+      show-icon
+      class="detail-reject-alert"
+    />
+
     <BasicForm
       ref="basicFormRef"
       :formData="ruleFormData"
@@ -12,7 +20,7 @@
           v-model="ruleFormData.approvalTemplateId"
           placeholder="审批流程"
           filterable
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           popper-class="el-scrollbar--custom"
         >
           <el-option v-for="item in approvalList" :key="item.id" :label="item.templateName" :value="item.id" />
@@ -21,13 +29,13 @@
       <template #reviewDepartmentId>
         <el-cascader
           v-model="ruleFormData.departmentCode"
-          ref="cascaderRef"
+          ref="cascaderRef" 
           :options="firstLevelDepts"
           :props="cascaderProp"
           :show-all-levels="false"
           placeholder="部门名称"
           filterable
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @change="handleChangeDept"
         />
       </template>
@@ -35,8 +43,7 @@
         <UploadFiles
           label="上传事故报告"
           :file-list="accidentCertUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleAccidentReportUploadSuccess"
           @preview="handlePreview"
         />
@@ -45,8 +52,7 @@
         <UploadFiles
           label="上传委托书"
           :file-list="powerAttorneyUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handlePowerOfAttorneyUploadSuccess"
           @preview="handlePreview"
         />
@@ -55,8 +61,7 @@
         <UploadFiles
           label="上传地址确认书"
           :file-list="addressConfirmUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleAddressConfirmationUploadSuccess"
           @preview="handlePreview"
         />
@@ -65,8 +70,7 @@
         <UploadFiles
           label="上传申请表"
           :file-list="applicationFormUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleApplicationFormUploadSuccess"
           @preview="handlePreview"
         />
@@ -75,8 +79,7 @@
         <UploadFiles
           label="上传身份证正反面"
           :file-list="idCardUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleIdCardUploadSuccess"
           @preview="handlePreview"
         />
@@ -85,8 +88,7 @@
         <UploadFiles
           label="上传劳动合同"
           :file-list="laborContractUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleLaborContractUploadSuccess"
           @preview="handlePreview"
         />
@@ -95,8 +97,7 @@
         <UploadFiles
           label="上传初次医疗证明"
           :file-list="initialMedicalCertUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleInitialMedicalCertificateUploadSuccess"
           @preview="handlePreview"
         />
@@ -105,8 +106,7 @@
         <UploadFiles
           label="上传被委托人员身份证正反面"
           :file-list="trusteeIdCardUrl"
-          :readonly="!isCreateMode"
-          :disabled="!isCreateMode"
+          :disabled="isViewMode || isAuditMode"
           @uploadSuccess="handleAgentIdCardUploadSuccess"
           @preview="handlePreview"
         />
@@ -172,7 +172,7 @@
         <el-button @click="basicDialogRef.closeDialog">取消</el-button>
       </template>
     </BasicDialog>
-      <!-- 审核不通过原因 -->
+    <!-- 审核不通过原因 -->
     <el-dialog
       v-model="showRejectDialog"
       title="审核不通过"
@@ -225,7 +225,14 @@
   import BasicForm from '@/components/BasicForm.vue';
   import { useFormConfigHook } from '@/hooks/useFormConfigHook';
   import { INVENTORY_FORM_CONFIG, INVENTORY_FORM_DATA, INVENTORY_FORM_RULES } from '../configs/form';
-  import { queryInventoryDetail, saveBusinessInformation, updateInventory , submitApprovalProcess, auditPurchaseApply } from '@/api/inventory';
+  import { 
+    queryWorkInjuryApplyDetail, 
+    saveBusinessInformation, 
+    updateInventory , 
+    submitApprovalProcess, 
+    auditPurchaseApply,
+    updateWorkInjuryApply,
+   } from '@/api/inventory';
   import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
   import type { FileItem } from '@/components/UploadFiles/types';
   import { formatAttachmentList } from '@/components/UploadFiles/utils';
@@ -264,9 +271,10 @@ import { template } from 'lodash-es';
   const isAuditMode = computed(() => operate.value === 'inventory-audit');
   const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
   const cascaderRef = ref();
-  const rejectReason = ref('');
+  const rejectReason = ref<string>(route.query.rejectReason as string || '');
   const approvalOrder = ref<string>(route.query.approvalOrder as string || '');
   const approvalTemplateId = ref<string>(route.query.approvalTemplateId as string || '');
+  const approvalStatus = ref<string>(route.query.approvalStatus as string || '');
   const auditType = ref(true);
 
   const basicDialogRef = ref();
@@ -316,24 +324,25 @@ import { template } from 'lodash-es';
   const getDetail = async () => {
     if (!currentId.value) return;
     try {
-      const res = await queryInventoryDetail(currentId.value);
+      const res = await queryWorkInjuryApplyDetail(currentId.value);
       if (res) {
         // 映射接口字段到表单字段
         ruleFormData.itemName = res.applicantName || ''; // 申请人姓名
-        ruleFormData.applicantCode = res.applicantCode || ''; // 工号
-        ruleFormData.warehouseDate = res.injuryTime ? res.injuryTime.split('T')[0] : ''; // 受伤时间
-        ruleFormData.status = res.status ? 'ENABLE' : 'DISABLE'; // 状态
-        ruleFormData.remarks = res.injuryReason || ''; // 受伤原因
-        ruleFormData.accidentCertUrl = res.accidentCertUrl || ''; // 事故报告
-        ruleFormData.powerAttorneyUrl = res.powerAttorneyUrl || ''; // 委托书
-        ruleFormData.addressConfirmUrl = res.addressConfirmUrl || ''; // 地址确认书
-        ruleFormData.applicationFormUrl = res.applicationFormUrl || ''; // 申请表
-        ruleFormData.idCardUrl = res.idCardUrl || ''; // 身份证正反面
-        ruleFormData.laborContractUrl = res.laborContractUrl || ''; // 劳动合同
-        ruleFormData.initialMedicalCertUrl = res.initialMedicalCertUrl || ''; // 初次医疗证明
-        ruleFormData.trusteeIdCardUrl = res.trusteeIdCardUrl || ''; // 被委托人员身份证正反面
-        ruleFormData.departmentCode = JSON.parse(res.departmentCode || '[]') || ''; // 部门编码
-        ruleFormData.approvalTemplateId = res.templateId || ''; // 审批模板ID
+      ruleFormData.applicantCode = res.applicantCode || ''; // 工号
+      ruleFormData.warehouseDate = res.injuryTime ? res.injuryTime.split('T')[0] : ''; // 受伤时间
+      ruleFormData.status = res.status ? 'ENABLE' : 'DISABLE'; // 状态
+      ruleFormData.remarks = res.injuryReason || ''; // 受伤原因
+      ruleFormData.accidentCertUrl = res.accidentCertUrl || ''; // 事故报告
+      ruleFormData.powerAttorneyUrl = res.powerAttorneyUrl || ''; // 委托书
+      ruleFormData.addressConfirmUrl = res.addressConfirmUrl || ''; // 地址确认书
+      ruleFormData.applicationFormUrl = res.applicationFormUrl || ''; // 申请表
+      ruleFormData.idCardUrl = res.idCardUrl || ''; // 身份证正反面
+      ruleFormData.laborContractUrl = res.laborContractUrl || ''; // 劳动合同
+      ruleFormData.initialMedicalCertUrl = res.initialMedicalCertUrl || ''; // 初次医疗证明
+      ruleFormData.trusteeIdCardUrl = res.trusteeIdCardUrl || ''; // 被委托人员身份证正反面
+      ruleFormData.departmentCode = JSON.parse(res.departmentCode || '[]') || ''; // 部门编码
+      ruleFormData.departmentName = res.departmentName || ''; // 添加这一行,设置部门名称
+      ruleFormData.approvalTemplateId = res.templateId || ''; // 审批模板ID
       }
       cloneRuleFormData();
     } catch (e) {
@@ -376,13 +385,16 @@ import { template } from 'lodash-es';
         basicDialogRef.value.openDialog();
         return;
       } else if (isEditMode.value && currentId.value) {
-        await updateInventory({
+        await updateWorkInjuryApply({
           id: currentId.value,
           ...basePayload,
         });
         ElMessage.success('保存成功');
+        await getApprovalNode(Number(ruleFormData.approvalTemplateId));
+        basicDialogRef.value.openDialog();
+        return;
       }
-
+      cloneRuleFormData();
       router.back();
     } catch (e) {
       console.error('保存物品库存失败:', e);
@@ -671,4 +683,7 @@ import { template } from 'lodash-es';
 
 <style scoped lang="scss">
   @use '@/styles/page-details-layout.scss' as *;
+  .detail-reject-alert{
+    margin-bottom: 20px;
+  }
 </style>

+ 2 - 0
src/views/production-safety/risk-identification-and-control/work-injury-apply-manage/configs/form.ts

@@ -117,4 +117,6 @@ export const INVENTORY_FORM_RULES = {
   applicantCode: [{ required: true, message: '请输入工号', trigger: 'blur' }],
   departmentCode: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
   remarks: [{ required: true, message: '请输入受伤原因', trigger: 'blur' }],
+  departmentName: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
+  approvalTemplateId: [{ required: true, message: '请选择审批流程', trigger: 'change' }],
 };

+ 8 - 2
src/views/production-safety/risk-identification-and-control/work-injury-apply-manage/list.vue

@@ -96,7 +96,7 @@
                 </template>
                 <!-- 审核不通过:编辑、删除、查看 -->
                 <template v-else-if="scope.row.status === 3 || scope.row.status === '3'">
-                  <ActionButton text="编辑" @click="handleEdit(scope.row.id)" />
+                  <ActionButton text="编辑" @click="handleEdit(scope.row.id,scope.row)" />
                   <ActionButton
                     text="删除"
                     :popconfirm="{ title: '确定要删除该申请吗?' }"
@@ -213,6 +213,7 @@
           approvalOrder: item.approvalOrder, // 审批订单
           templateId: item.templateId, // 模板ID
           injuryCategoryCode: item.injuryCategoryCode, // 工伤类别编码
+          rejectReason: item.rejectReason, // 拒绝原因
         }));
         pagination.total = res.totalRow;
       }
@@ -281,11 +282,16 @@
     });
   };
 
-  const handleEdit = (id: number) => {
+  const handleEdit = (id: number,row: any) => {
     router.push({
       name: 'workInjuryApplyManageItem',
       query: {
         id,
+        rejectReason:row.rejectReason ?? '',
+        approvalTemplateId:row.templateId ?? '',
+        approvalOrder:row.approvalOrder ?? '',
+        approvalStatus:row.status ?? '',
+        injuryCategoryCode:row.injuryCategoryCode ?? '',
         operate: 'inventory-edit',
       },
     });