Просмотр исходного кода

fix:修复区域检查计划问题

sunqijun 1 месяц назад
Родитель
Сommit
8398556b7c

+ 44 - 2
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagementDept/components/areaCheckPlanManagementDeptDetail.vue

@@ -254,6 +254,24 @@
       :formRules="sandHiddenDangerFormRulesDept"
       :formConfig="sandHiddenDangerFormConfigDept"
     >
+      <template #typeId>
+        <el-form-item prop="typeId" style="width: 100%;">
+          <el-select
+            v-model="sandHiddenDangerFormDataDept.typeId"
+            placeholder="请选择隐患问题类别"
+            filterable
+            clearable
+            style="width: 100%"
+          >
+            <el-option
+              v-for="item in dangerTypeList"
+              :key="item.id"
+              :label="item.categoryName"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+      </template>
       <template #rectificationDepartmentIds>
         <el-form-item prop="rectificationDepartmentIds" style="width: 100%;">
           <el-cascader
@@ -394,6 +412,9 @@
   } from '@/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form';
   import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
   import { downloadByData } from '@/utils/file/download';
+  import {
+    queryDangerTypePage,
+  } from '@/api/production-safety';
 
   const router = useRouter();
   const route = useRoute();
@@ -451,7 +472,7 @@
       const fullTree = (deptRes as DeptTree[]) ?? [];
       issueDeptTree.value = Array.isArray(fullTree) && fullTree[0]?.children ? fullTree[0].children : [];
       issueUserList.value = (userRes as any)?.records ?? [];
-    } catch (e) {
+    } catch (e:any) {
       console.error('获取部门/用户列表失败:', e);
       ElMessage.error(e?.message || e?.data || '加载部门或负责人列表失败');
       issueDeptTree.value = [];
@@ -541,7 +562,27 @@
     HIDDEN_DANGER_FORM_DATA as Record<string, unknown>,
     HIDDEN_DANGER_FORM_RULES,
   );
-
+  // 隐患类别数据
+  const dangerTypeList = ref<any[]>([])
+  const getTableData = async ()=> {
+    try {
+      // 将日期范围同步到查询参数
+     let params = {
+        pageNumber: 1,
+        pageSize: 1000,
+        queryParam: {
+            status: 1,
+        },
+     }
+      const res = await queryDangerTypePage(params);
+      if (res) {
+        dangerTypeList.value = res.records || [];
+      }
+    } catch (e) {
+      console.error('获取隐患类别列表失败:', e);
+      dangerTypeList.value = [];
+    }
+  }
   // 复用部门树与用户下拉,用于复查部门/人员 & 举一反三责任部门
   const deptTree = ref<DeptTree[]>([]);
   const cascaderDeptProp = {
@@ -701,6 +742,7 @@
 
   const handleSandToHiddenDangerDept = (row: { id?: number } & Record<string, unknown>) => {
     if (!row.id) return;
+    getTableData()
     currentRecordIdForUnqualified.value = Number(row.id);
     // 部门端入账同样不带入检查记录旧数据,每次打开还原为隐患台账初始表单
     Object.assign(sandHiddenDangerFormDataDept, HIDDEN_DANGER_FORM_DATA);

+ 19 - 1
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagementDept/components/areaCheckPlanRecordDetailDept.vue

@@ -105,7 +105,9 @@
   import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
   import type { FileItem } from '@/components/UploadFiles/types';
   import {
+    queryAreaCheckPlanManageDeptDetail,
     queryAreaCheckRecordDept,
+    mapAreaCheckPlanApiRecordToUi,
     queryAreaCheckRecordTemplateDept,
     saveAreaCheckPlanDetailDept,
     type AreaCheckRecordTemplateItem,
@@ -113,10 +115,12 @@
   import { formatAttachmentList } from '@/components/UploadFiles/utils';
   import PreviewOnline from '@/views/disaster/components/PreviewOnline.vue';
   import { downloadFile } from '@/views/disaster/utils';
+  import { useUserInfoHook } from '@/views/disaster/hooks';
 
   const previewOnlineRef = ref<InstanceType<typeof PreviewOnline>>();
   const router = useRouter();
   const route = useRoute();
+  const { id } = useUserInfoHook()
 
   const operate = computed(() => (route.query.operate as string) || '');
   const isAddMode = computed(() => operate.value === 'area-check-plan-record-add');
@@ -316,8 +320,22 @@
       previewOnlineRef.value?.open(url, type);
     }
   };
-
+  const viewDetailData = ref<Record<string, unknown>>({});
+  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();
+    } catch (e) {
+      console.error('获取详情失败:', e);
+    }
+  };
   onMounted(() => {
+    getDetail()
     initFormData();
   });
 </script>

+ 2 - 1
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form.ts

@@ -20,11 +20,12 @@ export const HIDDEN_DANGER_FORM_CONFIG: FormConfig[] = [
     prop: 'typeId',
     label: '隐患问题类别:',
     component: 'ElSelect',
+    slot: 'typeId',
     componentProps: {
       placeholder: '请选择隐患问题类别',
       style: { width: '100%' },
     },
-    selectOptions: DANGER_TYPE_OPTIONS,
+    // selectOptions: DANGER_TYPE_OPTIONS,
   },
   {
     prop: 'dangerProblem',