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

feat:区域检查计划理端管理端-详情

sunqijun недель назад: 3
Родитель
Сommit
8577e1b022

+ 23 - 7
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanTask/areaCheckPlanTask.vue

@@ -81,15 +81,14 @@
             </template>
             </template>
             <template #checkItemTotal="scope">
             <template #checkItemTotal="scope">
               <span>{{
               <span>{{
-                scope.row.checkItemTotal ? scope.row.checkItemTotal+'项' : '-'
+                scope.row.checkItemTotal ?? 0
               }}</span>
               }}</span>
             </template>
             </template>
             <template #qualifiedItemNum="scope">
             <template #qualifiedItemNum="scope">
-              <span>{{ scope.row.qualifiedItemNum ? scope.row.qualifiedItemNum+'项' : '-' }}</span>
+              <span>{{ scope.row.qualifiedItemNum ?? 0 }}</span>
             </template>
             </template>
             <template #unqualifiedItemNum="scope">
             <template #unqualifiedItemNum="scope">
-              <span style="color:#1777ff;" v-if="scope.row.unqualifiedItemNum" @click="openUnqualifiedDialog(scope.row)">{{ scope.row.unqualifiedItemNum+'项'}}</span>
-              <span v-else>-</span>
+              <span style="color:#1777ff;cursor: pointer;"  @click="openUnqualifiedDialog(scope.row)">{{ scope.row.unqualifiedItemNum ?? 0}}</span>
             </template>
             </template>
             <template #action="scope">
             <template #action="scope">
               <div class="action-container--div" style="justify-content: flex-start">
               <div class="action-container--div" style="justify-content: flex-start">
@@ -244,7 +243,7 @@
           <el-cascader
           <el-cascader
             ref="reviewDeptRef"
             ref="reviewDeptRef"
             v-model="sandHiddenDangerFormDataDept.reviewDepartmentId"
             v-model="sandHiddenDangerFormDataDept.reviewDepartmentId"
-            :options="issueDeptTree"
+            :options="deptTree"
             :props="cascaderDeptProp"
             :props="cascaderDeptProp"
             :show-all-levels="false"
             :show-all-levels="false"
             placeholder="请选择复查人员所属部门"
             placeholder="请选择复查人员所属部门"
@@ -544,6 +543,7 @@
       { label: '室内外停车场', value: '室内外停车场' },
       { label: '室内外停车场', value: '室内外停车场' },
     ];
     ];
     getTableData();
     getTableData();
+    loadDeptAndUserOptionsDept();
     onIssueDialogOpen();
     onIssueDialogOpen();
   });
   });
 
 
@@ -614,7 +614,8 @@
   );
   );
   const issueDeptTree = ref<DeptTree[]>([]);
   const issueDeptTree = ref<DeptTree[]>([]);
   const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
   const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
-  // 部门树与用户下拉:与 onIssueDialogOpen 中加载的 issueDeptTree 同源(整改/复查/举一反三共用)
+// 复用部门树与用户下拉,用于复查部门/人员 & 举一反三责任部门
+  const deptTree = ref<DeptTree[]>([]);
   const cascaderDeptProp = {
   const cascaderDeptProp = {
     checkStrictly: true,
     checkStrictly: true,
     expandTrigger: 'hover' as const,
     expandTrigger: 'hover' as const,
@@ -625,7 +626,7 @@
   const drawLessonsDeptIdsArrayDept = ref<number[]>([]);
   const drawLessonsDeptIdsArrayDept = ref<number[]>([]);
   const reviewUserListDept = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
   const reviewUserListDept = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
 
 
-  const deptOptions = computed(() => flattenDeptTree(issueDeptTree.value));
+  const deptOptions = computed(() => flattenDeptTree(deptTree.value));
   const flattenDeptTree = (nodes: DeptTree[] | undefined): Array<{ id: number; deptName: string }> => {
   const flattenDeptTree = (nodes: DeptTree[] | undefined): Array<{ id: number; deptName: string }> => {
     if (!nodes?.length) return [];
     if (!nodes?.length) return [];
     const list: Array<{ id: number; deptName: string }> = [];
     const list: Array<{ id: number; deptName: string }> = [];
@@ -638,6 +639,21 @@
     walk(nodes);
     walk(nodes);
     return list;
     return list;
   }
   }
+    const loadDeptAndUserOptionsDept = async () => {
+    try {
+      const [deptRes, userRes] = await Promise.all([
+        getAllDepartments(),
+        queryAvailableUserList({ pageNumber: 1, pageSize: 9999, queryParam: {} }),
+      ]);
+      const fullTree = (deptRes as DeptTree[]) ?? [];
+      deptTree.value = Array.isArray(fullTree) && fullTree[0]?.children ? fullTree[0].children : [];
+      reviewUserListDept.value = (userRes as any)?.records ?? [];
+    } catch (e) {
+      console.error('获取部门/用户列表失败:', e);
+      deptTree.value = [];
+      reviewUserListDept.value = [];
+    }
+  };
   const openUnqualifiedDialog = (row: { id?: number } & Record<string, unknown>) => {
   const openUnqualifiedDialog = (row: { id?: number } & Record<string, unknown>) => {
     if (!row.id) return;
     if (!row.id) return;
     currentRecordIdForUnqualified.value = Number(row.id);
     currentRecordIdForUnqualified.value = Number(row.id);

+ 8 - 5
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanTask/components/areaCheckPlanRecordDetail.vue

@@ -303,15 +303,18 @@
 })
 })
 // 开始任务检查的检查明细列表
 // 开始任务检查的检查明细列表
   const loadCheckItems = async () => {
   const loadCheckItems = async () => {
-    if (!planId.value) {
+    if (!recordId.value) {
       // 没有计划ID时,不展示任何检查明细
       // 没有计划ID时,不展示任何检查明细
       checkItems.value = [];
       checkItems.value = [];
       return;
       return;
     }
     }
     try {
     try {
-      const res = await fetchDeptAreaCheckRecord(planId.value);
+      const res = await fetchDeptAreaCheckRecord(recordId.value);
       const list = res.areaCheckRecords || [];
       const list = res.areaCheckRecords || [];
       checkItemData = res
       checkItemData = res
+      if(checkType.value === 1){
+        formData.value.inspectedUnit = res.checkedCompanyName || ''
+      }
       if (Array.isArray(list) && list.length > 0) {
       if (Array.isArray(list) && list.length > 0) {
         checkItems.value = list;
         checkItems.value = list;
       } else {
       } else {
@@ -329,10 +332,10 @@
     if (isAddMode.value) {
     if (isAddMode.value) {
       const { planName, checkVenue } = route.query;
       const { planName, checkVenue } = route.query;
       formData.value = {
       formData.value = {
-        inspectedUnit: planName ? String(planName) : '',
+        inspectedUnit: '',
         inspector: '',
         inspector: '',
         checkTime: '',
         checkTime: '',
-        checkPlace: checkVenue ? String(checkVenue) : '',
+        checkPlace: '',
         overallDesc: '',
         overallDesc: '',
         signFile: '',
         signFile: '',
       };
       };
@@ -350,7 +353,7 @@
   };
   };
 
 
   const authority = ref(false)
   const authority = ref(false)
-  const currentId = computed(() => Number(route.query.planId));
+  const currentId = computed(() => Number(route.query.recordId));
   const getDetail = async () => {
   const getDetail = async () => {
     if (!currentId.value) return;
     if (!currentId.value) return;
     try {
     try {