feat: 添加账户统计

This commit is contained in:
danial
2025-03-15 22:42:41 +08:00
parent 4ee0b09781
commit 1dade7005f

View File

@@ -3,6 +3,7 @@ import type {
KamiApiCardInfoWalmartV1AccountDailySummaryRecord,
ApiCardInfoWalmartAccountDailySummaryGetPageSizeEnum
} from '@/api/generated';
import { handleDownLoadFile } from '@/api/utils';
import type { Pagination } from '@/types/global';
import {
Button,
@@ -13,6 +14,7 @@ import {
Form,
FormItem,
Input,
Message,
Row,
Space,
Table,
@@ -27,7 +29,7 @@ interface IformData {
}
export default defineComponent({
name: 'userManagementSummary',
name: 'walmartSummary',
setup() {
const generateFormModel = (): IformData => {
return {
@@ -36,6 +38,7 @@ export default defineComponent({
date: null
};
};
const formModel = ref(generateFormModel());
const basePagination: Pagination = {
current: 1,
@@ -88,6 +91,26 @@ export default defineComponent({
[]
);
const downloadExcel = () => {
apiClient
.apiCardInfoWalmartAccountSummaryDownloadGet(
pagination.current,
pagination.pageSize as ApiCardInfoWalmartAccountDailySummaryGetPageSizeEnum,
formModel.value.accountId,
formModel.value.date,
{
responseType: 'blob'
}
)
.then(res => {
// 判断是不是blob类型
if (!res.data) {
Message.error('下载账户统计明细失败');
return;
}
handleDownLoadFile(res.data as any, '沃尔玛账户统计明细.xlsx');
});
};
const fetchData = (
page: Pagination = pagination,
params: IformData = formModel.value
@@ -133,27 +156,40 @@ export default defineComponent({
</Form>
</Col>
<Divider style='height: 42px' direction='vertical' />
<Col flex='172px' style='text-align: right'>
<Space direction='horizontal' size={18}>
<Row>
<Col flex='172px' style='text-align: right'>
<Space direction='horizontal' size={18}>
<Button
type='primary'
onClick={() => fetchData()}
v-slots={{
icon: () => <icon-search />
}}
>
</Button>
<Button
onClick={reset}
v-slots={{
icon: () => <icon-refresh />
}}
>
</Button>
</Space>
</Col>
<Col>
<Button
type='primary'
onClick={() => fetchData()}
onClick={() => downloadExcel()}
v-slots={{
icon: () => <icon-search />
icon: () => <icon-download />
}}
>
</Button>
<Button
onClick={reset}
v-slots={{
icon: () => <icon-refresh />
}}
>
</Button>
</Space>
</Col>
</Col>
</Row>
</Row>
<Table
columns={columns}