From 84e3953ec23a393fdfdadb21463ed502a494e27f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 31 十月 2025 16:22:28 +0800
Subject: [PATCH] 采购管理-添加导出功能
---
src/views/procurementManagement/invoiceEntry/index.vue | 130 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 113 insertions(+), 17 deletions(-)
diff --git a/src/views/procurementManagement/invoiceEntry/index.vue b/src/views/procurementManagement/invoiceEntry/index.vue
index 6df2bb0..87e08e9 100644
--- a/src/views/procurementManagement/invoiceEntry/index.vue
+++ b/src/views/procurementManagement/invoiceEntry/index.vue
@@ -2,13 +2,37 @@
<div class="app-container">
<div class="search_form">
<el-form :model="filters" :inline="true">
- <el-form-item label="閲囪喘鍚堝悓鍙凤細">
+ <el-form-item label="渚涘簲鍟嗗悕绉�">
+ <el-input
+ v-model="filters.supplierName"
+ placeholder="璇疯緭鍏ュ悕绉版悳绱�"
+ clearable
+ prefix-icon="Search"
+ @change="getTableData"
+ />
+ </el-form-item>
+ <el-form-item label="閲囪喘璁㈠崟鍙凤細">
<el-input
v-model="filters.purchaseContractNumber"
placeholder="璇疯緭鍏�"
clearable
prefix-icon="Search"
@change="getTableData"
+ />
+ </el-form-item>
+
+ <el-form-item label="閿�鍞悎鍚屽彿">
+ <el-input
+ v-model="filters.salesContractNo"
+ placeholder="璇疯緭鍏ラ攢鍞悎鍚屽彿"
+ clearable
+ />
+ </el-form-item>
+ <el-form-item label="椤圭洰鍚嶇О">
+ <el-input
+ v-model="filters.projectName"
+ placeholder="璇疯緭鍏ラ」鐩悕绉�"
+ clearable
/>
</el-form-item>
<el-form-item>
@@ -21,10 +45,10 @@
<div class="actions">
<div></div>
<div>
+ <el-button @click="handleExport" style="margin-right: 10px">瀵煎嚭</el-button>
<el-button type="primary" @click="handleAdd('add')">
鏂板鐧昏
</el-button>
-<!-- <el-button @click="handleOut">瀵煎嚭</el-button>-->
<!-- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>-->
</div>
</div>
@@ -40,6 +64,8 @@
total: pagination.total,
}"
:expand-row-keys="expandRowKeys"
+ :summaryMethod="summarizeMainTable"
+ :isShowSummary="true"
@expand-change="expandChange"
@selection-change="handleSelectionChange"
@pagination="changePage"
@@ -59,16 +85,17 @@
</template>
</PIMTable>
</div>
- <Modal ref="modalRef"></Modal>
+ <Modal ref="modalRef" @refreshList="getTableData"></Modal>
</div>
</template>
<script setup>
import { usePaginationApi } from "@/hooks/usePaginationApi";
-import { gePurchaseListPage } from "@/api/procurementManagement/invoiceEntry.js";
-import { nextTick, onMounted, getCurrentInstance } from "vue";
+import {delRegistration, gePurchaseListPage} from "@/api/procurementManagement/invoiceEntry.js";
+import { nextTick, onMounted, getCurrentInstance, ref } from "vue";
import ExpandTable from "./components/ExpandTable.vue";
import Modal from "./components/Modal.vue";
+import {ElMessageBox} from "element-plus";
defineOptions({
name: "鏉ョエ鐧昏",
@@ -113,12 +140,12 @@
{
label: "渚涘簲鍟嗗悕绉�",
prop: "supplierName",
- width:240
+ width:300
},
{
label: "椤圭洰鍚嶇О",
prop: "projectName",
- width:150
+ width:400
},
{
label: "褰曞叆浜�",
@@ -127,28 +154,28 @@
{
label: "褰曞叆鏃ユ湡",
prop: "entryDate",
- width:100
+ width:110
},
{
label: "鍚堝悓閲戦(鍏�)",
prop: "contractAmount",
- width:150,
+ width:200,
formatData: (val) => {
return val ? parseFloat(val).toFixed(2) : 0;
},
},
{
- label: "宸插紑绁ㄩ噾棰�(鍏�)",
+ label: "宸叉潵绁ㄩ噾棰�(鍏�)",
prop: "receiptPaymentAmount",
- width:150,
+ width:200,
formatData: (val) => {
return val ? parseFloat(val).toFixed(2) : 0;
},
},
{
- label: "寰呭紑绁ㄩ噾棰�(鍏�)",
+ label: "寰呮潵绁ㄩ噾棰�(鍏�)",
prop: "unReceiptPaymentAmount",
- width:150,
+ width:200,
formatData: (val) => {
return val ? parseFloat(val).toFixed(2) : 0;
},
@@ -182,8 +209,66 @@
modalRef.value.open(type, id);
};
-const handleOut = () => {};
-const handleDelete = () => {};
+// 瀵煎嚭
+const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/purchase/registration/export", {}, "鏉ョエ鐧昏.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+// 瀵煎嚭閲囪喘鍙拌处
+const handleExport = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/purchase/ledger/exportOne", {}, "鏉ョエ鐧昏.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
+
+// 鍒犻櫎
+const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ // 鏂板鍒ゆ柇锛氬鏋滄湁閫変腑鐨勬暟鎹病鏈塼icketRegistrationId锛屾彁绀哄苟缁堟
+ const noTicket = selectedRows.value.some(item => !item.ticketRegistrationId);
+ if (noTicket) {
+ proxy.$modal.msgWarning("閲囪喘鍙拌处杩樻湭杩涜鏉ョエ鐧昏,鏃犳硶杩涜鍒犻櫎鎿嶄綔");
+ return;
+ }
+ ids = selectedRows.value.map((item) => item.ticketRegistrationId);
+ } 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) {
@@ -192,11 +277,22 @@
}
};
-const changePage = ({ page }) => {
+const changePage = ({ page, limit }) => {
pagination.currentPage = page;
+ pagination.pageSize = limit;
onCurrentChange(page);
};
-
+// 涓昏〃鍚堣鏂规硶
+const summarizeMainTable = (param) => {
+ return proxy.summarizeTable(
+ param,
+ ["contractAmount", "receiptPaymentAmount", "unReceiptPaymentAmount"],
+ {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ }
+ );
+};
onMounted(() => {
getTableData();
});
--
Gitblit v1.9.3