1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
| <script lang="ts" setup>
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { ErpPurchaseStatisticsApi } from '#/api/erp/purchase/statistics';
|
| import { Page } from '@vben/common-ui';
|
| import { useVbenVxeGrid } from '#/adapter/vxe-table';
| import { getSupplierStatistics } from '#/api/erp/purchase/statistics';
| import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
| import { getRangePickerDefaultProps } from '#/utils';
|
| import type { VbenFormSchema } from '#/adapter/form';
|
| defineOptions({ name: 'ErpPurchaseStatisticsSupplier' });
|
| /** 搜索表单 */
| const formSchema: VbenFormSchema[] = [
| {
| fieldName: 'supplierId',
| label: '供应商',
| component: 'ApiSelect',
| componentProps: {
| placeholder: '请选择供应商',
| allowClear: true,
| showSearch: true,
| api: getSupplierSimpleList,
| labelField: 'name',
| valueField: 'id',
| },
| },
| {
| fieldName: 'orderTime',
| label: '订单时间',
| component: 'RangePicker',
| componentProps: {
| ...getRangePickerDefaultProps(),
| allowClear: true,
| },
| },
| ];
|
| /** 列表字段 */
| const columns: VxeTableGridOptions['columns'] = [
| {
| field: 'supplierName',
| title: '供应商',
| minWidth: 150,
| },
| {
| field: 'orderCount',
| title: '订单数',
| minWidth: 100,
| formatter: 'formatAmount3',
| },
| {
| field: 'orderAmount',
| title: '订单金额',
| minWidth: 120,
| formatter: 'formatAmount2',
| },
| {
| field: 'inCount',
| title: '入库数',
| minWidth: 100,
| formatter: 'formatAmount3',
| },
| {
| field: 'inAmount',
| title: '入库金额',
| minWidth: 120,
| formatter: 'formatAmount2',
| },
| {
| field: 'returnCount',
| title: '退货数',
| minWidth: 100,
| formatter: 'formatAmount3',
| },
| {
| field: 'returnAmount',
| title: '退货金额',
| minWidth: 120,
| formatter: 'formatAmount2',
| },
| ];
|
| const [Grid, gridApi] = useVbenVxeGrid({
| formOptions: {
| schema: formSchema,
| },
| gridOptions: {
| columns,
| height: 'auto',
| keepSource: true,
| proxyConfig: {
| ajax: {
| query: async ({ page }, formValues) => {
| return await getSupplierStatistics({
| pageNo: page.currentPage,
| pageSize: page.pageSize,
| ...formValues,
| });
| },
| },
| },
| rowConfig: {
| keyField: 'supplierId',
| isHover: true,
| },
| toolbarConfig: {
| refresh: true,
| search: true,
| },
| } as VxeTableGridOptions<ErpPurchaseStatisticsApi.SupplierStatistics>,
| });
| </script>
|
| <template>
| <Page auto-content-height>
| <Grid table-title="供应商供货统计" />
| </Page>
| </template>
|
|