From 6784281753fefac72e044cb52b0e3b22615841e4 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 11 七月 2025 13:27:01 +0800
Subject: [PATCH] 1.采购管理-来票登记的登记弹框表格加合计,小数点两位

---
 src/views/procurementManagement/invoiceEntry/index.vue |   80 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/src/views/procurementManagement/invoiceEntry/index.vue b/src/views/procurementManagement/invoiceEntry/index.vue
index c8ece35..6df5636 100644
--- a/src/views/procurementManagement/invoiceEntry/index.vue
+++ b/src/views/procurementManagement/invoiceEntry/index.vue
@@ -40,9 +40,11 @@
           total: pagination.total,
         }"
         :expand-row-keys="expandRowKeys"
+        :summaryMethod="summarizeMainTable"
+        :isShowSummary="true"
         @expand-change="expandChange"
         @selection-change="handleSelectionChange"
-        @pagination="onCurrentChange"
+        @pagination="changePage"
       >
         <template #expand="{ row }">
           <ExpandTable ref="expandTableRef" />
@@ -65,10 +67,11 @@
 
 <script setup>
 import { usePaginationApi } from "@/hooks/usePaginationApi";
-import { gePurchaseListPage } from "@/api/procurementManagement/invoiceEntry.js";
+import {delRegistration, gePurchaseListPage} from "@/api/procurementManagement/invoiceEntry.js";
 import { nextTick, onMounted, getCurrentInstance } from "vue";
 import ExpandTable from "./components/ExpandTable.vue";
 import Modal from "./components/Modal.vue";
+import {ElMessageBox} from "element-plus";
 
 defineOptions({
   name: "鏉ョエ鐧昏",
@@ -103,18 +106,22 @@
     {
       label: "閲囪喘璁㈠崟鍙�",
       prop: "purchaseContractNumber",
+      width:150
     },
     {
       label: "閿�鍞悎鍚屽彿",
       prop: "salesContractNo",
+      width:150
     },
     {
       label: "渚涘簲鍟嗗悕绉�",
       prop: "supplierName",
+      width:200
     },
     {
       label: "椤圭洰鍚嶇О",
       prop: "projectName",
+      width:150
     },
     {
       label: "褰曞叆浜�",
@@ -123,10 +130,12 @@
     {
       label: "褰曞叆鏃ユ湡",
       prop: "entryDate",
+      width:110
     },
     {
       label: "鍚堝悓閲戦(鍏�)",
       prop: "contractAmount",
+      width:200,
       formatData: (val) => {
         return val ? parseFloat(val).toFixed(2) : 0;
       },
@@ -134,6 +143,7 @@
     {
       label: "宸插紑绁ㄩ噾棰�(鍏�)",
       prop: "receiptPaymentAmount",
+      width:200,
       formatData: (val) => {
         return val ? parseFloat(val).toFixed(2) : 0;
       },
@@ -141,6 +151,7 @@
     {
       label: "寰呭紑绁ㄩ噾棰�(鍏�)",
       prop: "unReceiptPaymentAmount",
+      width:200,
       formatData: (val) => {
         return val ? parseFloat(val).toFixed(2) : 0;
       },
@@ -174,14 +185,67 @@
   modalRef.value.open(type, id);
 };
 
-const handleOut = () => {};
-const handleDelete = () => {};
-
-const expandChange = async (row, expandedRows) => {
-  await nextTick();
-  expandTableRef.value.getList(row.id);
+// 瀵煎嚭
+const handleOut = () => {
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			proxy.download("/purchase/registration/export", {}, "鏉ョエ鐧昏.xlsx");
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
+};
+// 鍒犻櫎
+const handleDelete = () => {
+	let ids = [];
+	if (selectedRows.value.length > 0) {
+		ids = selectedRows.value.map((item) => item.id);
+	} else {
+		proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+		return;
+	}
+	ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+		confirmButtonText: "纭",
+		cancelButtonText: "鍙栨秷",
+		type: "warning",
+	})
+		.then(() => {
+			delRegistration(ids).then((res) => {
+				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+				getList();
+			});
+		})
+		.catch(() => {
+			proxy.$modal.msg("宸插彇娑�");
+		});
 };
 
+const expandChange = async (row, expandedRows) => {
+  if (expandedRows.length > 0) {
+    await nextTick();
+    expandTableRef.value.getList(row.id);
+  }
+};
+
+const changePage = ({ page }) => {
+  pagination.currentPage = page;
+  onCurrentChange(page);
+};
+// 涓昏〃鍚堣鏂规硶
+const summarizeMainTable = (param) => {
+	return proxy.summarizeTable(
+		param,
+		["contractAmount", "receiptPaymentAmount", "unReceiptPaymentAmount"],
+		{
+			ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+			futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+		}
+	);
+};
 onMounted(() => {
   getTableData();
 });

--
Gitblit v1.9.3