Jelajahi Sumber

fix: update code

sunqijun 3 bulan lalu
induk
melakukan
0bd087258c

+ 15 - 0
src/api/production-safety/responsibility-implementation/index.ts

@@ -803,6 +803,21 @@ export function constructionSafetySaveConstruction(params) {
     params
   });
 }
+
+/**
+ * 管理端更新施工安全数据
+ * @param params - 更新后的施工安全数据(需包含 ID)
+ * @returns Promise<void>
+ */
+export function constructionSafetyUpdateConstruction(params) {
+  return http.request({
+    url: `/constructionSafety/updateConstruction`,
+    method: 'put',
+    params
+  });
+}
+
+
 /**
  * 管理端查询施工安全详情
  * @param id - 施工安全申请 ID

+ 1 - 0
src/router/routers/production-safety-router/risk-identification-and-control.ts

@@ -199,6 +199,7 @@ import { RouteComponent } from "vue-router";
             noCache: false,
           }
         },
+        
         {
           id: 93009,
           parentId: 90014,

+ 15 - 11
src/views/production-safety/implement-safety-duty/view-recipients.vue

@@ -9,11 +9,11 @@
       </div>
       <el-tabs v-model="activeTab">
         <el-tab-pane label="全部" name="" />
-        <el-tab-pane label="待签署" name="2" />
-        <el-tab-pane label="待反馈材料" name="3" />
-        <el-tab-pane label="待审核" name="4" />
-        <el-tab-pane label="已完成" name="5" />
-        <el-tab-pane label="已作废" name="6" />
+        <el-tab-pane label="待签署" :name="2" />
+        <el-tab-pane label="待反馈材料" :name="3" />
+        <el-tab-pane label="待审核" :name="4" />
+        <el-tab-pane label="已完成" :name="5" />
+        <el-tab-pane label="已作废" :name="6" />
       </el-tabs>
     </header>
     <main class="safety-platform-container__main">
@@ -134,7 +134,7 @@
     pageSize: 10,
     queryParam: {
       adminId: route.query.id,
-      status: '',
+      status: route.query.status,
       date: '',
       userGroupId: '',
     },
@@ -239,13 +239,17 @@
     queryTableList();
   };
 
-  watch(route.query, (a, b) => {
-    console.log('a:', a, b);
-    //
-  });
+  watch(
+    () => route.query.status,
+    (a, b) => {
+      activeTab.value = Number(a);
+    },
+    {
+      immediate: true,
+    },
+  );
 
   onMounted(async () => {
-    // activeTab.value = route.query.status;
     Object.assign(queryParams, {
       queryParam: {
         ...queryParams.queryParam,

+ 4 - 13
src/views/production-safety/risk-identification-and-control/construction-safety-manage/add.vue

@@ -152,8 +152,7 @@
     </main>
     <footer class="safety-platform-container__footer">
       <el-button @click="router.back()">返回</el-button>
-      <el-button type="primary" :loading="submiting" @click="handleSave(0)">保存</el-button>
-      <el-button type="primary" :loading="submiting" @click="handleSave(1)">提交</el-button>
+      <el-button type="primary" :loading="submiting" @click="handleSave">保存</el-button>
     </footer>
   </div>
 </template>
@@ -165,17 +164,14 @@
   import dayjs from 'dayjs';
 
   import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
-  import { getAllApproval } from '@/api/approval/approval';
   import { constructionSafetySaveConstruction } from '@/api/production-safety/responsibility-implementation';
   import { formatAttachmentList } from '@/components/UploadFiles/utils';
-  import { template } from 'lodash-es';
 
   const router = useRouter();
   const formRef = ref<any>(null);
   const submiting = ref(false);
   const tradeArray = ref<string[]>([]);
   const approvalOptions = ref<any[]>([]);
-
   const attachmentConfigs = [
     { label: '施工安全交底', prop: 'safetyCommitmentAttachment' },
     { label: '安全管理协议', prop: 'safetyAgreementAttachment' },
@@ -214,12 +210,7 @@
     ...Object.fromEntries(attachmentConfigs.map((a) => [a.prop, ''])),
   });
 
-  // 获取审批流程
-  onMounted(async () => {
-    const res = await getAllApproval();
-    console.log('res:', res);
-    approvalOptions.value = res || [];
-  });
+  // 提交审批弹窗相关
 
   const handleUploadSuccess = async (prop: string, fileList: any[]) => {
     attachmentLists[prop] = fileList;
@@ -267,14 +258,14 @@
    * 统一保存逻辑
    * @param status 0-保存草稿(通常不强校验附件),1-提交申请(强制校验)
    */
-  const handleSave = (status: number) => {
+  const handleSave = () => {
     formRef.value?.validate(async (valid: boolean) => {
       if (valid) {
         submiting.value = true;
         // 这里的 status 根据后端接口文档调整,通常提交需要带上业务状态
         constructionSafetySaveConstruction({ ...formValue, submitStatus: status })
           .then(() => {
-            ElMessage.success(status === 1 ? '提交成功!' : '保存成功!');
+            ElMessage.success('保存成功!');
             router.push({ name: 'constructionSafetyManage' });
           })
           .finally(() => {

+ 254 - 2
src/views/production-safety/risk-identification-and-control/construction-safety-manage/audit.vue

@@ -1,5 +1,257 @@
 <template>
-  <div>
-    <h1>Audit</h1>
+  <div class="safety-platform-container">
+    <header class="safety-platform-container__header">
+      <div class="breadcrumb-title"> 施工作业安全管理 </div>
+    </header>
+    <main class="safety-platform-container__main">
+      <div class="search-form">
+        <el-form :inline="true">
+          <el-form-item label="项目名称">
+            <el-input v-model="queryParams.queryParam.projectName" placeholder="搜索项目名称" style="width: 170px" />
+          </el-form-item>
+          <el-form-item label="状态">
+            <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
+              <el-option value="" label="全部" />
+              <el-option :value="1" label="待提交" />
+              <el-option :value="2" label="待审批" />
+              <el-option :value="3" label="已完成" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="部门名称">
+            <el-cascader
+              v-model="queryParams.queryParam.departmentId"
+              style="width: 170px"
+              ref="cascaderRef"
+              :options="firstLevelDepts"
+              :props="cascaderProp"
+              :show-all-levels="false"
+              placeholder="部门名称"
+              filterable
+              @change="handleChangeDept"
+            />
+          </el-form-item>
+          <el-form-item label="施工地点">
+            <el-input
+              v-model="queryParams.queryParam.constructionLocation"
+              placeholder="输入施工地点"
+              style="width: 170px"
+            />
+          </el-form-item>
+        </el-form>
+
+        <div>
+          <el-button type="primary" @click="$router.push({ name: 'constructionSafetyManageAdd' })">添加 </el-button>
+          <el-button type="primary" @click="queryTableList">查询</el-button>
+          <el-button @click="handleRestParams">重置</el-button>
+        </div>
+      </div>
+
+      <div class="table-content">
+        <el-table :data="tableData.data">
+          <el-table-column type="index" label="序号" width="80" />
+          <el-table-column label="项目名称" prop="projectName" width="180" />
+          <el-table-column label="申请单号" prop="code" width="180" />
+          <el-table-column label="施工地点(区域)" prop="constructionLocation" width="180" />
+          <el-table-column label="工程施工内容简要描述 " prop="constructionContent" width="230" />
+          <el-table-column label="施工单位名称" prop="constructionUnit" width="180" />
+          <el-table-column label="施工项目负责人" prop="projectManagerName" width="180" />
+          <el-table-column label="施工现场安全负责人" prop="siteSafetyManagerName" width="240" />
+          <el-table-column label="当前流程节点" prop="nodeDescription" width="180" />
+          <el-table-column label="状态" props="statusName" width="100" />
+          <el-table-column fixed="right" min-width="140" label="操作">
+            <template #default="scope">
+              <!-- <el-button
+                type="primary"
+                link
+                @click="$router.push({ name: 'constructionSafetyManageEdit', query: { id: scope.row.id } })"
+                >编辑</el-button
+              > -->
+              <el-button
+                type="primary"
+                link
+                @click="$router.push({ name: 'constructionSafetyManageView', query: { id: scope.row.id } })"
+                >查看</el-button
+              >
+
+              <!-- <el-button type="primary" link @click="handleConfirmDeleteRow(scope)">删除</el-button> -->
+
+              <el-button type="primary" link>审批</el-button>
+              <!-- <el-button
+                type="primary"
+                link
+                @click="$router.push({ name: 'constructionSafetyManageMonitor', query: { id: scope.row.id } })"
+                >视频监控</el-button
+              > -->
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <div class="pagination-container" v-if="tableData.total > 0">
+        <el-pagination
+          background
+          :current-page="queryParams.pageNumber"
+          :page-size="queryParams.pageSize"
+          :total="tableData.total"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+        />
+      </div>
+    </main>
   </div>
 </template>
+<script lang="ts" setup>
+  import { onMounted, reactive, ref } from 'vue';
+  import { ElMessage } from 'element-plus';
+  import { useRouter } from 'vue-router';
+  import {
+    constructionSafetyQueryPageConstruction,
+    constructionSafetyDeleteConstructionById,
+  } from '@/api/production-safety/responsibility-implementation';
+  import { omit } from 'lodash-es';
+  import { useUserInfoHook } from '@/hooks/useUserInfoHook';
+  import { unformatAttachment } from '@/components/UploadFiles/utils';
+  import { downloadFile } from '@/views/disaster/utils';
+  import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
+  import { getAllDepartments } from '@/api/auth/dept';
+
+  const router = useRouter();
+  const { id } = useUserInfoHook();
+  const firstLevelDepts = ref<any[]>([]);
+  const cascaderProp = {
+    expandTrigger: 'click',
+    checkStrictly: true,
+    // emitPath: false,
+    value: 'id',
+    label: 'deptName',
+  };
+  const queryParams = reactive<any>({
+    pageNumber: 1,
+    pageSize: 10,
+    queryParam: {
+      status: '',
+      projectName: '',
+      constructionLocation: '',
+      department: '',
+      departmentId: [],
+    },
+  });
+  const cascaderRef = ref();
+
+  const tableData = reactive({
+    data: [],
+    total: 0,
+  });
+
+  const handleSizeChange = (value) => {};
+
+  const handleCurrentChange = (value) => {
+    queryParams.pageNumber = value;
+    queryTableList();
+  };
+
+  const getDeptData = () => {
+    getAllDepartments().then((res) => {
+      firstLevelDepts.value = formatDeptTree(res);
+    });
+  };
+  const handleChangeDept = () => {
+    const deptInfo = cascaderRef.value?.getCheckedNodes();
+    if (deptInfo?.[0]) {
+      queryParams.queryParam.department = deptInfo[0].label;
+      queryParams.queryParam.departmentId = deptInfo[0].pathValues;
+    }
+  };
+
+  const handleConfirmDeleteRow = (scope) => {
+    constructionSafetyDeleteConstructionById(scope.row.id).then(() => {
+      ElMessage.success('删除成功!');
+      queryTableList();
+    });
+  };
+
+  const queryTableList = () => {
+    constructionSafetyQueryPageConstruction({
+      ...queryParams,
+      queryParam: {
+        ...omit(queryParams.queryParam, 'responsibleDepartmentId'),
+      },
+    }).then((res) => {
+      tableData.data = res.records;
+      tableData.total = res.totalRow;
+    });
+  };
+  const handleRestParams = () => {
+    Object.assign(queryParams, {
+      pageNumber: 1,
+      pageSize: 10,
+      queryParam: {
+        ...queryParams.queryParam,
+        status: '',
+        projectName: '',
+        constructionLocation: '',
+        department: '',
+        departmentId: [],
+      },
+    });
+    queryTableList();
+  };
+
+  onMounted(async () => {
+    await getDeptData();
+    queryTableList();
+  });
+</script>
+
+<style lang="scss" scoped>
+  @use '@/styles/page-details-layout.scss' as *;
+  @use '@/styles/page-main-layout.scss' as *;
+  @use '@/styles/basic-table-action.scss' as *;
+
+  :deep(.el-tabs__header) {
+    margin: 0;
+  }
+  :deep(.el-tabs__item) {
+    font-size: 14px !important;
+  }
+  :deep(.flexContent) {
+    display: flex;
+  }
+  :deep(.breadcrumb .title) {
+    margin-left: 0;
+  }
+
+  :deep(.el-form) {
+    flex: 1;
+    display: flex;
+    row-gap: 15px;
+    flex-wrap: wrap;
+  }
+  :deep(.el-form-item) {
+    margin-bottom: 0;
+  }
+  :deep(main) {
+    display: flex;
+    flex-direction: column;
+  }
+  .search-form {
+    min-width: 800px;
+    display: flex;
+
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 20px;
+  }
+
+  .button-content {
+    margin-bottom: 20px;
+  }
+  .table-content {
+    flex: 1;
+    overflow: hidden;
+    overflow-y: auto;
+  }
+  .page-content {
+    display: flex;
+    justify-content: flex-end;
+  }
+</style>

+ 339 - 1
src/views/production-safety/risk-identification-and-control/construction-safety-manage/edit.vue

@@ -1 +1,339 @@
-<template> xxx </template>
+<template>
+  <div class="safety-platform-container">
+    <header class="safety-platform-container__header">
+      <div class="breadcrumb-title">
+        <BreadcrumbBack />
+        编辑施工安全申请
+      </div>
+    </header>
+    <main class="safety-platform-container__main">
+      <el-form ref="formRef" :inline="true" label-width="auto" :model="formValue" :rules="rules">
+        <el-form-item label="项目名称" prop="projectName">
+          <el-input v-model="formValue.projectName" size="large" placeholder="请输入项目名称" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="施工单位" prop="constructionUnit">
+          <el-input
+            v-model="formValue.constructionUnit"
+            size="large"
+            placeholder="请输入单位全称"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="施工地点" prop="constructionLocation">
+          <el-input
+            v-model="formValue.constructionLocation"
+            size="large"
+            placeholder="楼宇名称/区域"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="施工人数" prop="workerCount">
+          <el-input-number v-model="formValue.workerCount" size="large" :min="1" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="项目负责人" prop="projectManagerName">
+          <el-input v-model="formValue.projectManagerName" size="large" placeholder="负责人姓名" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="负责人电话1" prop="projectManagerPhone1">
+          <el-input
+            v-model="formValue.projectManagerPhone1"
+            size="large"
+            placeholder="手机或座机"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="负责人电话2" prop="projectManagerPhone2">
+          <el-input v-model="formValue.projectManagerPhone2" size="large" placeholder="选填" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="现场安全员" prop="siteSafetyManagerName">
+          <el-input
+            v-model="formValue.siteSafetyManagerName"
+            size="large"
+            placeholder="安全员姓名"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="安全员电话1" prop="siteSafetyPhone1">
+          <el-input v-model="formValue.siteSafetyPhone1" size="large" placeholder="手机或座机" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="安全员电话2" prop="siteSafetyPhone2">
+          <el-input v-model="formValue.siteSafetyPhone2" size="large" placeholder="选填" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="开始时间" prop="projectStartTime">
+          <el-date-picker
+            v-model="formValue.projectStartTime"
+            type="date"
+            value-format="YYYY-MM-DD"
+            size="large"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="结束时间" prop="projectEndTime">
+          <el-date-picker
+            v-model="formValue.projectEndTime"
+            type="date"
+            value-format="YYYY-MM-DD"
+            size="large"
+            style="width: 330px"
+          />
+        </el-form-item>
+
+        <el-form-item label="涉及工种" prop="involvedTrades" style="width: 87.2%">
+          <el-checkbox-group v-model="tradeArray" @change="handleTradeChange">
+            <el-checkbox
+              v-for="t in ['水电', '泥瓦', '木工', '焊接', '气割', '登高', '密闭', '特种驾驶', '其他']"
+              :key="t"
+              :label="t"
+              :value="t"
+            />
+          </el-checkbox-group>
+        </el-form-item>
+
+        <el-form-item v-if="tradeArray.includes('其他')" label="其他工种说明" prop="otherTrade">
+          <el-input v-model="formValue.otherTrade" size="large" placeholder="请详细补充" style="width: 330px" />
+        </el-form-item>
+
+        <el-form-item label="施工内容简述" prop="constructionContent" style="width: 87.2%">
+          <el-input
+            type="textarea"
+            v-model="formValue.constructionContent"
+            size="large"
+            :rows="3"
+            placeholder="请填写详细施工内容"
+          />
+        </el-form-item>
+
+        <el-form-item label="备注说明" prop="otherDescription" style="width: 87.2%">
+          <el-input type="textarea" v-model="formValue.otherDescription" size="large" :rows="3" placeholder="选填" />
+        </el-form-item>
+
+        <div style="width: 100%; height: 1px; background: #eee; margin: 20px 0"></div>
+        <div style="width: 100%; margin-bottom: 20px; font-weight: bold; padding-left: 10px">附件清单(全项必填)</div>
+
+        <el-form-item
+          v-for="item in attachmentConfigs"
+          :key="item.prop"
+          :label="item.label"
+          :prop="item.prop"
+          style="width: 43.6%"
+        >
+          <UploadFiles
+            label="上传文件"
+            @upload-success="(fileList) => handleUploadSuccess(item.prop, fileList)"
+            :fileList="attachmentLists[item.prop]"
+          />
+        </el-form-item>
+
+        <div style="width: 100%; height: 1px; background: #eee; margin: 20px 0"></div>
+        <el-form-item label="审批流程" prop="templateId" style="width: 87.2%">
+          <el-select
+            v-model="formValue.templateId"
+            placeholder="请选择审批流程"
+            size="large"
+            style="width: 330px"
+            clearable
+          >
+            <el-option v-for="opt in approvalOptions" :key="opt.id" :label="opt.templateName" :value="opt.id" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+    </main>
+    <footer class="safety-platform-container__footer">
+      <el-button @click="router.back()">返回</el-button>
+      <el-button type="primary" :loading="submiting" @click="handleSave(0)">保存</el-button>
+    </footer>
+  </div>
+</template>
+
+<script lang="ts" setup>
+  import { ref, reactive, onMounted } from 'vue';
+  import { useRouter, useRoute } from 'vue-router';
+  import { ElMessage } from 'element-plus';
+  import dayjs from 'dayjs';
+  import UploadFiles from '@/components/UploadFiles/UploadFiles.vue';
+  import { getAllApproval } from '@/api/approval/approval';
+  import {
+    constructionSafetyQueryDetailConstruction,
+    constructionSafetyUpdateConstruction,
+  } from '@/api/production-safety/responsibility-implementation';
+  import { unformatAttachment, formatAttachmentList } from '@/components/UploadFiles/utils';
+
+  const router = useRouter();
+  const route = useRoute();
+  const formRef = ref<any>();
+  const submiting = ref(false);
+  const tradeArray = ref<string[]>([]);
+  const approvalOptions = ref<any[]>([]);
+
+  const attachmentConfigs = [
+    { label: '施工安全交底', prop: 'safetyCommitmentAttachment' },
+    { label: '安全管理协议', prop: 'safetyAgreementAttachment' },
+    { label: '安全告知单', prop: 'safetyNoticeAttachment' },
+    { label: '施工方案', prop: 'constructionPlanAttachment' },
+    { label: '劳保用品清单', prop: 'ppeListAttachment' },
+    { label: '施工机械清单', prop: 'equipmentListAttachment' },
+    { label: '人员身份信息', prop: 'personnelIdAttachment' },
+    { label: '安全教育记录', prop: 'safetyEducationAttachment' },
+    { label: '环境承诺书', prop: 'environmentCommitmentAttachment' },
+    { label: '消防管理承诺', prop: 'fireManagementAttachment' },
+    { label: '特种作业证', prop: 'specialWorkerCertAttachment' },
+    { label: '特种设备合格证', prop: 'specialEquipmentCertAttachment' },
+  ];
+
+  const attachmentLists = reactive<any>(Object.fromEntries(attachmentConfigs.map((a) => [a.prop, []])));
+
+  const formValue = reactive<any>({
+    id: undefined,
+    projectName: '',
+    constructionContent: '',
+    constructionLocation: '',
+    constructionUnit: '',
+    projectManagerName: '',
+    projectManagerPhone1: '',
+    projectManagerPhone2: '',
+    siteSafetyManagerName: '',
+    siteSafetyPhone1: '',
+    siteSafetyPhone2: '',
+    workerCount: undefined,
+    projectStartTime: '',
+    projectEndTime: '',
+    involvedTrades: '',
+    otherTrade: '',
+    otherDescription: '',
+    templateId: '',
+    ...Object.fromEntries(attachmentConfigs.map((a) => [a.prop, ''])),
+  });
+
+  // 2. 验证规则定义
+  const rules = reactive({
+    projectName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
+    constructionUnit: [{ required: true, message: '请输入施工单位', trigger: 'blur' }],
+    constructionLocation: [{ required: true, message: '请输入施工地点', trigger: 'blur' }],
+    workerCount: [{ required: true, message: '请输入施工人数', trigger: 'blur' }],
+    projectManagerName: [{ required: true, message: '请输入项目负责人', trigger: 'blur' }],
+    projectManagerPhone1: [{ required: true, message: '请输入联系电话', trigger: 'blur' }],
+    siteSafetyManagerName: [{ required: true, message: '请输入现场安全员', trigger: 'blur' }],
+    siteSafetyPhone1: [{ required: true, message: '请输入安全员电话', trigger: 'blur' }],
+    projectStartTime: [{ required: true, message: '请选择开始日期', trigger: 'change' }],
+    projectEndTime: [
+      { required: true, message: '请选择结束日期', trigger: 'change' },
+      {
+        validator: (_rule: any, value: any, callback: any) => {
+          if (value && formValue.projectStartTime && dayjs(value).isBefore(dayjs(formValue.projectStartTime))) {
+            callback(new Error('结束时间不能早于开始时间'));
+          } else {
+            callback();
+          }
+        },
+        trigger: 'change',
+      },
+    ],
+    involvedTrades: [{ required: true, message: '请至少选择一个涉及工种', trigger: 'change' }],
+    otherTrade: [{ required: true, message: '请补充其他工种说明', trigger: 'blur' }],
+    constructionContent: [{ required: true, message: '请输入施工内容简述', trigger: 'blur' }],
+    templateId: [{ required: true, message: '请选择审批流程', trigger: 'change' }],
+    // 自动为所有附件添加必填验证
+    ...Object.fromEntries(
+      attachmentConfigs.map((a) => [a.prop, [{ required: true, message: `请上传${a.label}`, trigger: 'change' }]]),
+    ),
+  });
+
+  const handleTradeChange = (val: string[]) => {
+    formValue.involvedTrades = val.join(',');
+    formRef.value?.validateField('involvedTrades');
+  };
+
+  const handleUploadSuccess = async (prop: string, fileList: any[]) => {
+    attachmentLists[prop] = fileList;
+    const formatted = await formatAttachmentList(fileList);
+    formValue[prop] = formatted.length > 0 ? JSON.stringify(formatted) : '';
+    // 上传后主动触发单个字段校验,消除错误提示
+    formRef.value?.validateField(prop);
+  };
+
+  const initData = async () => {
+    const id = route.query.id as string;
+    if (!id) return;
+    formValue.id = id;
+
+    try {
+      const approvals = await getAllApproval();
+      approvalOptions.value = approvals || [];
+
+      const res = await constructionSafetyQueryDetailConstruction(id);
+      if (res) {
+        Object.assign(formValue, res);
+        if (res.involvedTrades) {
+          tradeArray.value = res.involvedTrades.split(',');
+        }
+        attachmentConfigs.forEach((item) => {
+          if (res[item.prop]) {
+            attachmentLists[item.prop] = unformatAttachment(res[item.prop]);
+          }
+        });
+      }
+    } catch (error) {
+      console.error('获取详情数据失败:', error);
+    }
+  };
+
+  const handleSave = (status: number) => {
+    // status: 0 保存, 1 提交
+    formRef.value?.validate(async (valid: boolean) => {
+      if (valid) {
+        submiting.value = true;
+        constructionSafetyUpdateConstruction({ ...formValue, submitStatus: status })
+          .then(() => {
+            ElMessage.success(status === 1 ? '提交成功!' : '保存成功!');
+            router.push({ name: 'constructionSafetyManage' });
+          })
+          .catch((err) => {
+            console.error(err);
+          })
+          .finally(() => {
+            submiting.value = false;
+          });
+      } else {
+        return false;
+      }
+    });
+  };
+
+  onMounted(() => {
+    initData();
+  });
+</script>
+
+<style lang="scss" scoped>
+  @use '@/styles/page-main-layout.scss' as *;
+  @use '@/styles/page-details-layout.scss' as *;
+
+  .safety-platform-container {
+    &__main {
+      padding: 24px;
+      background-color: #fff;
+    }
+    :deep(.el-form-item) {
+      margin-right: 20px;
+      margin-bottom: 24px;
+      vertical-align: top;
+      .el-form-item__label {
+        font-weight: bold;
+      }
+    }
+    // :deep(.el-input.is-disabled .el-input__wrapper) {
+    //   background-color: #f8f9fb;
+    //   color: #606266;
+    // }
+  }
+</style>

+ 132 - 3
src/views/production-safety/risk-identification-and-control/construction-safety-manage/list.vue

@@ -60,6 +60,7 @@
           <el-table-column label="状态" props="statusName" width="100" />
           <el-table-column fixed="right" min-width="240" label="操作">
             <template #default="scope">
+              <el-button v-if="scope.row.status === 1" type="primary" link>提交</el-button>
               <el-button
                 type="primary"
                 link
@@ -75,7 +76,7 @@
 
               <el-button type="primary" link @click="handleConfirmDeleteRow(scope)">删除</el-button>
 
-              <el-button type="primary" link>审批</el-button>
+              <!-- <el-button type="primary" link>审批</el-button> -->
               <el-button
                 type="primary"
                 link
@@ -98,6 +99,65 @@
       </div>
     </main>
   </div>
+  <BasicDialog
+    v-if="approvalVisible"
+    v-model="approvalVisible"
+    ref="basicDialogRef"
+    title="提交审批"
+    @refresh="closeApprovalDialog"
+  >
+    <template #form>
+      <div class="form">
+        <el-form ref="approvalFormRef" :model="approvalForm">
+          <el-form-item label="审批描述:" label-position="top">
+            <el-input v-model="approvalForm.description" placeholder="请输入审批描述" type="textarea" />
+          </el-form-item>
+          <div class="form-item">
+            <span>审批流程:</span>
+            <template v-for="item in approvalNodeList" :key="item.id">
+              <el-form-item
+                :label="`第${item.approvalOrder}步:${item.nodeDescription}(${APPROVAL_TYPE_MAP[item.approvalType]})`"
+                label-position="top"
+                :prop="item.approverType !== APPROVER_TYPE.FIX ? `approvers.${item.id}` : ''"
+                :rules="{ required: true, message: '请选择审批人员', trigger: 'change' }"
+              >
+                <el-input
+                  v-if="item.approverType === APPROVER_TYPE.FIX"
+                  :model-value="item.approverInfoList.map((info) => info.approverName).join(',')"
+                  disabled
+                />
+                <el-select
+                  v-else
+                  v-model="approvalForm.approvers[item.id]"
+                  placeholder="请选择审批人员"
+                  value-key="id"
+                  filterable
+                  remote
+                  collapse-tags
+                  collapse-tags-tooltip
+                  :max-collapse-tags="2"
+                  :remote-method="remoteMethod"
+                  :loading="loading"
+                  multiple
+                >
+                  <el-option
+                    v-for="option in userOptions"
+                    :key="option.id"
+                    :label="`${option.realname}(${option.username})${option.deptName}`"
+                    :value="option.id"
+                  />
+                </el-select>
+              </el-form-item>
+            </template>
+          </div>
+        </el-form>
+      </div>
+    </template>
+    <template #footer>
+      <el-button type="primary" @click="handleSubmitApproval">提交</el-button>
+      <el-button @click="basicDialogRef?.closeDialog()">取消</el-button>
+    </template>
+  </BasicDialog>
 </template>
 <script lang="ts" setup>
   import { onMounted, reactive, ref } from 'vue';
@@ -107,16 +167,22 @@
     constructionSafetyQueryPageConstruction,
     constructionSafetyDeleteConstructionById,
   } from '@/api/production-safety/responsibility-implementation';
+  import BasicDialog from '@/components/BasicDialog.vue';
+  import { getApprovalNodeInstanceList } from '@/api/approval/approval';
+  import { submitReceiptRecordApprovalProcess } from '@/api/receiptRecord';
   import { omit } from 'lodash-es';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
-  import { unformatAttachment } from '@/components/UploadFiles/utils';
-  import { downloadFile } from '@/views/disaster/utils';
+  import type { ApprovalNodeInstanceType } from '@/views/system/approval/types';
+
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { getAllDepartments } from '@/api/auth/dept';
+  import { APPROVAL_TYPE_MAP, APPROVER_TYPE } from '@/views/emergency/emergency-plan/src/constant';
+  import { useEmergencySuppliesHook } from '@/views/emergency/emergency-supplies/src/hook';
 
   const router = useRouter();
   const { id } = useUserInfoHook();
   const firstLevelDepts = ref<any[]>([]);
+  const approvalVisible = ref(false);
   const cascaderProp = {
     expandTrigger: 'click',
     checkStrictly: true,
@@ -196,6 +262,69 @@
     queryTableList();
   };
 
+  const basicDialogRef = ref<InstanceType<typeof BasicDialog>>();
+  const approvalFormRef = ref();
+  const approvalForm = reactive({
+    description: '',
+    approvers: {} as Record<number, any[]>,
+  });
+
+  const approvalNodeList = ref<ApprovalNodeInstanceType[]>([]);
+
+  const { userOptions, loading, remoteMethod } = useEmergencySuppliesHook();
+
+  const getApprovalNode = async (id: number) => {
+    const res = await getApprovalNodeInstanceList(id);
+    approvalNodeList.value = res.approvalNodeInfoList || [];
+  };
+
+  const resetApprovalForm = () => {
+    approvalFormRef.value?.resetFields();
+    approvalForm.description = '';
+  };
+
+  const closeApprovalDialog = () => {
+    resetApprovalForm();
+    basicDialogRef.value?.closeDialog();
+  };
+
+  const handleSubmitApproval = () => {
+    approvalFormRef.value?.validate(async (valid: boolean) => {
+      if (!valid) return;
+      if (!receiptRecordId.value) {
+        ElMessage.error('缺少物品领取记录ID,无法提交审批');
+        return;
+      }
+
+      const approvalData: any = {
+        planId: receiptRecordId.value,
+        approvalDescription: approvalForm.description,
+        approvalInfoList: approvalNodeList.value.map((node) => {
+          let approverIdList: number[] = [];
+          if (node.approverType === APPROVER_TYPE.FIX) {
+            approverIdList = node.approverInfoList.map((info) => info.approverId);
+          } else if (approvalForm.approvers[node.id]) {
+            approverIdList = approvalForm.approvers[node.id];
+          }
+          return {
+            approvalOrder: node.approvalOrder,
+            approverIdList,
+          };
+        }),
+      };
+
+      try {
+        await submitReceiptRecordApprovalProcess(approvalData);
+        ElMessage.success('提交成功');
+        closeApprovalDialog();
+        router.back();
+      } catch (e) {
+        console.error('提交审批失败:', e);
+        ElMessage.error('提交审批失败,请重试');
+      }
+    });
+  };
+
   onMounted(async () => {
     await getDeptData();
     queryTableList();

+ 13 - 37
src/views/production-safety/safetyAssessment/receiptRecord/components/ReceiptRecordDetail.vue

@@ -14,12 +14,7 @@
           clearable
           :disabled="isViewMode || isAuditMode"
         >
-          <el-option
-            v-for="item in inventoryList"
-            :key="item.id"
-            :label="item.stuffName"
-            :value="item.id"
-          />
+          <el-option v-for="item in inventoryList" :key="item.id" :label="item.stuffName" :value="item.id" />
         </el-select>
       </template>
       <template #department>
@@ -44,12 +39,7 @@
           :disabled="isViewMode || isAuditMode"
           @change="handleRecipientChange"
         >
-          <el-option
-            v-for="user in recipientUserList"
-            :key="user.id"
-            :label="user.realname"
-            :value="user.id"
-          />
+          <el-option v-for="user in recipientUserList" :key="user.id" :label="user.realname" :value="user.id" />
         </el-select>
       </template>
       <template #approvalTemplateId>
@@ -60,12 +50,7 @@
           clearable
           :disabled="isViewMode || isAuditMode"
         >
-          <el-option
-            v-for="item in approvalList"
-            :key="item.id"
-            :label="item.templateName"
-            :value="item.id"
-          />
+          <el-option v-for="item in approvalList" :key="item.id" :label="item.templateName" :value="item.id" />
         </el-select>
       </template>
     </BasicForm>
@@ -80,12 +65,7 @@
       {{ isCreateMode ? '提交' : '保存' }}
     </el-button>
   </footer>
-  <BasicDialog
-    v-if="!isViewMode && !isAuditMode"
-    ref="basicDialogRef"
-    title="提交审批"
-    @refresh="closeApprovalDialog"
-  >
+  <BasicDialog v-if="!isViewMode && !isAuditMode" ref="basicDialogRef" title="提交审批" @refresh="closeApprovalDialog">
     <template #form>
       <div class="form">
         <el-form ref="approvalFormRef" :model="approvalForm">
@@ -105,7 +85,7 @@
                   v-if="item.approverType === APPROVER_TYPE.FIX"
                   :model-value="item.approverInfoList.map((info) => info.approverName).join(',')"
                   disabled
-                ></el-input>
+                />
                 <el-select
                   v-else
                   v-model="approvalForm.approvers[item.id]"
@@ -147,11 +127,7 @@
   import BasicForm from '@/components/BasicForm.vue';
   import BasicDialog from '@/components/BasicDialog.vue';
   import { useFormConfigHook } from '@/hooks/useFormConfigHook';
-  import {
-    RECEIPT_RECORD_FORM_CONFIG,
-    RECEIPT_RECORD_FORM_DATA,
-    RECEIPT_RECORD_FORM_RULES,
-  } from '../configs/form';
+  import { RECEIPT_RECORD_FORM_CONFIG, RECEIPT_RECORD_FORM_DATA, RECEIPT_RECORD_FORM_RULES } from '../configs/form';
   import {
     saveClaimItemsLog,
     updateClaimItemsLog,
@@ -265,8 +241,11 @@
     }
   };
 
-  const { ruleFormData, formRules, ruleFormConfig, cloneRuleFormData, beforeRouteLeave } =
-    useFormConfigHook(RECEIPT_RECORD_FORM_CONFIG, RECEIPT_RECORD_FORM_DATA, RECEIPT_RECORD_FORM_RULES);
+  const { ruleFormData, formRules, ruleFormConfig, cloneRuleFormData, beforeRouteLeave } = useFormConfigHook(
+    RECEIPT_RECORD_FORM_CONFIG,
+    RECEIPT_RECORD_FORM_DATA,
+    RECEIPT_RECORD_FORM_RULES,
+  );
 
   // 提交审批弹窗相关
   const basicDialogRef = ref<InstanceType<typeof BasicDialog>>();
@@ -382,7 +361,7 @@
         ruleFormData.deptId = findDeptIdByName(deptTree.value, res.deptName ?? '') ?? null;
         ruleFormData.recipient = res.userName ?? '';
         ruleFormData.pimId = res.pimId;
-        
+
         // 如果部门ID存在,先获取该部门的用户列表,然后根据用户名查找用户ID
         if (ruleFormData.deptId) {
           await getRecipientUserList(ruleFormData.deptId);
@@ -426,9 +405,7 @@
       const basePayload = {
         stuffName: selectedInventory.stuffName,
         pimId: selectedInventory.id,
-        outStoreTime: ruleFormData.outboundDate
-          ? new Date(ruleFormData.outboundDate).toISOString()
-          : '',
+        outStoreTime: ruleFormData.outboundDate ? new Date(ruleFormData.outboundDate).toISOString() : '',
         claimQty: ruleFormData.outboundQuantity,
         orderNumber: ruleFormData.receiptNumber,
         deptName: ruleFormData.department,
@@ -541,4 +518,3 @@
 <style scoped lang="scss">
   @use '@/styles/page-details-layout.scss' as *;
 </style>
-