From 233910f43337818af1290a8907bde528a01a450a Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Thu, 23 Jan 2025 20:05:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=92=B1=E5=8C=85=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wallet/wallet-cz/index.vue | 30 ++++++++++++++++++++---- src/views/wallet/wallet-manage/index.vue | 24 ++++++++++++++++--- src/views/wallet/wallet-tk/index.vue | 27 +++++++++++++++++++-- src/views/wallet/wallet-xf/index.vue | 27 +++++++++++++++++++-- 4 files changed, 97 insertions(+), 11 deletions(-) diff --git a/src/views/wallet/wallet-cz/index.vue b/src/views/wallet/wallet-cz/index.vue index 6f89a8b..a999fbf 100644 --- a/src/views/wallet/wallet-cz/index.vue +++ b/src/views/wallet/wallet-cz/index.vue @@ -40,6 +40,8 @@ :data="state.dataList" v-loading="state.loading" border + :summary-method="getSummaries" + show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle" @@ -64,12 +66,17 @@ - + + + + - + @@ -90,7 +97,6 @@ - @@ -106,7 +112,7 @@ import { displayPrice } from "/@/utils/formatMoney" // 引入组件 const FormDialog = defineAsyncComponent(() => import("./form.vue")) // 定义查询字典 -const { wallet_type } = useDict("wallet_type") +const { wallet_type, wallet_biz } = useDict("wallet_type", "wallet_biz") // 定义变量内容 const formDialogRef = ref() // 搜索变量 @@ -134,6 +140,22 @@ const resetQuery = () => { getDataList() } +const getSummaries = (param: any) => { + const { columns, data } = param + const totalColumns = ["price", "balance"] + const totalRow = Array.from({ length: columns.length }) + columns.forEach((i: any, index: number) => { + if (totalColumns.includes(i.property)) { + const total = data + .filter((v: any) => v[i.property] != null) + .map((v: any) => v[i.property]) + .reduce((pren: number, next: number) => pren + next, 0) + totalRow[index] = displayPrice(total) + } + }) + return totalRow +} + // 导出excel const exportExcel = () => { downBlobFile( diff --git a/src/views/wallet/wallet-manage/index.vue b/src/views/wallet/wallet-manage/index.vue index a7c8901..912e32a 100644 --- a/src/views/wallet/wallet-manage/index.vue +++ b/src/views/wallet/wallet-manage/index.vue @@ -50,6 +50,8 @@ :data="state.dataList" v-loading="state.loading" border + :summary-method="getSummaries" + show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle" @@ -76,17 +78,17 @@ - + - + - + @@ -175,6 +177,22 @@ const exportExcel = () => { ) } +const getSummaries = (param: any) => { + const { columns, data } = param + const totalColumns = ["balance", "totalExpense", "totalRecharge"] + const totalRow = Array.from({ length: columns.length }) + columns.forEach((i: any, index: number) => { + if (totalColumns.includes(i.property)) { + const total = data + .filter((v: any) => v[i.property] != null) + .map((v: any) => v[i.property]) + .reduce((pren: number, next: number) => pren + next, 0) + totalRow[index] = displayPrice(total) + } + }) + return totalRow +} + // 多选事件 const selectionChangHandle = (objs: { id: string }[]) => { selectObjs.value = objs.map(({ id }) => id) diff --git a/src/views/wallet/wallet-tk/index.vue b/src/views/wallet/wallet-tk/index.vue index 89e7a41..6e285cb 100644 --- a/src/views/wallet/wallet-tk/index.vue +++ b/src/views/wallet/wallet-tk/index.vue @@ -40,6 +40,8 @@ :data="state.dataList" v-loading="state.loading" border + :summary-method="getSummaries" + show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle" @@ -64,7 +66,12 @@ - + + + + @@ -113,7 +120,7 @@ import { displayPrice } from "/@/utils/formatMoney" // 引入组件 const FormDialog = defineAsyncComponent(() => import("./form.vue")) // 定义查询字典 -const { wallet_type } = useDict("wallet_type") +const { wallet_type, wallet_biz } = useDict("wallet_type", "wallet_biz") // 定义变量内容 const formDialogRef = ref() // 搜索变量 @@ -160,6 +167,22 @@ const exportExcel = () => { ) } +const getSummaries = (param: any) => { + const { columns, data } = param + const totalColumns = ["price"] + const totalRow = Array.from({ length: columns.length }) + columns.forEach((i: any, index: number) => { + if (totalColumns.includes(i.property)) { + const total = data + .filter((v: any) => v[i.property] != null) + .map((v: any) => v[i.property]) + .reduce((pren: number, next: number) => pren + next, 0) + totalRow[index] = displayPrice(total) + } + }) + return totalRow +} + // 多选事件 const selectionChangHandle = (objs: { id: string }[]) => { selectObjs.value = objs.map(({ id }) => id) diff --git a/src/views/wallet/wallet-xf/index.vue b/src/views/wallet/wallet-xf/index.vue index 56a237f..f0a10ec 100644 --- a/src/views/wallet/wallet-xf/index.vue +++ b/src/views/wallet/wallet-xf/index.vue @@ -40,6 +40,8 @@ :data="state.dataList" v-loading="state.loading" border + :summary-method="getSummaries" + show-summary :cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle" @selection-change="selectionChangHandle" @@ -64,7 +66,12 @@ - + + + + @@ -114,7 +121,7 @@ const { push } = useRouter() // 引入组件 const FormDialog = defineAsyncComponent(() => import("./form.vue")) // 定义查询字典 -const { wallet_type } = useDict("wallet_type") +const { wallet_type, wallet_biz } = useDict("wallet_type", "wallet_biz") // 定义变量内容 const formDialogRef = ref() // 搜索变量 @@ -161,6 +168,22 @@ const selectionChangHandle = (objs: { id: string }[]) => { multiple.value = !objs.length } +const getSummaries = (param: any) => { + const { columns, data } = param + const totalColumns = ["price"] + const totalRow = Array.from({ length: columns.length }) + columns.forEach((i: any, index: number) => { + if (totalColumns.includes(i.property)) { + const total = data + .filter((v: any) => v[i.property] != null) + .map((v: any) => v[i.property]) + .reduce((pren: number, next: number) => pren + next, 0) + totalRow[index] = displayPrice(total) + } + }) + return totalRow +} + // 删除操作 const handleDelete = async (ids: string[]) => { try {