fix(iot): adjust device identifier and name validation rules
This commit is contained in:
@@ -49,8 +49,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
},
|
||||
rules: z
|
||||
.string()
|
||||
.min(4, '设备标识长度不能少于 4 个字符')
|
||||
.max(32, '设备标识长度不能超过 32 个字符')
|
||||
.min(2, '设备标识长度不能少于 2 个字符')
|
||||
.max(12, '设备标识长度不能超过 12 个字符')
|
||||
.regex(
|
||||
/^[\w.\-:@]{4,32}$/,
|
||||
'支持英文字母、数字、下划线(_)、中划线(-)、点号(.)、半角冒号(:)和特殊字符@',
|
||||
@@ -83,8 +83,8 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||
.min(4, '设备名称长度限制为 4~64 个字符')
|
||||
.max(64, '设备名称长度限制为 4~64 个字符')
|
||||
.regex(
|
||||
/^[\u4E00-\u9FA5\u3040-\u30FF\w]+$/,
|
||||
'设备名称只能包含中文、英文字母、日文、数字和下划线(_)',
|
||||
/^[\u4E00-\u9FA5\u3040-\u30FF\w()()]+$/,
|
||||
'设备名称只能包含中文、英文字母、日文、数字、下划线(_)和括号(())',
|
||||
)
|
||||
.optional()
|
||||
.or(z.literal('')),
|
||||
|
||||
Reference in New Issue
Block a user