From 1a73c77e1d14205014f6a77a8954de480d436c0e Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 05 六月 2025 16:05:31 +0800
Subject: [PATCH] 联调基础模块信息-》供应商-》客户信息-》煤种信息 采购信息 联调

---
 src/views/procureMent/index.vue |  113 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 62 insertions(+), 51 deletions(-)

diff --git a/src/views/procureMent/index.vue b/src/views/procureMent/index.vue
index 790146a..b04a0f1 100644
--- a/src/views/procureMent/index.vue
+++ b/src/views/procureMent/index.vue
@@ -58,18 +58,15 @@
           :show-selection="true"
           :border="true"
           :maxHeight="440"
-        />
-      <pagination
+        />      <pagination
         v-if="total>0"
-        :page-num="pageNum"
-        :page-size="pageSize"
+        :page="pageNum"
+        :limit="pageSize"
         :total="total"
-        @pagination="handleQuery"
+        @pagination="handlePagination"
         :layout="'total, prev, pager, next, jumper'"
       />
-    </el-card>
-    <ProductionDialog
-        v-if="total>0"
+    </el-card>    <ProductionDialog
         v-model:dialogFormVisible="dialogFormVisible"
         :form="form"
         :title="title"
@@ -80,14 +77,14 @@
 </template>
 
 <script setup>
-import { ref, reactive, onMounted } from "vue";
+import { ref, reactive, onMounted, getCurrentInstance } 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";
 import Pagination from "@/components/Pagination";
-import ProductionDialog from "./components/ProductionDialog.vue";
+import ProductionDialog from './components/ProductionDialog.vue';
+import { purchaseRegistration } from "@/api/procureMent";
 const { proxy } = getCurrentInstance()
-
 const dialogFormVisible = ref(false);
 const form = ref({});
 const title = ref("");
@@ -103,7 +100,8 @@
   supplierName: "",
   identifyNumber: "",
   address: "",
-  
+  pageNum: 1,
+  pageSize: 10
 });
 // 鏄惁缂栬緫
 const addOrEdit = ref("add");
@@ -113,21 +111,30 @@
 const handleQuery = () => {
   loading.value = true;
   // 杩欓噷娣诲姞瀹為檯鐨勬煡璇㈤�昏緫
-  setTimeout(() => {
-    loading.value = false;
-  }, 500);
+  getList();
+};
+
+// 鍒嗛〉澶勭悊
+const handlePagination = (val) => {
+  console.log("鍒嗛〉鍙傛暟锛�", val);
+  pageNum.value = val.page;
+  pageSize.value = val.limit;
+  queryParams.pageNum = val.page;
+  queryParams.pageSize = val.limit;
+  getList();
 };
 
 // supplier 渚涘簲鍟嗘暟鎹�
 const columns = ref([
   { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 200 },
-  { prop: "category", label: "鐓ょ", minWidth: 120 },
   { prop: "unit", label: "鍗曚綅", minWidth: 150 },
-  { prop: "purchaseAmount", label: "閲囪喘鏁伴噺", minWidth: 120 },
-  { prop: "priceBeforeTax", label: "鍗曚环(绋庡墠)", minWidth: 150 },
-  { prop: "totalBeforeTax", label: "鎬讳环(绋庡墠)", minWidth: 100 },
-  { prop: "calorificValue", label: "鐑��", minWidth: 150 },
-  { prop: "registrant", label: "鐧昏浜�", minWidth: 100 },
+  { prop: "coal", label: "鐓ょ绫诲瀷", minWidth: 120 },
+  { prop: "purchaseQuantity", label: "閲囪喘鏁伴噺", minWidth: 100 },
+  { prop: "priceIncludingTax", label: "鍗曚环锛堝惈绋庯級", minWidth: 150 },
+  { prop: "totalPriceIncludingTax", label: "鎬讳环锛堝惈绋庯級", minWidth: 100 },
+  { prop: "taxRate", label: "绋庣巼", minWidth: 100 },
+  { prop: "priceExcludingTax", label: "涓嶅惈绋庡崟浠�", minWidth: 100 },
+  { prop: "registrantId", label: "鐧昏浜�", minWidth: 100 },
   { prop: "registrationDate", label: "鐧昏鏃ユ湡", minWidth: 100 },
 ]);
 
@@ -142,6 +149,7 @@
 };
 // 鏂板
 const handleAdd = () => {
+  console.log("鐐瑰嚮鏂板鎸夐挳");
   addOrEdit.value = "add";
   handleAddEdit();
 };
@@ -154,11 +162,24 @@
 // 鎵撳紑寮圭獥
 const openDialog = () => {
   if (addOrEdit.value === "edit") {
+    // 纭繚澶嶅埗涓�浠芥暟鎹紝閬垮厤鐩存帴寮曠敤
+    form.value = JSON.parse(JSON.stringify(form.value));
     dialogFormVisible.value = true;
     return;
   }
-  form.value = {};
-  dialogFormVisible.value = true;
+  // 鏂板缓鏃跺垵濮嬪寲琛ㄥ崟
+  form.value = {
+    supplierName: "",
+    category: "",
+    unit: "",
+    purchaseAmount: "",
+    priceBeforeTax: "",
+    totalBeforeTax: "",
+    calorificValue: "",
+    registrant: "",
+    registrationDate: new Date().toISOString().split('T')[0]
+  };  dialogFormVisible.value = true;
+  console.log("openDialog 璁剧疆 dialogFormVisible =", dialogFormVisible.value);
 };
 
 // 鎻愪氦琛ㄥ崟
@@ -221,36 +242,26 @@
   total.value = tableData.value.length;
   ElMessage.success("鎿嶄綔鎴愬姛");
 };
-const getList = () => {
+const getList = async () => {
   loading.value = true;
-  setTimeout(() => {
-    tableData.value = [
-      {
-        supplierName: "涓浗鐭虫补鍖栧伐鑲′唤鏈夐檺鍏徃",
-        category: "鐓�",
-        unit: "鍚�",
-        purchaseAmount: "1000",
-        priceBeforeTax: "100",
-        totalBeforeTax: "100000",
-        calorificValue: "5000",
-        registrant: "寮犱笁",
-        registrationDate: "2025-01-01",
-      },
-      {
-        supplierName: "涓浗涓煶鍖�",
-        category: "绮惧搧鐓�",
-        unit: "鍗冨厠",
-        purchaseAmount: "1000",
-        priceBeforeTax: "100",
-        totalBeforeTax: "100000",
-        calorificValue: "5000",
-        registrant: "鏉庡洓",
-        registrationDate: "2025-01-01",
-      }
-    ]
-    total.value = tableData.value.length;
+  try {
+    // 浼犻�掑垎椤靛弬鏁�
+    let res = await purchaseRegistration({
+      pageNum: pageNum.value,
+      pageSize: pageSize.value,
+      ...queryParams
+    });
+    console.log("API杩斿洖鏁版嵁:", res);
+    if (res && res.data) {
+      tableData.value = res.data.records || [];
+      total.value = res.data.total || 0;
+    }
+  } catch (error) {
+    console.error("鑾峰彇鏁版嵁澶辫触:", error);
+    ElMessage.error("鑾峰彇鏁版嵁澶辫触");
+  } finally {
     loading.value = false;
-  }, 500);
+  }
 };
 getList();
 </script>

--
Gitblit v1.9.3