Pārlūkot izejas kodu

feat:隐患台账下发时责任部门改为多选

sunqijun 3 nedēļas atpakaļ
vecāks
revīzija
53d7f01f1c

+ 21 - 6
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/hiddenTroubleAccountManagement.vue

@@ -188,7 +188,7 @@
           <el-cascader
             v-model="issueForm.rectificationDepartmentId"
             :options="issueDeptTree"
-            :props="cascaderDeptProp"
+            :props="cascaderDeptMultipleProp"
             :show-all-levels="false"
             placeholder="请选择整改责任部门"
             filterable
@@ -458,7 +458,8 @@
   const issueDangerId = ref<number>(0);
   const issueFormRef = ref();
   const issueForm = ref({
-    rectificationDepartmentId: undefined as number | undefined,
+    /** 多选部门 id 数组,提交时拼为 rectification_department_ids */
+    rectificationDepartmentId: [] as number[],
     rectificationResponsibleUserId: undefined as number | undefined,
     rectificationResponsiblePersonName: '' as string,
   });
@@ -474,6 +475,14 @@
     label: 'deptName',
     emitPath: false,
   };
+  const cascaderDeptMultipleProp = {
+    checkStrictly: true,
+    expandTrigger: 'hover' as const,
+    value: 'id',
+    label: 'deptName',
+    emitPath: false,
+    multiple:true
+  };
   const issueDeptTree = ref<DeptTree[]>([]);
   const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
 
@@ -512,10 +521,15 @@
     return '';
   }
 
+  /** 多选部门名称,与 rectification_department_ids 顺序一致,逗号拼接 */
+  function findDeptNamesByIds(nodes: DeptTree[] | undefined, ids: number[]): string {
+    return ids.map((id) => findDeptNameById(nodes, id)).filter(Boolean).join(',');
+  }
+
   const handleOpenIssue = (id: number) => {
     issueDangerId.value = id;
     issueForm.value = {
-      rectificationDepartmentId: undefined,
+      rectificationDepartmentId: [],
       rectificationResponsibleUserId: undefined,
       rectificationResponsiblePersonName: '',
     };
@@ -525,17 +539,18 @@
   const handleIssueSave = async () => {
     await issueFormRef.value?.validate?.().catch(() => {});
     const { rectificationDepartmentId, rectificationResponsibleUserId } = issueForm.value;
-    if (rectificationDepartmentId == null || rectificationResponsibleUserId == null) {
+    const deptIds = Array.isArray(rectificationDepartmentId) ? rectificationDepartmentId : [];
+    if (!deptIds.length || rectificationResponsibleUserId == null) {
       ElMessage.warning('请选择整改责任部门和整改负责人');
       return;
     }
     const selectedUser = issueUserList.value.find((u) => u.id === rectificationResponsibleUserId);
     const personName = selectedUser?.realname ?? selectedUser?.username ?? '';
-    const deptName = findDeptNameById(issueDeptTree.value, rectificationDepartmentId);
+    const deptName = findDeptNamesByIds(issueDeptTree.value, deptIds);
     try {
       await issueHiddenDanger({
         danger_id: issueDangerId.value,
-        rectification_department_ids: String(rectificationDepartmentId),
+        rectification_department_ids: deptIds.join(','),
         rectification_responsible_person: personName,
         dept_name: deptName,
         rectification_responsible_ids: String(rectificationResponsibleUserId),

+ 1 - 0
src/views/production-safety/risk-identification-and-control/risk-manage/list.vue

@@ -303,6 +303,7 @@
         responsibleDepartment: '',
         riskCategory: '',
         riskLevel: '',
+        roomSafetyResponsible: '',
         responsibleDepartmentId: [],
       },
     });

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

@@ -54,6 +54,7 @@ export const INVENTORY_TABLE_COLUMNS: TableColumnProps[] = [
     label: '工伤类别',
     prop: 'injuryCategoryName',
     slot: 'injuryCategoryCode',
+    minWidth: '150px',
   },
   // {
   //   label: '备注',