yangg 19 hours ago
parent
commit
5cfdb4a2f1
1 changed files with 32 additions and 7 deletions
  1. 32 7
      src/views/system/account/crud.tsx

+ 32 - 7
src/views/system/account/crud.tsx

@@ -78,8 +78,8 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 				width: 200,
 				buttons: {
 					view: { iconRight: 'View', type: 'text',show: true },
-					edit: { iconRight: 'Edit', type: 'text', show: false },//auth('account:Update')
-					remove: { iconRight: 'Delete', type: 'text', show: false },//auth('account:Delete')
+					edit: { iconRight: 'Edit', type: 'text', show: true },//auth('account:Update')
+					remove: { iconRight: 'Delete', type: 'text', show: true },//auth('account:Delete')
 				},
 			},
 			columns: {
@@ -105,7 +105,32 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					column: { show: false },
 					form: {
 						component: { placeholder: '请输入密码' },
-						rules: [{ required: true, message: '请输入密码' }],
+						rules: [{ required: true, message: '请输入密码' },
+							{
+								validator: (rule: any, value: string, callback: Function) => {
+									if (!value) {
+										callback();
+										return;
+									}
+									// 检查密码长度不少于8位
+									if (value.length < 8) {
+										callback(new Error('密码长度不能少于8位'));
+										return;
+									}
+									// 检查是否包含字母
+									const hasLetter = /[a-zA-Z]/.test(value);
+									// 检查是否包含数字
+									const hasNumber = /[0-9]/.test(value);
+									
+									if (!hasLetter || !hasNumber) {
+										callback(new Error('密码必须包含字母和数字'));
+										return;
+									}
+									callback();
+								},
+								trigger: 'blur'
+							}
+						],
 						show: true,
 						column: { show: false }
 					},
@@ -150,14 +175,14 @@ export const createCrudOptions = function ({ crudExpose }: CreateCrudOptionsProp
 					search: { show: true },
 					type: 'dict-select',
 					dict: dict({
-						url: '/api/platform/tenants/',
-						value: 'tenant_id',
+						url: '/api/platform-admin/tenants/',
+						value: 'id',
 						label: 'name',
-						getData: (url) => {
+						/* getData: (url) => {
 							return companyApi.GetList({ page: 1, limit: 20 }).then((res:any) => {
 								return res.data.results;
 							});
-						}
+						} */
 					}),
 				},
 				is_active: {