From 183d13a62353fc7594417068f5d2709c09cdb523 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 09 六月 2025 14:05:46 +0800
Subject: [PATCH] 回款登记加上子表格
---
src/views/salesManagement/receiptPayment/index.vue | 91 +++++++++++++++++++++++++++++++--------------
1 files changed, 63 insertions(+), 28 deletions(-)
diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue
index c37883b..c86117e 100644
--- a/src/views/salesManagement/receiptPayment/index.vue
+++ b/src/views/salesManagement/receiptPayment/index.vue
@@ -23,18 +23,41 @@
:row-key="row => row.id"
show-summary
:summary-method="summarizeMainTable"
+ :expand-row-keys="expandedRowKeys"
+ @expand-change="expandChange"
height="calc(100vh - 18.5em)">
<el-table-column align="center" type="selection" width="55" />
+ <el-table-column type="expand">
+ <template #default="props">
+ <el-table :data="props.row.children" border
+ show-summary
+ :summary-method="summarizeChildrenTable">
+ <el-table-column align="center" label="搴忓彿" type="index" width="60" />
+ <el-table-column label="浜у搧澶х被" prop="productCategory" />
+ <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
+ <el-table-column label="鍗曚綅" prop="unit" width="70"/>
+ <el-table-column label="鏁伴噺" prop="quantity" width="70"/>
+ <el-table-column label="绋庣巼" prop="taxRate" width="70" />
+ <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
+ <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
+ <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
+ <el-table-column label="寮�绁ㄦ暟" prop="invoiceNum" />
+ <el-table-column label="寮�绁ㄩ噾棰�(鍏�)" prop="invoiceAmount" :formatter="formattedNumber" />
+ <el-table-column label="鏈紑绁ㄦ暟" prop="noInvoiceNum" />
+ <el-table-column label="鏈紑绁ㄩ噾棰�(鍏�)" prop="noInvoiceAmount" :formatter="formattedNumber"/>
+ </el-table>
+ </template>
+ </el-table-column>
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
<el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" show-overflow-tooltip/>
<el-table-column label="瀹㈡埛鍚堝悓鍙�" prop="customerContractNo" show-overflow-tooltip/>
<el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" show-overflow-tooltip/>
<el-table-column label="浜у搧澶х被" prop="productCategory" show-overflow-tooltip/>
<el-table-column label="鍙戠エ鍙�" prop="invoiceNo" show-overflow-tooltip/>
- <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip/>
+ <el-table-column label="鍙戠エ閲戦(鍏�)" prop="invoiceTotal" show-overflow-tooltip :formatter="formattedNumber"/>
<el-table-column label="绋庣巼" prop="taxRate" show-overflow-tooltip/>
- <el-table-column label="鍥炴閲戦(鍏�)" prop="receiptPaymentAmountTotal" show-overflow-tooltip/>
- <el-table-column label="寰呭洖娆鹃噾棰�(鍏�)" prop="noReceiptAmount" show-overflow-tooltip/>
+ <el-table-column label="鍥炴閲戦(鍏�)" prop="receiptPaymentAmountTotal" show-overflow-tooltip :formatter="formattedNumber"/>
+ <el-table-column label="寰呭洖娆鹃噾棰�(鍏�)" prop="noReceiptAmount" show-overflow-tooltip :formatter="formattedNumber"/>
</el-table>
<pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" :page="page.current"
:limit="page.size" @pagination="paginationChange" />
@@ -123,7 +146,7 @@
import {
receiptPaymentSaveOrUpdate,
bindInvoiceNoRegPage,
- invoiceInfo
+ invoiceInfo, receiptPaymentHistoryListNoPage
} from "../../../api/salesManagement/receiptPayment.js";
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
@@ -133,9 +156,10 @@
const tableLoading = ref(false)
const page = reactive({
current: 1,
- size: 10,
+ size: 100,
})
const total = ref(0)
+const expandedRowKeys = ref([])
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const dialogFormVisible = ref(false)
@@ -169,15 +193,18 @@
const { searchForm, form, rules } = toRefs(data)
const { receipt_payment_type } = proxy.useDict("receipt_payment_type")
+const formattedNumber = (row, column, cellValue) => {
+ return parseFloat(cellValue).toFixed(2);
+};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
const handleQuery = () => {
page.current = 1
getList()
}
-const paginationChange = ({ current, limit }) => {
- page.current = current;
- page.size = limit;
+const paginationChange = (obj) => {
+ page.current = obj.page;
+ page.size = obj.limit;
getList()
}
const getList = () => {
@@ -190,33 +217,41 @@
tableLoading.value = false
})
}
+// 灞曞紑琛�
+const expandChange = (row, expandedRows) => {
+ if (expandedRows.length > 0) {
+ expandedRowKeys.value = []
+ try {
+ receiptPaymentHistoryListNoPage({invoiceLedgerId: row.id,
+ type: 1 }).then(res => {
+ const index = tableData.value.findIndex(item => item.id === row.id);
+ if (index > -1) {
+ tableData.value[index].children = res;
+ }
+ expandedRowKeys.value.push(row.id)
+ })
+ } catch (error) {
+ console.log(error)
+ }
+ } else {
+ expandedRowKeys.value = []
+ }
+}
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
selectedRows.value = selection
}
// 涓昏〃鍚堣鏂规硶
const summarizeMainTable = (param) => {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '鍚堣';
- return;
- }
- const prop = column.property;
- if (['invoiceAmount','receiptPaymentAmount'].includes(prop)) {
- const values = data.map(item => Number(item[prop]));
- if (!values.every(value => isNaN(value))) {
- sums[index] = values.reduce((acc, val) => (!isNaN(val) ? acc + val : acc), 0);
- } else {
- sums[index] = '';
- }
- } else {
- sums[index] = '';
- }
- })
- return sums;
+ return proxy.summarizeTable(param, ['invoiceTotal', 'receiptPaymentAmountTotal', 'noReceiptAmount'], {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ });
};
+// 瀛愯〃鍚堣鏂规硶
+const summarizeChildrenTable = (param) => {
+ return proxy.summarizeTable(param, ['taxInclusiveUnitPrice', 'taxInclusiveTotalPrice', 'taxExclusiveTotalPrice','invoiceNum','invoiceAmount','noInvoiceNum','noInvoiceAmount']);
+}
// 鎵撳紑寮规
const openForm = () => {
form.value = {}
--
Gitblit v1.9.3