5 小时以前 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
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesTraceIntegrityApi } from '#/api/mes/trace/integrity';
 
/** 业务类型选项 */
export const BIZ_TYPE_OPTIONS = [
  { label: '生产批次', value: 'BATCH' },
  { label: '销售出库', value: 'SALES' },
  { label: '消费者扫码', value: 'SCAN' },
];
 
/** 业务类型中文名 */
export function getBizTypeLabel(bizType?: string): string {
  return (
    BIZ_TYPE_OPTIONS.find((opt) => opt.value === bizType)?.label || bizType || '-'
  );
}
 
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'bizType',
      label: '业务类型',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: BIZ_TYPE_OPTIONS,
        placeholder: '请选择业务类型',
      },
    },
    {
      fieldName: 'bizCode',
      label: '业务编码',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入批次号/出库单号/追溯码',
      },
    },
  ];
}
 
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<MesTraceIntegrityApi.Record>['columns'] {
  return [
    {
      field: 'bizType',
      title: '业务类型',
      width: 110,
      slots: { default: 'bizType' },
    },
    {
      field: 'bizId',
      title: '业务编号',
      width: 110,
    },
    {
      field: 'bizCode',
      title: '业务编码',
      minWidth: 220,
    },
    {
      field: 'contentHash',
      title: '内容摘要',
      minWidth: 300,
      slots: { default: 'contentHash' },
    },
    {
      field: 'eventTime',
      title: '摘要生成时间',
      width: 170,
      formatter: 'formatDateTime',
    },
  ];
}