From dd159ea51a7a77bd8cc00c70c0e900f472fb3395 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 05 六月 2025 18:00:17 +0800
Subject: [PATCH] 完善基础管理 供应商、客户、煤种等功能

---
 src/views/basicInformation/index.vue |  738 +++++++++++++++++++++++++++++---------------------------
 1 files changed, 382 insertions(+), 356 deletions(-)

diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue
index c77fc2d..ff27c0e 100644
--- a/src/views/basicInformation/index.vue
+++ b/src/views/basicInformation/index.vue
@@ -1,125 +1,51 @@
 <template>
-  <div class="app-container">
-          <el-form :inline="true" :model="queryParams" class="search-form">
-        <el-form-item label="鎼滅储">
-          <el-input
-            v-model="queryParams.searchText"
-            placeholder="璇疯緭鍏ュ叧閿瘝"
-            clearable
-          />
-        </el-form-item>
-        <el-form-item label="渚涘簲鍟嗗悕绉�">
-          <el-input
-            v-model="queryParams.supplierName"
-            placeholder="璇疯緭鍏�"
-            clearable
-          />
-        </el-form-item>
-        <el-form-item label="缁熶竴浜鸿瘑鍒彿">
-          <el-input
-            v-model="queryParams.identifyNumber"
-            placeholder="璇疯緭鍏�"
-            clearable
-          />
-        </el-form-item>
-        <el-form-item label="缁忚惀鍦板潃">
-          <el-input
-            v-model="queryParams.address"
-            placeholder="璇疯緭鍏�"
-            clearable
-          />
-        </el-form-item>
-        <el-form-item>
-          <el-button type="primary" @click="handleQuery">鏌ヨ</el-button>
-          <el-button @click="resetQuery">閲嶇疆</el-button>
-        </el-form-item>
-      </el-form>
+  <div>    <el-form :inline="true" :model="queryParams" class="search-form" >
+      <el-form-item label="鎼滅储" v-if="tabName === 'supplier' || tabName === 'customer'">
+        <el-input v-model="queryParams.searchAll" placeholder="渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃" clearable />
+      </el-form-item>
+      <el-form-item label="鎼滅储" v-if="tabName === 'coal' || tabName === 'coalQualityMaintenance'">
+        <el-input v-model="queryParams.searchAll" placeholder="璇疯緭鍏ユ悳绱俊鎭�" clearable />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="search">鏌ヨ</el-button>
+        <el-button @click="resetQuery">閲嶇疆</el-button>
+      </el-form-item>
+    </el-form>
     <el-card>
       <!-- 鏍囩椤� -->
-      <el-tabs
-        v-model="activeTab"
-        class="info-tabs"
-        @tab-click="handleTabClick"
-      >
-        <el-tab-pane
-          v-for="tab in tabs"
-          :key="tab.name"
-          :label="tab.label"
-          :name="tab.name"
-        />
+      <el-tabs v-model="activeTab" class="info-tabs" @tab-click="handleTabClick">
+        <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="tab.label" :name="tab.name" />
       </el-tabs>
-
+  
       <!-- 鎿嶄綔鎸夐挳鍖� -->
       <el-row :gutter="24" class="table-toolbar">
-        <el-button type="primary" :icon="Plus" @click="handleAdd"
-          >鏂板缓</el-button
-        >
+        <el-button type="primary" :icon="Plus" @click="handleAdd">鏂板缓</el-button>
         <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
-        <el-button type="info" :icon="Download" @click="handleExport">瀵煎嚭</el-button>
-      </el-row> 
+        <el-button type="info" :icon="Download" @click="handleExport" v-show="tabName === 'supplier' || tabName === 'customer'">瀵煎嚭</el-button>
+      </el-row>
       <!-- 琛ㄦ牸缁勪欢 -->
       <div>
-        <data-table
-          :loading="loading"
-          :table-data="tableData"
-          :columns="columns"
-          @selection-change="handleSelectionChange"
-          @edit="handleEdit"
-          @delete="handleDeleteSuccess"
-          :show-selection="true"
-          :border="true"
-          :maxHeight="440"
-        />
+        <data-table :loading="loading" :table-data="tableData" :columns="columns"
+          @selection-change="handleSelectionChange" @edit="handleEdit" :show-selection="true" :border="true" />
       </div>
-      <pagination
-        v-if="total>0"
-        :page-num="pageNum"
-        :page-size="pageSize"
-        :total="total"
-        @pagination="handleQuery"
-        :layout="'total, prev, pager, next, jumper'"
-      />
-      <Supplier
-        v-if="tabName === 'supplier'"
-        v-model:supplierDialogFormVisible="dialogFormVisible"
-        :form="form"
-        :title="title"
-        @submit="handleSubmit"
-        @beforeClose="handleBeforeClose"
-        @update:dialogFormVisible="handleDialogFormVisible"
-        :addOrEdit="addOrEdit"
-      />
-      <Customer
-        v-if="tabName === 'customer'"
-        v-model:customerDialogFormVisible="dialogFormVisible"
-        :form="form"
-        :title="title"
-        @submit="handleSubmit"
-        :addOrEdit="addOrEdit"
-        @beforeClose="handleBeforeClose"
-      />
-      <Coal
-        v-if="tabName === 'coal'"
-        v-model:coalDialogFormVisible="dialogFormVisible"
-        :form="form"
-        :title="title"
-        :addOrEdit="addOrEdit"
-        @submit="handleSubmit"
-      />
-      <coalQualityMaintenance
-        v-if="tabName === 'coalQualityMaintenance'"
-        v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible"
-        :form="form"
-        :title="title"
-        :addOrEdit="addOrEdit"
-        @submit="handleSubmit"
-      />
+      <pagination v-if="total>0" :page="pageNum" :limit="pageSizes" :total="total" @pagination="handPagination"
+        :layout="'total, prev, pager, next, jumper'" />
+      <Supplier v-if="tabName === 'supplier'" v-model:copyForm="copyForm" v-model:supplierDialogFormVisible="dialogFormVisible" :form="form"
+        :title="title" @submit="handleSubmit" @beforeClose="handleBeforeClose"
+        @update:dialogFormVisible="handleDialogFormVisible" :addOrEdit="addOrEdit" />
+      <Customer v-if="tabName === 'customer'" v-model:copyForm="copyForm" v-model:customerDialogFormVisible="dialogFormVisible" :form="form"
+        :title="title" @submit="handleSubmit" :addOrEdit="addOrEdit" @beforeClose="handleBeforeClose" />
+      <Coal v-if="tabName === 'coal'" v-model:copyForm="copyForm" v-model:coalDialogFormVisible="dialogFormVisible" :form="form" :title="title"
+        :addOrEdit="addOrEdit" @submit="handleSubmit" />
+      <coalQualityMaintenance v-if="tabName === 'coalQualityMaintenance'"
+        v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible" :form="form" :title="title"
+        :addOrEdit="addOrEdit" @submit="handleSubmit" />
     </el-card>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from "vue";
+import { ref, reactive, onMounted, computed } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue";
 import DataTable from "@/components/Table/ETable.vue";
@@ -129,6 +55,13 @@
 import Coal from "./mould/coal.vue";
 import coalQualityMaintenance from "./mould/coalQualityMaintenance.vue";
 const { proxy } = getCurrentInstance()
+import { getSupply, addOrEditSupply, delSupply } from "@/api/basicInformation/supplier.js";
+import { getCoalInfo, delCoalInfo } from "@/api/basicInformation/coal.js";
+import { getCoalQuality, delCoalQuality } from "@/api/basicInformation/coalQualityMaintenance.js";
+import { testUserList } from "@/api/tool/publicInterface.js";
+import { getAreaOptions } from "@/api/system/area.js";
+import { getCustomerList, delCustomer } from "@/api/basicInformation/customer.js";
+
 // 寮圭獥
 const coalQualityMaintenanceDialogFormVisible = ref(false);
 const customerDialogFormVisible = ref(false);
@@ -138,24 +71,89 @@
 const form = ref({});
 const title = ref("");
 const copyForm = ref({});
+// 鐢ㄦ埛鍒楄〃鏁版嵁
+const userList = ref([]);
+// 鐢ㄦ埛鏄犲皠琛紝鐢ㄤ簬蹇�熸煡鎵�
+const userMap = ref({});
+// 鍦板潃鏄犲皠琛紝鐢ㄤ簬蹇�熸煡鎵惧湴鍧�鍚嶇О
+const addressMap = ref({});
 // 褰撳墠鏍囩
 const tabName = ref("supplier");
 // 鐘舵�佸彉閲�
 const loading = ref(false);
 const total = ref(0);
 const pageNum = ref(1);
-const pageSize = ref(10);
+const pageSizes = ref(10);
 const activeTab = ref("supplier");
 const selectedRows = ref([]);
 // 鏌ヨ鍙傛暟
 const queryParams = reactive({
-  searchText: "",
-  supplierName: "",
-  identifyNumber: "",
-  address: "",
 });
-onMounted(() => {
-  handleTabClick({ props: { name: "supplier" } });
+// 鍦板潃閫夋嫨鏁版嵁
+const addressSelectOptions = ref([]);
+const fetchAreaOptions = async () => {
+  addressSelectOptions.value = [];
+  const res = await getAreaOptions();
+  if (res.code === 200) {
+    addressSelectOptions.value = res.data;
+    buildAddressMap(res.data); // 鏋勫缓鍦板潃鏄犲皠琛�
+  }
+}
+
+// 鏋勫缓鍦板潃鏄犲皠琛紝鐢ㄤ簬蹇�熸煡鎵惧湴鍧�鍚嶇О
+const buildAddressMap = (areaData) => {
+  const buildMap = (list, pathList = []) => {
+    list.forEach(item => {
+      const currentPath = [...pathList, item.label];
+      addressMap.value[item.id] = {
+        name: item.label,
+        fullPath: currentPath.join(' / ')
+      };
+      if (item.children && item.children.length > 0) {
+        buildMap(item.children, currentPath);
+      }
+    });
+  };
+  buildMap(areaData);
+};
+
+// 鍦板潃鏍煎紡鍖栧嚱鏁�
+const formatAddressArray = (addressIds) => {
+  // 濡傛灉鍦板潃鏄犲皠琛ㄨ繕娌℃湁鍑嗗濂斤紝鏄剧ず --
+  if (!addressMap.value || Object.keys(addressMap.value).length === 0||!addressIds || !Array.isArray(addressIds) || addressIds.length === 0 || addressIds.every(id => !id)) {
+    return '--';
+  }
+  
+  const addressNames = addressIds.map(id => {
+    return addressMap.value[id]?.name || '--';
+  });
+  
+  // 濡傛灉鎵�鏈夊湴鍧�鍚嶇О閮芥槸 '--'锛屽垯杩斿洖 '--'
+  if (addressNames.every(name => name === '--')) {
+    return '--';
+  }
+  
+  return addressNames.filter(name => name !== '--').join(' / ');
+};
+// 鑾峰彇鐢ㄦ埛鍒楄〃鏁版嵁
+const getUserList = async () => {
+  try {
+    const res = await testUserList();
+    if (res && res.data) {
+      userList.value = res.data;
+      userList.value.forEach(user => {
+        userMap.value[user.userId] = user.username;
+      });
+    }
+  } catch (error) {
+    console.error('鑾峰彇鐢ㄦ埛鍒楄〃澶辫触:', error);
+  }
+};
+
+onMounted(async () => {
+  await handleTabClick({ props: { name: "supplier" } });
+  await fetchAreaOptions(); // 鍏堣幏鍙栧湴鍧�閫夋嫨鏁版嵁骞舵瀯寤烘槧灏勮〃
+  await getUserList(); // 鑾峰彇鐢ㄦ埛鍒楄〃
 });
 const columns = ref();
 // 鏍囩椤垫暟鎹�
@@ -169,43 +167,127 @@
 const addOrEdit = ref("add");
 // 琛ㄦ牸鏁版嵁
 const tableData = ref([]);
-// 鏂规硶瀹氫箟
-const handleQuery = () => {
-  loading.value = true;
-  setTimeout(() => {
-    loading.value = false;
-  }, 500);
-};
 // supplier 渚涘簲鍟嗘暟鎹�
 const supplierColumns = ref([
-  { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 200 },
-  { prop: "identifyNumber", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
-  { prop: "address", label: "缁忚惀鍦板潃", minWidth: 150 },
-  { prop: "detailedaddress", label: "璇︾粏鍦板潃", minWidth: 150 },
-  { prop: "bank", label: "寮�鎴疯", minWidth: 120 },
-  { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },
-  { prop: "contacts", label: "鑱旂郴浜�", minWidth: 100 },
-  { prop: "contactAddress", label: "鑱旂郴鍦板潃", minWidth: 150 },
-  { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
-  { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
+  { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 100 },
+  { prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 170 },  { 
+    prop: "bids", 
+    label: "缁忚惀鍦板潃", 
+    minWidth: 150,
+    showOverflowTooltip: true,
+    formatter: (row, column, cellValue) => {
+      let arr = [
+        row.bprovinceId,
+        row.bcityId,
+        row.bdistrictId,
+      ]
+      return formatAddressArray(arr);
+    }
+  },
+  { prop: "businessAddress", label: "缁忚惀璇︾粏鍦板潃", minWidth: 150 },
+  { prop: "bankAccount", label: "寮�鎴疯", minWidth: 120 },
+  { prop: "bankName", label: "閾惰璐﹀彿", minWidth: 150 },
+  { prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100 },  
+  { 
+    prop: "cids", 
+    label: "鑱旂郴浜哄湴鍧�", 
+    minWidth: 150,
+    showOverflowTooltip: true,
+    formatter: (row, column, cellValue) => {
+      let arr = [
+        row.cprovinceId,
+        row.ccityId,
+        row.cdistrictId,
+      ]
+      return formatAddressArray(arr);
+    }
+  },{ prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 120 },
+  // { 
+  //   prop: "maintainerId", 
+  //   label: "缁存姢浜�", 
+  //   minWidth: 80,
+  //   formatter: (row, column, cellValue) => {
+  //     // 濡傛灉鐢ㄦ埛鏄犲皠琛ㄨ繕娌℃湁鍑嗗濂斤紝鏄剧ず --
+  //     if (!userMap.value || Object.keys(userMap.value).length === 0) {
+  //       return '--';
+  //     }
+  //     // 濡傛灉鍊间负绌烘垨null锛屾樉绀� --
+  //     if (cellValue === null || cellValue === undefined || cellValue === '') {
+  //       return '--';
+  //     }
+  //     // 濡傛灉鐢ㄦ埛鏄犲皠琛ㄤ腑鏈夊搴旂殑鐢ㄦ埛鍚嶏紝杩斿洖鐢ㄦ埛鍚�
+  //     if (userMap.value[cellValue]) {
+  //       return userMap.value[cellValue];
+  //     }
+  //     // 濡傛灉娌℃湁鍖归厤鐨勭敤鎴凤紝鏄剧ず --
+  //     return '--';
+  //   }
+  // },
+  { prop: "createTime", label: "缁存姢鏃ユ湡", minWidth: 120 },
 ]);
 // customer 瀹㈡埛鏁版嵁
 const customerColumns = ref([
-  { prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 200 },
-  { prop: "identifyNumber", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
-  { prop: "address", label: "缁忚惀鍦板潃", minWidth: 150 },
-  { prop: "detailedaddress", label: "璇︾粏鍦板潃", minWidth: 150 },
-  { prop: "bank", label: "寮�鎴疯", minWidth: 120 },
-  { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },
-  { prop: "contacts", label: "鑱旂郴浜�", minWidth: 100 },
-  { prop: "contactAddress", label: "鑱旂郴鍦板潃", minWidth: 150 },
-  { prop: "maintainer", label: "缁存姢浜�", minWidth: 100 },
-  { prop: "maintainDate", label: "缁存姢鏃ユ湡", minWidth: 100 },
+  { prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 100 },
+  { prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 },
+{ 
+    prop: "bids", 
+    label: "缁忚惀鍦板潃", 
+    minWidth: 150,
+    showOverflowTooltip: true,
+    formatter: (row, column, cellValue) => {
+      let arr = [
+        row.businessProvinceId,
+        row.businessCityId,
+        row.businessDistrictId,
+      ]
+      return formatAddressArray(arr);
+    }
+  },
+  { prop: "businessAddress", label: "璇︾粏鍦板潃", minWidth: 150 },
+  { prop: "bankName", label: "寮�鎴疯", minWidth: 120 },
+  { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 },  
+  { prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100 },
+  { prop: "contactPhone", label: "鑱旂郴浜虹數璇�", minWidth: 100 },
+{ 
+    prop: "cids", 
+    label: "鑱旂郴浜哄湴鍧�", 
+    minWidth: 150,
+    showOverflowTooltip: true,
+    formatter: (row, column, cellValue) => {
+      let arr = [
+        row.provinceId,
+        row.cityId,
+        row.districtId,
+      ]
+      return formatAddressArray(arr);
+    }
+  },
+  { prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 150 },
+  { prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 100 },
 ]);
 // coal 鐓ょ鏁版嵁
 const coalColumns = ref([
-  { prop: "coalName", label: "鐓ょ鍚嶇О", minWidth: 200 },
-  { prop: "maintainer", label: "缁存姢浜�", minWidth: 120 },
+  { prop: "coal", label: "鐓ょ鍚嶇О", minWidth: 200 },  { 
+    prop: "maintainerId", 
+    label: "缁存姢浜�", 
+    minWidth: 120,
+    formatter: (row, column, cellValue) => {
+      // 濡傛灉鐢ㄦ埛鏄犲皠琛ㄨ繕娌℃湁鍑嗗濂斤紝鏄剧ず --
+      if (!userMap.value || Object.keys(userMap.value).length === 0) {
+        return '--';
+      }
+      // 濡傛灉鍊间负绌烘垨null锛屾樉绀� --
+      if (cellValue === null || cellValue === undefined || cellValue === '') {
+        return '--';
+      }
+      // 濡傛灉鐢ㄦ埛鏄犲皠琛ㄤ腑鏈夊搴旂殑鐢ㄦ埛鍚嶏紝杩斿洖鐢ㄦ埛鍚�
+      if (userMap.value[cellValue]) {
+        return userMap.value[cellValue];
+      }
+      // 濡傛灉娌℃湁鍖归厤鐨勭敤鎴凤紝鏄剧ず --
+      return '--';
+    }
+  },
   { prop: "maintenanceDate", label: "缁存姢鏃ユ湡", minWidth: 150 },
 ]);
 // coalQualityMaintenance 鐓よ川缁存姢鏁版嵁
@@ -222,42 +304,42 @@
 // 鏍囩椤电偣鍑�
 const handleTabClick = (tab) => {
   form.value = {};
-  getList();
   addOrEdit.value = "add";
   loading.value = true;
   tabName.value = tab.props.name;
   tableData.value = [];
-  getList();
   switch (tabName.value) {
     case "supplier":
       columns.value = supplierColumns.value;
       dialogFormVisible.value = supplierDialogFormVisible.value;
+      getList("supplier");
       break;
     case "customer":
       columns.value = customerColumns.value;
       dialogFormVisible.value = customerDialogFormVisible.value;
+      getList("customer");
+
       break;
     case "coal":
       columns.value = coalColumns.value;
       dialogFormVisible.value = coalDialogFormVisible.value;
+      getList("coal");
       break;
     case "coalQualityMaintenance":
       columns.value = coalQualityMaintenanceColumns.value;
       dialogFormVisible.value = coalQualityMaintenanceDialogFormVisible.value;
+      getList("coalQualityMaintenance");
       break;
   }
-  setTimeout(() => {
-    loading.value = false;
-  }, 500);
 };
 // 閲嶇疆鏌ヨ
 const resetQuery = () => {
   Object.keys(queryParams).forEach((key) => {
-    if (key !== "pageNum" && key !== "pageSize") {
+    if (key !== "pageNum" && key !== "pageSizes") {
       queryParams[key] = "";
     }
   });
-  handleQuery();
+  getList()
 };
 // 鏂板
 const handleAdd = () => {
@@ -295,15 +377,20 @@
   form.value = {};
   dialogFormVisible.value = true;
 };
+// 鍒嗛〉
+const handPagination = (val) => {
+  pageNum.value = val.page;
+  pageSizes.value = val.limit;
+  getList();
+};
 // 鎻愪氦琛ㄥ崟
-const handleSubmit = () => {
-  // 鎷垮埌鎻愪氦鏁版嵁
-  dialogFormVisible.value = false;
-  if (addOrEdit.value === "add") {
-    ElMessage.success("鏂板鎴愬姛锛�" + copyForm.value.supplierName);
-  } else {
-    ElMessage.success("缂栬緫鎴愬姛锛�" + copyForm.value.supplierName);
+const handleSubmit = async (val) => {
+  if (val.result.code !== 200) {
+    ElMessage.error("鎿嶄綔澶辫触锛�" + val.result.msg);
+    return;
   }
+  ElMessage.success(val.title + val.result.msg);
+  dialogFormVisible.value = false;
   getList();
 };
 const handleDialogFormVisible = (value) => {
@@ -315,9 +402,37 @@
 };
 // 缂栬緫
 const handleEdit = (row) => {
-    form.value = JSON.parse(JSON.stringify(row));
-    addOrEdit.value = "edit";
-    handleAddEdit(tabName.value);
+  form.value = JSON.parse(JSON.stringify(row));
+  if(form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId  ){
+    form.value.bids = [
+    row.bprovinceId,
+    row.bcityId,
+    row.bdistrictId,
+  ];
+  }
+   if(form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId  ){
+    form.value.cids = [
+    row.cprovinceId,
+    row.ccityId,
+    row.cdistrictId,
+  ];
+  }
+  if(form.value.businessCityId && form.value.businessDistrictId && form.value.businessProvinceId) {
+    form.value.bids = [
+      row.businessProvinceId,
+      row.businessCityId,
+      row.businessDistrictId,
+    ];
+  }
+  if(form.value.cityId && form.value.districtId && form.value.provinceId) {
+    form.value.cids = [
+      row.provinceId,
+      row.cityId,
+      row.districtId,
+    ];
+  }
+  addOrEdit.value = "edit";
+  handleAddEdit(tabName.value);
 };
 // 鎵归噺鍒犻櫎
 const handleDelete = () => {
@@ -325,252 +440,163 @@
     ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
     return;
   }
+  let arr = reactive([]);
+  selectedRows.value.forEach(element => {
+    return arr.push(element.id);
+  });
   ElMessageBox.confirm("纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛�", "鎻愮ず", {
     confirmButtonText: "纭畾",
     cancelButtonText: "鍙栨秷",
     type: "warning",
   })
-    .then(() => {
-      ElMessage.success("鍒犻櫎鎴愬姛锛屽叡鍒犻櫎" + selectedRows.value.length + "鏉℃暟鎹�");
-      selectedRows.value.forEach((row) => {
-        tableData.value = tableData.value.filter(
-          (item) => item !== row
-        );
-      });
-      total.value = tableData.value.length;
-      // 娓呯┖閫変腑琛�
-      selectedRows.value = [];
-  }).catch(() => {
-    ElMessage.info("宸插彇娑堝垹闄ゆ搷浣�");
-  });
+    .then(async () => {
+      try {
+        let res;
+        if( tabName.value === "supplier" ) {
+          res = await delSupply(arr);
+        } else if (tabName.value === "coal") {
+          res = await delCoalInfo(arr);
+        } else if (tabName.value === "coalQualityMaintenance") {
+          res = await delCoalQuality(arr);
+        } else if( tabName.value === "customer") {
+          res = await delCustomer(arr);
+        }
+        if(res.code !== 200 && res.meg == "鎿嶄綔鎴愬姛") {
+          ElMessage.error("鍒犻櫎澶辫触锛�" + res.msg);
+          return;
+        }
+        ElMessage.success("鍒犻櫎鎴愬姛");
+        await getList(); 
+      } catch (e) {
+        console.error(e);
+        ElMessage.error("鍒犻櫎澶辫触锛岃绋嶅悗鍐嶈瘯");
+      } finally {
+        selectedRows.value = [];
+      }
+    }).catch(() => {
+      ElMessage.info("宸插彇娑堝垹闄ゆ搷浣�");
+    });
 }
-// 琛ㄦ牸鍒犻櫎
-const handleDeleteSuccess = (row) => {
-  ElMessage.success("鍒犻櫎鎴愬姛锛�" + row.supplierName);
-};
 // 鍏抽棴寮圭獥
 const handleBeforeClose = () => {
   dialogFormVisible.value = false;
   form.value = {};
 };
-const handleExport = (row) => {
-  proxy.download("system/post/export", {
-    ...queryParams.value
-  }, `post_${new Date().getTime()}.xlsx`)
-  ElMessage.success("瀵煎嚭鏁版嵁锛�" + row.supplierName);
-};
-const getList = () => {
-  loading.value = true;
+const handleExport = () => {
+  if(tabName.value === "supplier") {
+    Export("/supply/export", "渚涘簲鍟嗕俊鎭�");
+  } else if (tabName.value === "customer") {
+    Export("/customer/export", "瀹㈡埛淇℃伅");
+  } else if (tabName.value === "coal") {
+    Export("/supply/export", "鐓ょ淇℃伅");
+  } else if (tabName.value === "coalQualityMaintenance") {
+    Export("/supply/export", "鐓よ川缁存姢淇℃伅");
 
-  setTimeout(() => {
-    // 鏆傛椂寮曞叆娴嬭瘯鏁版嵁
-    tableData.value = [
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "123412123123123111",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-        contactsPhone: "19345678901",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "123412123123123111",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-        contactsPhone: "19345678901",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "123412123123123111",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-        contactsPhone: "19345678901",
-      },
-      {
-        supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
-        identifyNumber: "042-26881314",
-        address: "姹熻タ鐪�",
-        bank: "骞冲畨閾惰",
-        bankAccount: "123456789012345678",
-        contacts: "鍛ㄧ櫧鐜�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鍛ㄧ櫧鐜�",
-        maintainDate: "2022-08-29",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "019-65851198",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-      },
-      {
-        supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
-        identifyNumber: "042-26881314",
-        address: "姹熻タ鐪�",
-        bank: "骞冲畨閾惰",
-        bankAccount: "123456789012345678",
-        contacts: "鍛ㄧ櫧鐜�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鍛ㄧ櫧鐜�",
-        maintainDate: "2022-08-29",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "019-65851198",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-      },
-      {
-        supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
-        identifyNumber: "042-26881314",
-        address: "姹熻タ鐪�",
-        bank: "骞冲畨閾惰",
-        bankAccount: "123456789012345678",
-        contacts: "鍛ㄧ櫧鐜�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鍛ㄧ櫧鐜�",
-        maintainDate: "2022-08-29",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "019-65851198",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-      },
-      {
-        supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
-        identifyNumber: "042-26881314",
-        address: "姹熻タ鐪�",
-        bank: "骞冲畨閾惰",
-        bankAccount: "123456789012345678",
-        contacts: "鍛ㄧ櫧鐜�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鍛ㄧ櫧鐜�",
-        maintainDate: "2022-08-29",
-      },
-      {
-        supplierName: "涓浗鍐堕噾绉戝伐鑲′唤鏈夐檺鍏徃",
-        identifyNumber: "019-65851198",
-        address: "灞辫タ鐪�",
-        bank: "浜ら�氶摱琛�",
-        bankAccount: "901234567890123456",
-        contacts: "鏉庨洩鑺�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鏉庨洩鑺�",
-        maintainDate: "2022-09-26",
-      },
-      {
-        supplierName: "浜ら�氶摱琛岃偂浠芥湁闄愬叕鍙�",
-        identifyNumber: "042-26881314",
-        address: "姹熻タ鐪�",
-        bank: "骞冲畨閾惰",
-        bankAccount: "123456789012345678",
-        contacts: "鍛ㄧ櫧鐜�",
-        contactAddress: "XX鐪乆X甯俋X鍖篨X璺�",
-        maintainer: "鍛ㄧ櫧鐜�",
-        maintainDate: "2022-08-29",
-      },
-    ];
-    total.value = tableData.value.length;
-    loading.value = false;
-  }, 500);
+  }
+}
+const Export = (api,name) => {
+  proxy.download(api, {
+    ...queryParams.value
+  }, `${name}${new Date().getTime()}.xlsx`)
+  ElMessage.success("瀵煎嚭鏁版嵁锛�" + name);
 };
-getList();
+// 閫夋嫨鎺ュ彛
+const selectInterface = () => {
+  if (tabName.value === "supplier") {
+    return getSupply({
+      current: pageNum.value,
+      pageSize: pageSizes.value,
+      searchAll: queryParams.searchAll,
+    });
+  } else if (tabName.value === "customer") {
+    return getCustomerList({
+      current: pageNum.value,
+      pageSize: pageSizes.value,
+      searchAll: queryParams.searchAll,
+    });
+  } else if (tabName.value === "coal") {
+    return getCoalInfo({
+      current: pageNum.value,
+      pageSize: pageSizes.value,
+      searchAll: queryParams.searchAll,
+    });
+  } else if (tabName.value === "coalQualityMaintenance") {
+    return getCoalQuality({
+      current: pageNum.value,
+      pageSize: pageSizes.value,
+      searchAll: queryParams.searchAll,
+    });
+  }
+}
+const search = () => {
+  pageNum.value = 1; // 閲嶇疆椤电爜
+  getList();
+};
+// 鑾峰彇鍒楄〃鏁版嵁
+const getList = async () => {
+  loading.value = true;
+  /* if (Object.keys(addressMap.value).length === 0) {
+    await fetchAreaOptions();
+  } */
+  let { data, code } = await selectInterface()
+  if(code !== 200) {
+    ElMessage.error("鑾峰彇鏁版嵁澶辫触锛�" + data.msg);
+    loading.value = false;
+    return;
+  }
+  tableData.value = data.records;
+  total.value = data.total;
+  loading.value = false;
+};
 </script>
 
 <style scoped>
-.app-container {
-  padding: 20px;
-  background-color: #f5f7fa;
-  box-sizing: border-box;
-  min-height: calc(100vh - 84px);
-}
-.search-form {
-  background: #fff;
-  padding: 20px 20px 0 20px;
-  margin-bottom: 20px;
-  border-radius: 4px;
-  box-shadow: var(--el-box-shadow-light);
-}
-.el-form-item__label{
-  padding: 0 5px 0 0 !important;
-  font-weight: 500;
-}
-.search-form :deep(.el-form-item) {
-  margin-bottom: 16px;
-  width: 100%;
-}
-
 /* 鍝嶅簲寮忓竷灞� */
 @media screen and (min-width: 768px) {
   .search-form :deep(.el-form-item) {
     width: 50%;
   }
 }
+
 @media screen and (min-width: 1200px) {
   .search-form :deep(.el-form-item) {
     width: 16%;
   }
 }
-.info-tabs {
-  margin-bottom: 20px;
-}
+
 .table-toolbar {
   margin-bottom: 20px;
   display: flex;
   flex-wrap: wrap;
   gap: 10px;
 }
+
 /* 鍝嶅簲寮忚〃鏍� */
 @media screen and (max-width: 768px) {
   .table-toolbar {
     flex-direction: column;
   }
+
   .table-toolbar .el-button {
     width: 100%;
   }
 }
+
 /* 琛ㄦ牸宸ュ叿鏍� */
-.table-toolbar, .table-toolbar > * {
+.table-toolbar,
+.table-toolbar>* {
   margin: 0 0 0 0 !important;
 }
-.table-toolbar{
+
+.table-toolbar {
   margin-bottom: 20px !important;
 }
+
 .el-form--inline .el-form-item {
   margin-right: 25px;
 }
-.main-container{
+
+.main-container {
   background: red !important;
 }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3