From 07f9f8657d057a38792c3822acc9b08d83478967 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 07 五月 2026 14:23:10 +0800
Subject: [PATCH] 合并代码

---
 src/views/safeProduction/dangerInvestigation/index.vue |  247 ++++++++++++------------------------------------
 1 files changed, 64 insertions(+), 183 deletions(-)

diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index eaa12bb..cb09e52 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -111,13 +111,13 @@
         </el-table-column>
         <el-table-column fixed="right"
                          label="鎿嶄綔"
-                         min-width="250"
+                         min-width="150"
                          align="center">
           <template #default="scope">
-            <el-button link
+            <!-- <el-button link
                        type="primary"
                        size="small"
-                       @click="openForm('edit', scope.row)">缂栬緫</el-button>
+                       @click="openForm('edit', scope.row)">缂栬緫</el-button> -->
             <el-button link
                        type="primary"
                        size="small"
@@ -125,11 +125,12 @@
             <el-button link
                        type="primary"
                        size="small"
+                       :disabled="scope.row.isRectify || scope.row.rectifyActualTime"
                        @click="openForm('edit2', scope.row)">鏁存敼</el-button>
             <el-button link
                        type="primary"
                        size="small"
-                       :disabled="!scope.row.rectifyActualTime"
+                       :disabled="!scope.row.rectifyActualTime || scope.row.verifyTime"
                        @click="openForm('edit3', scope.row)">楠屾敹</el-button>
           </template>
         </el-table-column>
@@ -215,7 +216,7 @@
                           prop="createUser">
               <el-select v-model="form.createUser"
                          placeholder="璇烽�夋嫨"
-                         @change="handleChange"
+                         disabled
                          clearable>
                 <el-option v-for="item in userList"
                            :key="item.userId"
@@ -228,14 +229,13 @@
             <el-form-item label="涓婃姤鏃堕棿锛�"
                           prop="createTime">
               <el-date-picker style="width: 100%"
-                              readonly
+                              disabled
                               v-model="form.createTime"
                               value-format="YYYY-MM-DD"
                               format="YYYY-MM-DD"
                               type="date"
                               placeholder="璇烽�夋嫨"
-                              clearable
-                              :disabled="operationType === 'view'" />
+                              clearable />
             </el-form-item>
           </el-col>
         </el-row>
@@ -263,16 +263,16 @@
                               format="YYYY-MM-DD"
                               type="date"
                               placeholder="璇烽�夋嫨"
-                              clearable
-                              :disabled="operationType === 'view'" />
+                              clearable />
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
+      <div v-if="operationType === 'edit2' || operationType === 'edit3'"
+           class="classtitle">闅愭偅璇︽儏</div>
       <el-descriptions :column="2"
                        style="margin-bottom: 20px;"
                        v-if="operationType === 'edit2' || operationType === 'edit3'"
-                       title="闅愭偅璇︽儏"
                        border>
         <el-descriptions-item label="闅愭偅缂栧彿">
           <span class="detail-title">{{ form.hiddenCode }}</span>
@@ -285,7 +285,7 @@
           <span class="detail-title">{{ form.hiddenDesc }}</span>
         </el-descriptions-item>
         <el-descriptions-item label="闅愭偅绫诲瀷">
-          <span class="detail-title">{{ form.type }}</span>
+          <span class="detail-title">{{ TypeLabel(form.type) }}</span>
         </el-descriptions-item>
         <el-descriptions-item label="闅愭偅椋庨櫓绛夌骇">
           <el-tag :type="getTypeTagType(form.riskLevel)">
@@ -308,10 +308,12 @@
           <span class="detail-title">{{ form.rectifyTime }}</span>
         </el-descriptions-item>
       </el-descriptions>
+      <div class="classtitle"
+           v-if="operationType === 'edit3'"
+           style="margin-top: 40px;">鏁存敼璇︽儏</div>
       <el-descriptions :column="2"
                        style="margin-bottom: 20px;"
                        v-if="operationType === 'edit3'"
-                       title="鏁存敼璇︽儏"
                        border>
         <el-descriptions-item label="鏁存敼鍏蜂綋鎺柦"
                               :span="2">
@@ -321,6 +323,9 @@
           <span class="detail-title">{{ form2.rectifyActualTime }}</span>
         </el-descriptions-item>
       </el-descriptions>
+      <div class="classtitle"
+           v-if="operationType === 'edit2' || operationType === 'edit3'"
+           style="margin-top: 40px;margin-bottom: 30px;">楠屾敹鎯呭喌</div>
       <el-form :model="form2"
                v-if="operationType === 'edit2'"
                label-width="140px"
@@ -345,8 +350,7 @@
                               format="YYYY-MM-DD"
                               type="date"
                               placeholder="璇烽�夋嫨"
-                              clearable
-                              :disabled="operationType === 'view'" />
+                              clearable />
             </el-form-item>
           </el-col>
         </el-row>
@@ -411,25 +415,22 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <!-- 闄勪欢鍒楄〃寮圭獥 -->
-    <FileListDialog ref="fileListRef"
-                    v-model="fileListDialogVisible"
-                    :show-upload-button="true"
-                    :show-delete-button="true"
-                    :upload-method="handleUpload"
-                    :delete-method="handleFileDelete"
-                    title="闄勪欢鍒楄〃" />
+    <FileListDialog
+        v-if="fileListDialogVisible"
+        :record-id="currentRecordId"
+        record-type="safe_hidden"
+        v-model:visible="fileListDialogVisible"/>
+
   </div>
 </template>
 
 <script setup>
   import { getToken } from "@/utils/auth";
   import pagination from "@/components/PIMTable/Pagination.vue";
-  import { onMounted, ref, getCurrentInstance } from "vue";
+  import { onMounted, ref, getCurrentInstance, computed } from "vue";
   import { ElMessageBox, ElMessage } from "element-plus";
   import useUserStore from "@/store/modules/user";
   import { userListNoPage } from "@/api/system/user.js";
-  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
   import FormDialog from "@/components/Dialog/FormDialog.vue";
   import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
   import {
@@ -438,13 +439,9 @@
     safeHiddenUpdate,
     safeHiddenDel,
     fileListPage,
-    safeHiddenFileAdd,
-    safeHiddenFileDel,
   } from "@/api/safeProduction/dangerInvestigation.js";
   import useFormData from "@/hooks/useFormData.js";
-  import request from "@/utils/request";
   import dayjs from "dayjs";
-  import { get } from "@vueuse/core";
 
   const userStore = useUserStore();
   const { proxy } = getCurrentInstance();
@@ -452,6 +449,7 @@
   const selectedRows = ref([]);
   const userList = ref([]);
   const tableLoading = ref(false);
+  const currentRecordId = ref(0);
   const page = reactive({
     current: 1,
     size: 100,
@@ -520,28 +518,12 @@
     verifyResult: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     acceptDesc: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
   };
-  const typeList = ref([
-    {
-      value: "璁惧瀹夊叏",
-      label: "璁惧瀹夊叏",
-    },
-    {
-      value: "浜哄憳鎿嶄綔",
-      label: "浜哄憳鎿嶄綔",
-    },
-    {
-      value: "鐜椋庨櫓",
-      label: "鐜椋庨櫓",
-    },
-    {
-      value: "鐗╂枡绠℃帶",
-      label: "鐗╂枡绠℃帶",
-    },
-    {
-      value: "鍏朵粬",
-      label: "鍏朵粬",
-    },
-  ]);
+  const { hidden_danger_type } = proxy.useDict("hidden_danger_type");
+  const typeList = computed(() => hidden_danger_type?.value || []);
+  const TypeLabel = val => {
+    const item = typeList.value.find(i => String(i.value) === String(val));
+    return item ? item.label : val;
+  };
   const form2 = ref({
     rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
     rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
@@ -572,8 +554,6 @@
       label: "浣庨闄�",
     },
   ]);
-  // 闅愭偅绫诲瀷閫夐」
-  const { type_qualification } = proxy.useDict("type_qualification");
   const { form, rules } = toRefs(data);
   const { form: searchForm } = useFormData(data.searchForm);
   // 浜у搧琛ㄥ崟寮规鏁版嵁
@@ -586,12 +566,6 @@
     customer: "",
   });
 
-  const handleChange = userId => {
-    const selectedUser = userList.value.find(user => user.userId === userId);
-    if (selectedUser) {
-      form.value.createUserName = selectedUser.nickName;
-    }
-  };
   const handleChange2 = userId => {
     const selectedUser = userList.value.find(user => user.userId === userId);
     if (selectedUser) {
@@ -676,6 +650,14 @@
         tableLoading.value = false;
         tableData.value = res.data.records;
         total.value = res.data.total;
+        tableData.value.forEach(item => {
+          // console.log(item.rectifyUserId, currentUserId.value, "=======");
+          if (Number(item.rectifyUserId) != Number(currentUserId.value)) {
+            item.isRectify = true;
+          } else {
+            item.isRectify = false;
+          }
+        });
         return res;
       })
       .catch(() => {
@@ -722,8 +704,8 @@
         hiddenCode: "", // 闅愭偅缂栧彿
         location: "", // 闅愭偅浣嶇疆
         hiddenDesc: "", // 闅愭偅鎻忚堪
-        createUser: "", // 涓婃姤浜�
-        createUserName: "",
+        createUser: Number(currentUserId.value), // 涓婃姤浜�
+        createUserName: currentUserName.value,
         createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 涓婃姤鏃堕棿
         rectifyUserId: "", // 鏁存敼璐d换浜�
         rectifyUserName: "",
@@ -910,6 +892,9 @@
         proxy.$modal.msg("宸插彇娑�");
       });
   };
+  const isPeople = rectifyUserId => {
+    return Number(rectifyUserId) == Number(currentUserId.value);
+  };
 
   /**
    * 鍒ゆ柇鏄惁鍙互鍙戣揣
@@ -934,6 +919,11 @@
     const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
     return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
   };
+  const filePagination = ref({
+    current: 1,
+    size: 10,
+    total: 0,
+  });
 
   /**
    * 涓嬭浇鏂囦欢
@@ -944,17 +934,15 @@
   const fileListDialogVisible = ref(false);
   const currentFileRow = ref(null);
   const downLoadFile = row => {
-    currentFileRow.value = row;
-    fileListPage({ safeHiddenId: row.id }).then(res => {
-      if (fileListRef.value) {
-        fileListRef.value.open(res.data.records);
-      }
-    });
+    currentRecordId.value = row.id;
+    fileListDialogVisible.value = true;
   };
   const currentUserId = ref("");
+  const currentUserName = ref("");
   const getCurrentFactoryName = async () => {
     let res = await userStore.getInfo();
     currentUserId.value = res.user.userId;
+    currentUserName.value = res.user.nickName;
   };
 
   /**
@@ -977,127 +965,12 @@
   };
 
   onMounted(() => {
+    getCurrentFactoryName();
     getList();
     userListNoPage().then(res => {
       userList.value = res.data;
     });
-    getCurrentFactoryName();
   });
-  // 涓婁紶闄勪欢
-  const handleUpload = async () => {
-    if (!currentFileRow.value) {
-      proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁");
-      return null;
-    }
-
-    return new Promise(resolve => {
-      // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
-      const input = document.createElement("input");
-      input.type = "file";
-      input.style.display = "none";
-      input.onchange = async e => {
-        const file = e.target.files[0];
-        if (!file) {
-          resolve(null);
-          return;
-        }
-
-        try {
-          // 浣跨敤 FormData 涓婁紶鏂囦欢
-          const formData = new FormData();
-          formData.append("file", file);
-
-          const uploadRes = await request({
-            url: "/file/upload",
-            method: "post",
-            data: formData,
-            headers: {
-              "Content-Type": "multipart/form-data",
-              Authorization: `Bearer ${getToken()}`,
-            },
-          });
-
-          if (uploadRes.code === 200) {
-            // 淇濆瓨闄勪欢淇℃伅
-            const fileData = {
-              safeHiddenId: currentFileRow.value.id,
-              name: uploadRes.data.originalName || file.name,
-              url: uploadRes.data.tempPath || uploadRes.data.url,
-            };
-
-            const saveRes = await safeHiddenFileAdd(fileData);
-            if (saveRes.code === 200) {
-              proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
-              // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
-              const listRes = await fileListPage({
-                safeHiddenId: currentFileRow.value.id,
-              });
-              if (listRes.code === 200 && fileListRef.value) {
-                const fileList = (listRes.data?.records || []).map(item => ({
-                  name: item.name,
-                  url: item.url,
-                  id: item.id,
-                  ...item,
-                }));
-                fileListRef.value.setList(fileList);
-              }
-              // 杩斿洖鏂版枃浠朵俊鎭�
-              resolve({
-                name: fileData.name,
-                url: fileData.url,
-                id: saveRes.data?.id,
-              });
-            } else {
-              proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触");
-              resolve(null);
-            }
-          } else {
-            proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
-            resolve(null);
-          }
-        } catch (error) {
-          proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
-          resolve(null);
-        } finally {
-          document.body.removeChild(input);
-        }
-      };
-
-      document.body.appendChild(input);
-      input.click();
-    });
-  };
-  // 鍒犻櫎闄勪欢
-  const handleFileDelete = async row => {
-    try {
-      const res = await safeHiddenFileDel([row.id]);
-      if (res.code === 200) {
-        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-        // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
-        if (currentFileRow.value && fileListRef.value) {
-          const listRes = await fileListPage({
-            safeHiddenId: currentFileRow.value.id,
-          });
-          if (listRes.code === 200) {
-            const fileList = (listRes.data?.records || []).map(item => ({
-              name: item.name,
-              url: item.url,
-              id: item.id,
-              ...item,
-            }));
-            fileListRef.value.setList(fileList);
-          }
-        }
-        return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
-      } else {
-        proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
-        return false;
-      }
-    } catch (error) {
-      proxy.$modal.msgError("鍒犻櫎澶辫触");
-      return false;
-    }
-  };
 </script>
 
 <style scoped lang="scss">
@@ -1297,4 +1170,12 @@
       page-break-after: avoid;
     }
   }
+  .classtitle {
+    font-size: 16px;
+    font-weight: 600;
+    color: #303133;
+    border-left: 4px solid #409eff;
+    padding-left: 12px;
+    margin-bottom: 12px;
+  }
 </style>

--
Gitblit v1.9.3