From 40b5273e2540cee05bf3b9f11af5706989b5f699 Mon Sep 17 00:00:00 2001
From: zhang_12370 <z2864490065@outlook.com>
Date: 星期五, 27 六月 2025 16:42:11 +0800
Subject: [PATCH] 提交删除部分页面导出按钮 修改采购逻辑 取消供应商新增校验 完善vue打包以后找不到文件的问题

---
 src/views/basicInformation/index.vue |   71 ++++++++---------------------------
 1 files changed, 16 insertions(+), 55 deletions(-)

diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue
index 238cbf2..26dc9b9 100644
--- a/src/views/basicInformation/index.vue
+++ b/src/views/basicInformation/index.vue
@@ -58,7 +58,6 @@
           @selection-change="handleSelectionChange"
           :operations="['edit', 'viewRow']"
           :operationsWidth="200"
-          :show-overflow-tooltip="false"
         >
           <!-- 瀛楁鍚嶇О鍒楃殑鑷畾涔夋彃妲� - 鏄剧ず涓烘爣绛� -->
           <template
@@ -168,7 +167,6 @@
 import Coal from "./mould/coal.vue";
 import coalQualityMaintenance from "./mould/coalQualityMaintenance.vue";
 import coalMeiZhiZiDuanWeiHu from "./mould/coalMeiZhiZiDuanWeiHu.vue";
-import Descriptions from "@/components/dialog/Descriptions.vue";
 
 // ===== API 鏈嶅姟瀵煎叆 =====
 import { delSupply, getSupply } from "@/api/basicInformation/supplier.js";
@@ -186,16 +184,12 @@
 import {
   getCoalFieldList,
   getCoalPlanList,
+  delCoalPlan,
 } from "@/api/basicInformation/coalQualityMaintenance";
-
+import { useDelete } from "@/hooks/useDelete.js";
 const { proxy } = getCurrentInstance();
 
 // ===== 鍝嶅簲寮忕姸鎬佺鐞� =====
-// 寮圭獥鎺у埗鐘舵��
-const showDialog = ref(false);
-const currentViewData = ref({}); // 褰撳墠鏌ョ湅鐨勬暟鎹�
-
-
 const dialogFormVisible = ref(false);
 const form = ref({});
 const title = ref("");
@@ -316,10 +310,12 @@
 const getUserList = async () => {
   try {
     const res = await testUserList();
+    console.log("鑾峰彇鐢ㄦ埛鍒楄〃鏁版嵁:", res);
+    console.log("userMap:", userMap.value);
     if (res && res.data) {
       userList.value = res.data;
       userList.value.forEach((user) => {
-        userMap.value[user.userId] = user.username;
+        userMap.value[user.userId] = user.nickName;
       });
     }
   } catch (error) {
@@ -721,57 +717,22 @@
  * 鎵归噺鍒犻櫎澶勭悊
  * @description 鎵归噺鍒犻櫎閫変腑鐨勮褰�
  */
-const handleDelete = async () => {
-  if (selectedRows.value.length === 0) {
-    ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
-    return;
-  }
-
-  const deleteIds = selectedRows.value.map((item) => item.id);
-
-  try {
-    await ElMessageBox.confirm("纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛�", "鎻愮ず", {
-      confirmButtonText: "纭畾",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-    });
-
-    const deleteApiMap = {
+  const deleteApiMap = {
       supplier: delSupply,
       coal: delCoalInfo,
-      coalQualityMaintenance: () => {
-        throw new Error("delCoalQuality API not imported");
-      },
+      coalQualityMaintenance: delCoalPlan,
       customer: delCustomer,
       coalMeiZhiZiDuanWeiHu: deleteCoalField,
     };
-
-    const deleteApi = deleteApiMap[tabName.value];
-    if (!deleteApi) {
-      ElMessage.error("鍒犻櫎鎺ュ彛鏈厤缃�");
-      return;
-    }
-    console.log(deleteIds);
-    const res = await deleteApi(deleteIds);
-
-    if (res.code !== 200 && res.msg !== "鎿嶄綔鎴愬姛") {
-      ElMessage.error("鍒犻櫎澶辫触锛�" + res.msg);
-      return;
-    }
-
-    ElMessage.success("鍒犻櫎鎴愬姛");
-    await getList();
-  } catch (error) {
-    if (error.message !== "cancel") {
-      console.error("鍒犻櫎鎿嶄綔澶辫触:", error);
-      ElMessage.error("鍒犻櫎澶辫触锛岃绋嶅悗鍐嶈瘯");
-    } else {
-      ElMessage.info("宸插彇娑堝垹闄ゆ搷浣�");
-    }
-  } finally {
-    selectedRows.value = [];
-  }
-};
+const {handleDeleteBatch :handleDelete} = useDelete({
+  deleteApi: () => deleteApiMap[tabName.value],
+  selectedRows: selectedRows,
+  getList: () => getList,
+  tableData: tableData,
+  total: total,
+  confirmText: "纭鍒犻櫎閫変腑鐨勬暟鎹悧锛�",
+  successText: "鍒犻櫎鎴愬姛",
+})
 
 /**
  * 鍏抽棴寮圭獥澶勭悊

--
Gitblit v1.9.3