From 78af4e3d3b440f91deb0b1843fc0408cf53d614a Mon Sep 17 00:00:00 2001 From: icssoa <2570063477@qq.com> Date: Tue, 23 May 2023 17:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/excel/components/export-btn.tsx | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/modules/excel/components/export-btn.tsx b/src/modules/excel/components/export-btn.tsx index 7b49cd8..2c29ecb 100644 --- a/src/modules/excel/components/export-btn.tsx +++ b/src/modules/excel/components/export-btn.tsx @@ -26,7 +26,7 @@ export default defineComponent({ maxExportLimit: Number // 最大导出条数,不传或者小于等于0为不限制 }, - setup(props) { + setup(props, { slots }) { // 加载状态 const loading = ref(false); @@ -40,18 +40,20 @@ export default defineComponent({ // 获取表格数据 function getData() { + const params = { + ...Crud.value?.paramsReplace(Crud.value.params), + maxExportLimit: props.maxExportLimit, + isExport: true + }; + if (typeof props.data === "function") { - return props.data(); + return props.data(params); } else { if (props.data) { return props.data; } else { return Crud.value?.service - .page({ - ...Crud.value?.paramsReplace(Crud.value.params), - maxExportLimit: props.maxExportLimit, - isExport: true - }) + .page(params) .then((res) => { return res.list.map((e) => { for (const i in e) { @@ -106,7 +108,7 @@ export default defineComponent({ // 表格列 const columns = props.columns.filter( - (e: any) => + (e) => !( e.hidden === true || ["selection", "expand", "index"].includes(e.type) || @@ -116,7 +118,7 @@ export default defineComponent({ ); // 字段 - const fields = columns.map((e: any) => e.prop).filter(Boolean); + const fields = columns.map((e) => e.prop).filter(Boolean); // 表头 const header = await getHeader(columns, fields); @@ -150,7 +152,7 @@ export default defineComponent({ return () => { return ( - 导出 + {slots.default ? slots.default() : "导出"} ); };