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
| import type { VbenFormApi, VbenFormSchema } from '#/adapter/form';
| import type { VxeTableGridOptions } from '#/adapter/vxe-table';
| import type { MesQcIndicatorResultApi } from '#/api/mes/qc/indicatorresult';
|
| import { h } from 'vue';
|
| import { MesAutoCodeRuleCode } from '../../../../../packages/constants/src';
|
| import { Button } from 'ant-design-vue';
|
| import { generateAutoCode } from '#/api/mes/md/autocode/record';
|
| /** 表单类型 */
| export type FormType = 'create' | 'update';
|
| /** 新增/修改检测结果的表单 */
| export function useQcIndicatorResultFormSchema(
| formApi?: VbenFormApi,
| ): VbenFormSchema[] {
| return [
| {
| fieldName: 'id',
| component: 'Input',
| dependencies: {
| triggerFields: [''],
| show: () => false,
| },
| },
| {
| fieldName: 'code',
| label: '样品编号',
| component: 'Input',
| componentProps: {
| placeholder: '请输入样品编号',
| },
| rules: 'required',
| suffix: () =>
| h(
| Button,
| {
| type: 'default',
| onClick: async () => {
| const code = await generateAutoCode(
| MesAutoCodeRuleCode.QC_INDICATOR_RESULT_CODE,
| );
| await formApi?.setFieldValue('code', code);
| },
| },
| { default: () => '生成' },
| ),
| },
| {
| fieldName: 'sn',
| label: '物资 SN',
| component: 'Input',
| componentProps: {
| placeholder: '请输入物资 SN',
| },
| },
| {
| fieldName: 'remark',
| label: '备注',
| component: 'Textarea',
| formItemClass: 'col-span-2',
| componentProps: {
| placeholder: '请输入备注',
| rows: 2,
| },
| },
| ];
| }
|
| /** 检测结果列表的字段 */
| export function useQcIndicatorResultGridColumns(): VxeTableGridOptions<MesQcIndicatorResultApi.IndicatorResult>['columns'] {
| return [
| {
| field: 'code',
| title: '样品编号',
| width: 200,
| },
| {
| field: 'sn',
| title: '物资SN',
| minWidth: 200,
| },
| {
| field: 'remark',
| title: '备注',
| minWidth: 200,
| },
| {
| title: '操作',
| width: 150,
| fixed: 'right',
| slots: { default: 'actions' },
| },
| ];
| }
|
|