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
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { MdmItemApi } from '#/api/mdm/item';
|
| import { DICT_TYPE } from '@vben/constants';
| import { getDictOptions } from '@vben/hooks';
|
| import { getItemTypeSimpleList } from '#/api/mes/md/item/type';
|
| /** 物料选择弹窗搜索表单 */
| export function useMdmItemSelectGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'code',
| label: '物料编码',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入物料编码',
| },
| },
| {
| fieldName: 'name',
| label: '物料名称',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入物料名称',
| },
| },
| {
| fieldName: 'categoryId',
| label: '物料分类',
| component: 'ApiSelect',
| componentProps: {
| placeholder: '请选择物料分类',
| allowClear: true,
| api: async () => {
| const res = await getItemTypeSimpleList();
| return res || [];
| },
| labelField: 'name',
| valueField: 'id',
| },
| },
| {
| fieldName: 'status',
| label: '状态',
| component: 'Select',
| componentProps: {
| placeholder: '请选择状态',
| allowClear: true,
| options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
| },
| },
| ];
| }
|
| /** 物料选择弹窗列表字段 */
| export function useMdmItemSelectGridColumns(
| multiple = true,
| ): VxeTableGridOptions<MdmItemApi.Item>['columns'] {
| return [
| { type: multiple ? 'checkbox' : 'radio', width: 50 },
| {
| field: 'code',
| title: '物料编码',
| minWidth: 120,
| },
| {
| field: 'name',
| title: '物料名称',
| minWidth: 180,
| align: 'left',
| },
| {
| field: 'specification',
| title: '规格型号',
| minWidth: 150,
| align: 'left',
| },
| {
| field: 'categoryId',
| title: '物料分类',
| minWidth: 120,
| align: 'center',
| slots: { default: 'categoryId' },
| },
| {
| field: 'unitMeasureName',
| title: '单位',
| minWidth: 80,
| align: 'center',
| },
| {
| field: 'isBatchManaged',
| title: '批次管理',
| minWidth: 80,
| align: 'center',
| slots: { default: 'isBatchManaged' },
| },
| {
| field: 'warehouseName',
| title: '默认仓库',
| minWidth: 100,
| align: 'center',
| },
| ];
| }
|
|