config.data.ts
3.09 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
import { BasicColumn, FormSchema } from '/@/components/Table';
import { getOrganizationList } from '/@/api/system/system';
import { copyTransFun } from '/@/utils/fnUtils';
// 表格列数据
export const columns: BasicColumn[] = [
{
title: '姓名',
dataIndex: 'username',
width: 120,
},
{
title: '所属组织',
dataIndex: 'organizationId',
width: 160,
},
{
title: '手机',
dataIndex: 'phone',
width: 160,
},
{
title: '邮箱',
dataIndex: 'email',
width: 160,
},
{
title: '微信',
dataIndex: 'wechat',
width: 180,
},
{
title: '备注',
dataIndex: 'remark',
width: 120,
},
{
title: '添加时间',
dataIndex: 'createTime',
width: 180,
},
{
title: '更新时间',
dataIndex: 'updateTime',
width: 180,
},
];
// 查询字段
export const searchFormSchema: FormSchema[] = [
{
field: 'username',
label: '联系人姓名',
component: 'Input',
colProps: { span: 6 },
componentProps: {
placeholder: '请输入联系人姓名',
},
},
];
// 弹框配置项
export const formSchema: FormSchema[] = [
{
field: 'username',
label: '联系人姓名',
required: true,
component: 'Input',
componentProps: {
placeholder: '请输入联系人姓名',
},
},
{
field: 'organizationId',
label: '所属组织',
component: 'ApiTreeSelect',
componentProps: {
api: async () => {
const data = await getOrganizationList();
copyTransFun(data as any as any[]);
return data;
},
},
},
{
field: 'phone',
label: '手机号码',
component: 'Input',
componentProps: {
placeholder: '请输入手机号码',
},
rules: [
{
required: true,
validator: (_, value: string) => {
const reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if (value === '') {
return Promise.reject('请输入手机号码');
} else if (!reg.test(value)) {
return Promise.reject('请输入正确的手机号码');
}
return Promise.resolve();
},
trigger: 'blur',
},
],
},
{
field: 'email',
label: '电子邮箱',
component: 'Input',
componentProps: {
placeholder: '请输入电子邮箱',
},
rules: [
{
validator: (_, value: string) => {
const reg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
if (value === '') {
return Promise.resolve();
} else if (!reg.test(value)) {
return Promise.reject('请输入正确的电子邮箱');
}
return Promise.resolve();
},
trigger: 'blur',
},
],
},
{
field: 'wechat',
label: '微信',
component: 'Input',
componentProps: {
placeholder: '请输入微信号',
},
},
{
field: 'remark',
label: '备注',
component: 'InputTextArea',
componentProps: {
placeholder: '',
},
},
{
field: 'id',
label: '',
component: 'Input',
show: false,
},
];