Browse Source

feat: update file

sunqijun 3 months ago
parent
commit
daa69b1dac

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

@@ -828,4 +828,17 @@ export function constructionSafetyQueryDetailConstruction(id) {
     url: `/constructionSafety/queryDetailConstruction?id=${id}`,
     method: 'get',
   });
+}
+
+/**
+ * 管理端审批施工安全申请
+ * @param params - 审批参数,包含申请 ID、审批结果、审批意见等
+ * @returns Promise<void>
+ */
+export function constructionSafetySaveApproval(params) {
+  return http.request({
+    url: `/constructionSafety/saveApproval`,
+    method: 'post', 
+    params
+  });
 }

+ 8 - 1
src/components/BasicDialog.vue

@@ -1,6 +1,13 @@
 <template>
   <div class="basic-dialog">
-    <el-dialog v-model="dialogVisible" width="640px" align-center :close-on-click-modal="false" v-bind="$attrs" class="basic-dialog--custom">
+    <el-dialog
+      v-model="dialogVisible"
+      width="640px"
+      align-center
+      :close-on-click-modal="false"
+      v-bind="$attrs"
+      class="basic-dialog--custom"
+    >
       <div class="basic-dialog-container">
         <main class="basic-dialog-main">
           <slot name="form"></slot>

+ 4 - 1
src/views/production-safety/implement-safety-duty/agree-document-review.vue

@@ -246,7 +246,7 @@
   const route = useRoute();
   const formRef = ref<any>(null);
   const submiting = ref(false);
-  const reviewFeedBackRef = ref<InstanceType<typeof RefuseReason>>();
+  const reviewFeedBackRef = ref<any>();
   const formData = reactive<any>({
     departmentName: '',
     createdByName: '',
@@ -371,6 +371,9 @@
       .then(() => {
         reviewFeedBackRef.value.dialogHide();
         ElMessage.success('提交成功');
+        router.push({
+          name: 'responsibilityAgreeManage',
+        });
       })
       .finally(() => {
         reviewFeedBackRef.value.submitLoading = false;

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

@@ -75,7 +75,7 @@
 
               <!-- <el-button type="primary" link @click="handleConfirmDeleteRow(scope)">删除</el-button> -->
 
-              <el-button type="primary" link>审批</el-button>
+              <el-button type="primary" link @click="openApproveDialog">审批</el-button>
               <!-- <el-button
                 type="primary"
                 link
@@ -98,6 +98,28 @@
       </div>
     </main>
   </div>
+  <!-- 审核弹窗 -->
+  <el-dialog
+    v-if="showApproveDialog"
+    v-model="showApproveDialog"
+    title="审核举一反三"
+    width="400px"
+    destroy-on-close
+    @close="resetApproveForm"
+  >
+    <el-form ref="approveFormRef" :model="approveForm" label-width="100px">
+      <el-form-item label="审核结果">
+        <el-radio-group v-model="approveForm.statusId">
+          <el-radio :value="2">通过(已完成)</el-radio>
+          <el-radio :value="3">不通过(已作废)</el-radio>
+        </el-radio-group>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <el-button @click="showApproveDialog = false">取消</el-button>
+      <el-button type="primary" @click="handleApproveSubmit">确认审核</el-button>
+    </template>
+  </el-dialog>
 </template>
 <script lang="ts" setup>
   import { onMounted, reactive, ref } from 'vue';
@@ -106,6 +128,7 @@
   import {
     constructionSafetyQueryPageConstruction,
     constructionSafetyDeleteConstructionById,
+    constructionSafetySaveApproval,
   } from '@/api/production-safety/responsibility-implementation';
   import { omit } from 'lodash-es';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
@@ -117,6 +140,11 @@
   const router = useRouter();
   const { id } = useUserInfoHook();
   const firstLevelDepts = ref<any[]>([]);
+
+  const showApproveDialog = ref(false);
+  const approveFormRef = ref<any>();
+  const approveForm = ref({ id: 0, statusId: 5, statusName: '已完成' });
+
   const cascaderProp = {
     expandTrigger: 'click',
     checkStrictly: true,
@@ -136,7 +164,7 @@
     },
   });
   const cascaderRef = ref();
-
+  const currentId = ref('');
   const tableData = reactive({
     data: [],
     total: 0,
@@ -149,6 +177,36 @@
     queryTableList();
   };
 
+  function resetApproveForm() {
+    approveForm.value = {
+      id: currentId.value || 0,
+      statusId: 5,
+      statusName: '已完成',
+    };
+  }
+
+  function openApproveDialog() {
+    resetApproveForm();
+    showApproveDialog.value = true;
+  }
+
+  async function handleApproveSubmit() {
+    if (!currentId.value) return;
+    try {
+      await constructionSafetySaveApproval({
+        id: currentId.value,
+        statusId: approveForm.value.statusId,
+        statusName: approveForm.value.statusName || (approveForm.value.statusId === 5 ? '已完成' : '已作废'),
+      });
+      ElMessage.success('审核成功');
+      showApproveDialog.value = false;
+      queryTableList();
+    } catch (e) {
+      console.error('审核失败:', e);
+      ElMessage.error('审核失败,请重试');
+    }
+  }
+
   const getDeptData = () => {
     getAllDepartments().then((res) => {
       firstLevelDepts.value = formatDeptTree(res);
@@ -220,15 +278,6 @@
     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;
@@ -240,6 +289,15 @@
     justify-content: space-between;
     align-items: center;
     margin-bottom: 20px;
+    :deep(.el-form) {
+      flex: 1;
+      display: flex;
+      row-gap: 15px;
+      flex-wrap: wrap;
+    }
+    :deep(.el-form-item) {
+      margin-bottom: 0;
+    }
   }
 
   .button-content {

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

@@ -60,7 +60,9 @@
           <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 v-if="scope.row.status === 1" type="primary" link @click="handleSendApproval(scope)"
+                >提交</el-button
+              >
               <el-button
                 type="primary"
                 link
@@ -155,7 +157,7 @@
     </template>
     <template #footer>
       <el-button type="primary" @click="handleSubmitApproval">提交</el-button>
-      <el-button @click="basicDialogRef?.closeDialog()">取消</el-button>
+      <el-button @click="approvalVisible = false">取消</el-button>
     </template>
   </BasicDialog>
 </template>
@@ -166,6 +168,7 @@
   import {
     constructionSafetyQueryPageConstruction,
     constructionSafetyDeleteConstructionById,
+    constructionSafetyUpdateApply,
   } from '@/api/production-safety/responsibility-implementation';
   import BasicDialog from '@/components/BasicDialog.vue';
   import { getApprovalNodeInstanceList } from '@/api/approval/approval';
@@ -270,6 +273,7 @@
   });
 
   const approvalNodeList = ref<ApprovalNodeInstanceType[]>([]);
+  const receiptRecordId = ref<number>();
 
   const { userOptions, loading, remoteMethod } = useEmergencySuppliesHook();
 
@@ -277,7 +281,11 @@
     const res = await getApprovalNodeInstanceList(id);
     approvalNodeList.value = res.approvalNodeInfoList || [];
   };
-
+  const handleSendApproval = async (scope) => {
+    await getApprovalNode(scope.row.templateId);
+    approvalVisible.value = true;
+    receiptRecordId.value = scope.row.id;
+  };
   const resetApprovalForm = () => {
     approvalFormRef.value?.resetFields();
     approvalForm.description = '';
@@ -291,13 +299,13 @@
   const handleSubmitApproval = () => {
     approvalFormRef.value?.validate(async (valid: boolean) => {
       if (!valid) return;
-      if (!receiptRecordId.value) {
-        ElMessage.error('缺少物品领取记录ID,无法提交审批');
+      if (!receiptRecordId?.value) {
+        ElMessage.error('缺少施工作业记录ID,无法提交审批');
         return;
       }
 
       const approvalData: any = {
-        planId: receiptRecordId.value,
+        id: receiptRecordId.value,
         approvalDescription: approvalForm.description,
         approvalInfoList: approvalNodeList.value.map((node) => {
           let approverIdList: number[] = [];
@@ -314,12 +322,11 @@
       };
 
       try {
-        await submitReceiptRecordApprovalProcess(approvalData);
+        await constructionSafetyUpdateApply(approvalData);
         ElMessage.success('提交成功');
-        closeApprovalDialog();
-        router.back();
+        approvalVisible.value = false;
+        queryTableList();
       } catch (e) {
-        console.error('提交审批失败:', e);
         ElMessage.error('提交审批失败,请重试');
       }
     });
@@ -349,19 +356,6 @@
     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;
@@ -369,6 +363,19 @@
     justify-content: space-between;
     align-items: center;
     margin-bottom: 20px;
+    :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;
+    }
   }
 
   .button-content {