4 天以前 10dd6590cea8f20eff21025ee71c8a614a48cdb7
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesTraceCrossRegionApi } from '#/api/mes/trace/crossregion';
 
import { getRangePickerDefaultProps } from '#/utils';
 
/** 预警类型选项 */
export const WARNING_TYPE_OPTIONS = [
  { label: '跨省窜货', value: 'CROSS_PROVINCE' },
  { label: '跨市窜货', value: 'CROSS_CITY' },
];
 
/** 预警状态选项 */
export const WARNING_STATUS_OPTIONS = [
  { label: '待处理', value: 10 },
  { label: '已处理', value: 20 },
  { label: '误报', value: 30 },
];
 
/** 判定粒度选项 */
export const WARNING_LEVEL_OPTIONS = [
  { label: '跨省判定', value: 'PROVINCE' },
  { label: '跨市判定', value: 'CITY' },
];
 
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'status',
      label: '状态',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: WARNING_STATUS_OPTIONS,
        placeholder: '请选择状态',
      },
    },
    {
      fieldName: 'warningType',
      label: '预警类型',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: WARNING_TYPE_OPTIONS,
        placeholder: '请选择预警类型',
      },
    },
    {
      fieldName: 'batchCode',
      label: '批次号',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入批次号',
      },
    },
    {
      fieldName: 'bagCode',
      label: '袋码',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入袋码',
      },
    },
    {
      fieldName: 'clientName',
      label: '经销商',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入经销商名称',
      },
    },
    {
      fieldName: 'eventTime',
      label: '预警时间',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        allowClear: true,
      },
    },
  ];
}
 
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<MesTraceCrossRegionApi.Warning>['columns'] {
  return [
    {
      field: 'warningNo',
      title: '预警编号',
      fixed: 'left',
      minWidth: 190,
    },
    {
      field: 'bagCode',
      title: '袋码',
      minWidth: 150,
      slots: { default: 'bagCode' },
    },
    {
      field: 'batchCode',
      title: '批次号',
      minWidth: 190,
    },
    {
      field: 'itemName',
      title: '物料名称',
      minWidth: 120,
    },
    {
      field: 'salesCode',
      title: '出库单号',
      minWidth: 150,
    },
    {
      field: 'clientName',
      title: '经销商',
      minWidth: 120,
    },
    {
      field: 'dealerProvince',
      title: '经销商地区',
      minWidth: 130,
      slots: { default: 'dealerRegion' },
    },
    {
      field: 'scanProvince',
      title: '扫码地区',
      minWidth: 130,
      slots: { default: 'scanRegion' },
    },
    {
      field: 'warningTypeName',
      title: '预警类型',
      width: 110,
      slots: { default: 'warningType' },
    },
    {
      field: 'statusName',
      title: '状态',
      width: 90,
      slots: { default: 'status' },
    },
    {
      field: 'eventTime',
      title: '预警时间',
      width: 170,
      formatter: 'formatDateTime',
    },
    {
      field: 'handleUserName',
      title: '处理人',
      width: 90,
    },
    {
      title: '操作',
      width: 120,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}