From feb53a39cb88c7f807c287b18d8008bb149b5200 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期五, 13 六月 2025 17:40:08 +0800 Subject: [PATCH] 小数点 --- src/views/salesManagement/receiptPayment/index.vue | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 115 insertions(+), 3 deletions(-) diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue index 7a37672..8057675 100644 --- a/src/views/salesManagement/receiptPayment/index.vue +++ b/src/views/salesManagement/receiptPayment/index.vue @@ -23,8 +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="receiptPaymentDate" /> + <el-table-column label="鍥炴閲戦" prop="receiptPaymentAmount"> + <template #default="scope"> + <el-input v-model="scope.row.receiptPaymentAmount" :disabled="!scope.row.editType"></el-input> + </template> + </el-table-column> + <el-table-column label="鍥炴鏂瑰紡" prop="receiptPaymentType" > + <template #default="scope"> + <el-select v-model="scope.row.receiptPaymentType" placeholder="璇烽�夋嫨" clearable :disabled="!scope.row.editType"> + <el-option v-for="item in receipt_payment_type" :key="item.value" :label="item.label" :value="item.value"/> + </el-select> + </template> + </el-table-column> + <el-table-column label="鐧昏浜�" prop="registrant" /> + <el-table-column label="鐧昏鏃ユ湡" prop="createTime" /> + <el-table-column label="鎿嶄綔" width="150"> + <template #default="scope"> + <el-button link type="primary" size="small" @click="changeEditType(scope.row)" v-if="!scope.row.editType">缂栬緫</el-button> + <el-button link type="primary" size="small" @click="saveReceiptPayment(scope.row)" v-if="scope.row.editType">淇濆瓨</el-button> + <el-button link type="primary" size="small" @click="delReceiptRecord(scope.row)">鍒犻櫎</el-button> + </template> + </el-table-column> + </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/> @@ -123,9 +156,12 @@ import { receiptPaymentSaveOrUpdate, bindInvoiceNoRegPage, - invoiceInfo + invoiceInfo, + receiptPaymentHistoryListNoPage, + receiptPaymentDel } from "../../../api/salesManagement/receiptPayment.js"; import useUserStore from '@/store/modules/user' +import { ElMessage,ElMessageBox } from 'element-plus' const userStore = useUserStore() const { proxy } = getCurrentInstance() const tableData = ref([]) @@ -133,9 +169,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) @@ -184,6 +221,7 @@ getList() } const getList = () => { + expandedRowKeys.value = [] tableLoading.value = true bindInvoiceNoRegPage({...searchForm.value, ...page}).then(res => { tableLoading.value = false @@ -193,9 +231,35 @@ 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) { + if(res?.length > 0) { + res.forEach(item => { + item.editType = false + }) + } + tableData.value[index].children = res; + } + expandedRowKeys.value.push(row.id) + }) + } catch (error) { + console.log(error) + } + } else { + expandedRowKeys.value = [] + } +} // 琛ㄦ牸閫夋嫨鏁版嵁 const handleSelectionChange = (selection) => { - selectedRows.value = selection + console.log('selection', selection) + selectedRows.value = selection.filter(item => item.customerContractNo !== null); } // 涓昏〃鍚堣鏂规硶 const summarizeMainTable = (param) => { @@ -204,6 +268,10 @@ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁� }); }; +// 瀛愯〃鍚堣鏂规硶 +const summarizeChildrenTable = (param) => { + return proxy.summarizeTable(param, ['receiptPaymentAmount']); +} // 鎵撳紑寮规 const openForm = () => { form.value = {} @@ -242,6 +310,50 @@ proxy.resetForm("formRef") dialogFormVisible.value = false } + +// 鍒犻櫎鍥炴璁板綍 +const delReceiptRecord = (row) => { + console.log('row',row) + ElMessageBox.confirm("纭鍒犻櫎璇ヨ褰曞悧锛�", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(async () => { + try { + let ids = [] + ids.push(row.id) + await receiptPaymentDel(ids); + ElMessage.success("鍒犻櫎鎴愬姛"); + getList(); + } catch (error) { + console.error("鍒犻櫎澶辫触:", error); + ElMessage.error("鍒犻櫎澶辫触"); + } + }) + .catch(() => { + ElMessage.info("宸插彇娑堝垹闄�"); + }); + +} + +// 缂栬緫淇敼鐘舵�� +const changeEditType = (row) => { + row.editType = !row.editType +} + +// 淇濆瓨鍥炴璁板綍 +const saveReceiptPayment = (row) => { + let updateData = { + id:row.id, + receiptPaymentType: row.receiptPaymentType, + receiptPaymentAmount: row.receiptPaymentAmount + } + receiptPaymentSaveOrUpdate(updateData).then(res => { + row.editType = !row.editType + }) +} + getList() </script> -- Gitblit v1.9.3