fill.rule.data.ts
2.4 KB
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 { BasicColumn, FormSchema } from '/@/components/Table';
import { duplicateCheckDelay } from '/@/views/system/user/user.api';
export const columns: BasicColumn[] = [
{
title: '规则名称',
dataIndex: 'ruleName',
width: 200,
align: 'center',
},
{
title: '规则编码',
dataIndex: 'ruleCode',
width: 200,
align: 'center',
},
{
title: '规则实现类',
dataIndex: 'ruleClass',
width: 300,
align: 'center',
},
{
title: '规则参数',
dataIndex: 'ruleParams',
width: 200,
align: 'center',
},
];
export const searchFormSchema: FormSchema[] = [
{
field: 'ruleName',
label: '规则名称',
component: 'Input',
colProps: { span: 6 },
},
{
field: 'ruleCode',
label: '规则编码',
component: 'Input',
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
show: false,
},
{
field: 'ruleName',
label: '规则名称',
component: 'Input',
required: true,
colProps: { span: 24 },
},
{
field: 'ruleCode',
label: '规则编码',
component: 'Input',
colProps: { span: 24 },
dynamicDisabled: ({ values }) => {
return !!values.id;
},
dynamicRules: ({ model }) => {
return [
{
required: true,
validator: (_, value) => {
return new Promise((resolve, reject) => {
if (!value) {
return reject('请输入规则编码!');
}
let params = {
tableName: 'sys_fill_rule',
fieldName: 'rule_code',
fieldVal: value,
dataId: model.id,
};
duplicateCheckDelay(params)
.then((res) => {
res.success ? resolve() : reject('规则编码已存在!');
})
.catch((err) => {
reject(err.message || '校验失败');
});
});
},
},
];
},
},
{
field: 'ruleClass',
label: '规则实现类',
component: 'Input',
required: true,
colProps: { span: 24 },
},
{
field: 'ruleParams',
label: '规则参数',
colProps: { span: 24 },
component: 'JAddInput',
componentProps: {
min: 0,
},
},
];