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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
| import type { FormSchemaGetter } from '#/adapter/form';
| import type { VxeGridProps } from '#/adapter/vxe-table';
|
| import { getPopupContainer } from '@vben/utils';
|
| import dayjs from 'dayjs';
|
| import { z } from '#/adapter/form';
|
| export const querySchema: FormSchemaGetter = () => [
| {
| component: 'Input',
| fieldName: 'tenantId',
| label: '租户编号',
| },
| {
| component: 'Input',
| fieldName: 'companyName',
| label: '租户名称',
| },
| {
| component: 'Input',
| fieldName: 'contactUserName',
| label: '联系人',
| },
| {
| component: 'Input',
| fieldName: 'contactPhone',
| label: '联系电话',
| },
| ];
|
| export const columns: VxeGridProps['columns'] = [
| { type: 'checkbox', width: 60 },
| {
| title: '租户编号',
| field: 'tenantId',
| },
| {
| title: '租户名称',
| field: 'companyName',
| },
| {
| title: '联系人',
| field: 'contactUserName',
| },
| {
| title: '联系电话',
| field: 'contactPhone',
| },
| {
| title: '到期时间',
| field: 'expireTime',
| formatter: ({ cellValue }) => {
| if (!cellValue) {
| return '无期限';
| }
| return cellValue;
| },
| },
| {
| title: '租户状态',
| field: 'status',
| slots: { default: 'status' },
| },
| {
| field: 'action',
| fixed: 'right',
| slots: { default: 'action' },
| title: '操作',
| width: 200,
| },
| ];
|
| const defaultExpireTime = dayjs()
| .add(365, 'days')
| .startOf('day')
| .format('YYYY-MM-DD HH:mm:ss');
|
| export const drawerSchema: FormSchemaGetter = () => [
| {
| component: 'Input',
| dependencies: {
| show: () => false,
| triggerFields: [''],
| },
| fieldName: 'id',
| label: 'id',
| },
| {
| component: 'Input',
| dependencies: {
| show: () => false,
| triggerFields: [''],
| },
| fieldName: 'tenantId',
| label: 'tenantId',
| },
| {
| component: 'Divider',
| componentProps: {
| orientation: 'center',
| },
| fieldName: 'divider1',
| hideLabel: true,
| renderComponentContent: () => ({
| default: () => '基本信息',
| }),
| },
| {
| component: 'Input',
| fieldName: 'companyName',
| label: '企业名称',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'contactUserName',
| label: '联系人',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'contactPhone',
| label: '联系电话',
| rules: z
| .string()
| .regex(/^1[3-9]\d{9}$/, { message: '请输入正确的联系电话' }),
| },
| {
| component: 'Divider',
| componentProps: {
| orientation: 'center',
| },
| fieldName: 'divider2',
| hideLabel: true,
| renderComponentContent: () => ({
| default: () => '管理员信息',
| }),
| dependencies: {
| if: (values) => !values?.tenantId,
| triggerFields: ['tenantId'],
| },
| },
| {
| component: 'Input',
| fieldName: 'username',
| label: '用户账号',
| rules: 'required',
| dependencies: {
| if: (values) => !values?.tenantId,
| triggerFields: ['tenantId'],
| },
| },
| {
| component: 'InputPassword',
| fieldName: 'password',
| label: '用户密码',
| rules: 'required',
| dependencies: {
| if: (values) => !values?.tenantId,
| triggerFields: ['tenantId'],
| },
| },
| {
| component: 'Divider',
| componentProps: {
| orientation: 'center',
| },
| fieldName: 'divider3',
| hideLabel: true,
| renderComponentContent: () => ({
| default: () => '租户设置',
| }),
| },
| {
| component: 'Select',
| componentProps: {
| getPopupContainer,
| },
| fieldName: 'packageId',
| label: '租户套餐',
| rules: 'selectRequired',
| },
| {
| component: 'DatePicker',
| componentProps: {
| format: 'YYYY-MM-DD HH:mm:ss',
| showTime: true,
| valueFormat: 'YYYY-MM-DD HH:mm:ss',
| getPopupContainer,
| },
| defaultValue: defaultExpireTime,
| fieldName: 'expireTime',
| help: `已经设置过期时间不允许重置为'无期限'\n即在开通时未设置无期限 以后都不允许设置`,
| label: '过期时间',
| },
| {
| component: 'InputNumber',
| componentProps: {
| min: -1,
| },
| defaultValue: -1,
| fieldName: 'accountCount',
| help: '-1不限制用户数量',
| label: '用户数量',
| renderComponentContent(model) {
| return {
| addonBefore: () =>
| model.accountCount === -1 ? '不限制数量' : '输入数量',
| };
| },
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'domain',
| help: '可填写域名/端口 填写域名如: www.test.com 或者 www.test.com:8080 填写ip:端口如: 127.0.0.1:8080',
| label: '绑定域名',
| renderComponentContent() {
| return {
| addonBefore: () => 'http(s)://',
| };
| },
| rules: z
| .string()
| .refine(
| (domain) =>
| !(domain.startsWith('http://') || domain.startsWith('https://')),
| { message: '请输入正确的域名, 不需要http(s)' },
| )
| .optional(),
| },
| {
| component: 'Divider',
| componentProps: {
| orientation: 'center',
| },
| fieldName: 'divider4',
| hideLabel: true,
| renderComponentContent: () => ({
| default: () => '企业信息',
| }),
| },
| {
| component: 'Input',
| fieldName: 'address',
| label: '企业地址',
| },
| {
| component: 'Input',
| fieldName: 'licenseNumber',
| label: '企业代码',
| },
| {
| component: 'Textarea',
| fieldName: 'intro',
| formItemClass: 'items-start',
| label: '企业介绍',
| },
| {
| component: 'Textarea',
| fieldName: 'remark',
| formItemClass: 'items-start',
| label: '备注',
| },
| ];
|
|