Selaa lähdekoodia

fix:自查部门添加检查记录时基础信息自动填充

sunqijun 1 kuukausi sitten
vanhempi
commit
1c5842f6d1

+ 1 - 0
src/api/production-safety-system/index.ts

@@ -779,6 +779,7 @@ interface AreaCheckPlanManageApiRecord {
   status?: number | string; // 状态:0=未开始 1=进行中 2=已完成 3=已终止
   /** save/update 请求体使用:主责部门名称 */
   primaryResponsibleDeptName?: string;
+  primaryResponsibleDeptPersonCode?: string;
   /** save/update 请求体使用:主责部门 code */
   primaryResponsibleDeptCode?: string;
   responsibleDeptName?: string; // 主责部门名称(兼容后端返回)

+ 9 - 4
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagementDept/components/areaCheckPlanRecordDetailDept.vue

@@ -321,15 +321,20 @@
     }
   };
   const viewDetailData = ref<Record<string, unknown>>({});
+  const authority = ref(false)
   const currentId = computed(() => Number(route.query.planId));
   const getDetail = async () => {
     if (!currentId.value) return;
     try {
       const res = await queryAreaCheckPlanManageDeptDetail(currentId.value);
-      const raw = (res as { data?: unknown })?.data ?? res;
-      const detail = mapAreaCheckPlanApiRecordToUi(raw);
-      viewDetailData.value = { ...detail };
-    //   loadRecordList();
+      viewDetailData.value = { ...res };
+      // 如果主责部门责任人ID包含当前登录人ID,则直接回填(被检查单位、 检查人员、检查时间、检查地点),且不可更改
+      let primaryResponsibleDeptPersonCode = res.primaryResponsibleDeptPersonCode?.split(',').map(Number)
+      if(primaryResponsibleDeptPersonCode?.includes(id)){
+        authority.value = true
+        formData.value.inspectedUnit = res.primaryResponsibleDeptName || ''
+        formData.value.inspector = String(res.primaryResponsibleDeptPersonName) || ''
+      }
     } catch (e) {
       console.error('获取详情失败:', e);
     }