You need to sign in or sign up before continuing.
|
@@ -2,10 +2,13 @@ import { ValidatorRule } from 'ant-design-vue/lib/form/interface'; |
|
@@ -2,10 +2,13 @@ import { ValidatorRule } from 'ant-design-vue/lib/form/interface'; |
|
2
|
import { i18n } from '/@/locales/setupI18n';
|
2
|
import { i18n } from '/@/locales/setupI18n';
|
|
3
|
export { default as ThingsModelForm } from './index.vue';
|
3
|
export { default as ThingsModelForm } from './index.vue';
|
|
4
|
|
4
|
|
|
5
|
-export const validateTCPCustomCommand: ValidatorRule['validator'] = (_rule, value) => {
|
5
|
+export const validateTCPCustomCommand: ValidatorRule['validator'] = (_rule, value = '') => {
|
|
6
|
const reg = /^[\s0-9a-fA-F]+$/;
|
6
|
const reg = /^[\s0-9a-fA-F]+$/;
|
|
7
|
- if (reg.test(value)) return Promise.resolve();
|
|
|
|
8
|
- return Promise.reject(i18n.global.t('validator.hex'));
|
7
|
+ if (!reg.test(value)) return Promise.reject(i18n.global.t('validator.hex'));
|
|
|
|
8
|
+
|
|
|
|
9
|
+ if (value?.length % 2) return Promise.reject(i18n.global.t('validator.hexLength'));
|
|
|
|
10
|
+
|
|
|
|
11
|
+ return Promise.resolve();
|
|
9
|
};
|
12
|
};
|
|
10
|
|
13
|
|
|
11
|
export const trimBlankSpace = (string: string) => string.replace(/(?!^)(?=(\w{2})+$)/g, '');
|
14
|
export const trimBlankSpace = (string: string) => string.replace(/(?!^)(?=(\w{2})+$)/g, '');
|
|
@@ -7,4 +7,5 @@ export default { |
|
@@ -7,4 +7,5 @@ export default { |
|
7
|
passwordRegularization:
|
7
|
passwordRegularization:
|
|
8
|
'Passwords must contain uppercase and lowercase letters, numbers, and special characters, with a minimum of 8 characters and a maximum of 30 characters',
|
8
|
'Passwords must contain uppercase and lowercase letters, numbers, and special characters, with a minimum of 8 characters and a maximum of 30 characters',
|
|
9
|
phone: 'Please enter the correct mobile number',
|
9
|
phone: 'Please enter the correct mobile number',
|
|
|
|
10
|
+ hexLength: 'The length of the HEX command must be an even number',
|
|
10
|
}; |
11
|
}; |
|
@@ -6,4 +6,5 @@ export default { |
|
@@ -6,4 +6,5 @@ export default { |
|
6
|
enteredPasswordsDiffer: '两次输入的密码不一致',
|
6
|
enteredPasswordsDiffer: '两次输入的密码不一致',
|
|
7
|
passwordRegularization: '密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符',
|
7
|
passwordRegularization: '密码中必须包含大小写 字母、数字、特称字符,至少8个字符,最多30个字符',
|
|
8
|
phone: '请输入正确手机号码',
|
8
|
phone: '请输入正确手机号码',
|
|
|
|
9
|
+ hexLength: 'HEX命令长度需要为偶数',
|
|
9
|
}; |
10
|
}; |