gaoluyang
昨天 b64a0deae5b5d33f9e20671a68936b27f0b9b00b
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<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 { Tag } from 'ant-design-vue';
 
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { getUncompletedOrders } from '#/api/erp/purchase/statistics';
import { getSupplierSimpleList } from '#/api/erp/purchase/supplier';
import { getRangePickerDefaultProps } from '#/utils';
 
import type { VbenFormSchema } from '#/adapter/form';
 
defineOptions({ name: 'ErpPurchaseStatisticsUncompleted' });
 
/** 搜索表单 */
const formSchema: VbenFormSchema[] = [
  {
    fieldName: 'orderNo',
    label: '订单号',
    component: 'Input',
    componentProps: {
      placeholder: '请输入订单号',
      allowClear: true,
    },
  },
  {
    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: 'orderNo',
    title: '订单号',
    minWidth: 150,
  },
  {
    field: 'supplierName',
    title: '供应商',
    minWidth: 150,
  },
  {
    field: 'orderTime',
    title: '订单时间',
    minWidth: 160,
    formatter: 'formatDate',
  },
  {
    field: 'productNames',
    title: '产品信息',
    minWidth: 150,
    showOverflow: 'tooltip',
  },
  {
    field: 'orderAmount',
    title: '订单金额',
    minWidth: 120,
    formatter: 'formatAmount2',
  },
  {
    field: 'inAmount',
    title: '入库金额',
    minWidth: 120,
    formatter: 'formatAmount2',
  },
  {
    field: 'uncompletedAmount',
    title: '未完成金额',
    minWidth: 120,
    formatter: 'formatAmount2',
  },
  {
    field: 'daysOverdue',
    title: '超期天数',
    minWidth: 100,
    slots: { default: 'daysOverdue' },
  },
];
 
const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: {
    schema: formSchema,
  },
  gridOptions: {
    columns,
    height: 'auto',
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          return await getUncompletedOrders({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            ...formValues,
          });
        },
      },
    },
    rowConfig: {
      keyField: 'orderId',
      isHover: true,
    },
    toolbarConfig: {
      refresh: true,
      search: true,
    },
  } as VxeTableGridOptions<ErpPurchaseStatisticsApi.UncompletedOrder>,
});
</script>
 
<template>
  <Page auto-content-height>
    <Grid table-title="未完成订单跟踪">
      <template #daysOverdue="{ row }">
        <Tag v-if="row.daysOverdue > 0" color="error">
          已超期 {{ row.daysOverdue }} 天
        </Tag>
        <Tag v-else color="success">未超期</Tag>
      </template>
    </Grid>
  </Page>
</template>