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
| import type { VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { MdmItemApi } from '#/api/mdm/item';
|
| import { h } from 'vue';
| import { Tag } from 'ant-design-vue';
|
| /** 物料选择弹窗搜索表单 */
| export function useMdmItemSelectGridFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'code',
| label: '物料编码',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入物料编码',
| },
| },
| {
| fieldName: 'name',
| label: '物料名称',
| component: 'Input',
| componentProps: {
| allowClear: true,
| placeholder: '请输入物料名称',
| },
| },
| {
| fieldName: 'itemType',
| label: '物料类型',
| component: 'Select',
| componentProps: {
| allowClear: true,
| placeholder: '请选择物料类型',
| options: [
| { label: '原料', value: 1 },
| { label: '半成品', value: 2 },
| { label: '成品', value: 3 },
| { label: '辅料', value: 4 },
| ],
| },
| },
| ];
| }
|
| /** 物料类型颜色映射 */
| const itemTypeMap: Record<number, { label: string; color: string }> = {
| 1: { label: '原料', color: 'green' },
| 2: { label: '半成品', color: 'orange' },
| 3: { label: '成品', color: 'blue' },
| 4: { label: '辅料', color: 'purple' },
| };
|
| /** 物料选择弹窗列表字段 */
| export function useMdmItemSelectGridColumns(
| multiple = true,
| ): VxeTableGridOptions<MdmItemApi.Item>['columns'] {
| return [
| { type: multiple ? 'checkbox' : 'radio', width: 50 },
| {
| field: 'code',
| title: '物料编码',
| width: 180,
| },
| {
| field: 'name',
| title: '物料名称',
| minWidth: 160,
| align: 'left',
| },
| {
| field: 'specification',
| title: '规格型号',
| minWidth: 140,
| align: 'left',
| },
| {
| field: 'unitMeasureName',
| title: '单位',
| width: 90,
| align: 'center',
| },
| {
| field: 'itemType',
| title: '物料类型',
| width: 110,
| align: 'center',
| formatter: ({ cellValue }: { cellValue: number }) => {
| const type = itemTypeMap[cellValue];
| return type ? type.label : '-';
| },
| },
| {
| field: 'isBatchManaged',
| title: '批次管理',
| width: 110,
| align: 'center',
| cellRender: {
| name: 'CellDict',
| props: { type: 'infra_boolean_string' },
| },
| },
| {
| field: 'createTime',
| title: '创建时间',
| width: 180,
| formatter: 'formatDateTime',
| },
| ];
| }
|
|