云
7 小时以前 fb4db4ae9b6a7f113ba049f6789e6916c0dcc276
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
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesProPalletApi } from '#/api/mes/pro/pallet';
 
import { DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
 
import { getRangePickerDefaultProps } from '#/utils';
 
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    { fieldName: 'businessCode', label: '业务码', component: 'Input', componentProps: { allowClear: true, placeholder: '请输入出入库业务码' } },
    {
      fieldName: 'code',
      label: '托盘码',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入托盘码',
      },
    },
    {
      fieldName: 'batchCode',
      label: '批次号',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入批次号',
      },
    },
    {
      fieldName: 'status',
      label: '托盘状态',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: getDictOptions(DICT_TYPE.MES_PRO_PALLET_STATUS, 'number'),
        placeholder: '请选择托盘状态',
      },
    },
    {
      fieldName: 'createTime',
      label: '创建时间',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        allowClear: true,
      },
    },
  ];
}
 
/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<MesProPalletApi.Pallet>['columns'] {
  return [
    { type: 'checkbox', width: 50 },
    { field: 'businessCode', title: '业务码(出入库)', minWidth: 210 },
    {
      field: 'code',
      title: '托盘码',
      fixed: 'left',
      minWidth: 210,
      slots: { default: 'code' },
    },
    { field: 'itemName', title: '品种名称', minWidth: 150 },
    { field: 'itemCode', title: '品种编码', minWidth: 150 },
    {
      field: 'palletNo',
      title: '托盘序号',
      width: 90,
    },
    {
      field: 'batchCode',
      title: '批次号',
      minWidth: 190,
      slots: { default: 'batchCode' },
    },
    {
      field: 'bagCount',
      title: '已绑袋码数量',
      width: 120,
    },
    { field: 'inboundTime', title: '入库状态', width: 100, formatter: ({ cellValue }) => cellValue ? '已入库' : '未入库' },
    {
      field: 'status',
      title: '托盘状态',
      width: 100,
      cellRender: {
        name: 'CellDict',
        props: { type: DICT_TYPE.MES_PRO_PALLET_STATUS },
      },
    },
    {
      field: 'remark',
      title: '备注',
      minWidth: 140,
    },
    {
      field: 'createTime',
      title: '创建时间',
      width: 170,
      formatter: 'formatDateTime',
    },
    {
      title: '操作',
      width: 350,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}