diff --git a/src/components/Form/DataForm/rules/index.js b/src/components/Form/DataForm/rules/index.js index f235030b9..f602842f8 100644 --- a/src/components/Form/DataForm/rules/index.js +++ b/src/components/Form/DataForm/rules/index.js @@ -53,13 +53,27 @@ export const matchAlphanumericUnderscore = { trigger: ['blur', 'change'] } +// 不能包含() +export const MatchExcludeParenthesis = { + validator: (rule, value, callback) => { + value = value?.trim() + if (!/^[^()]*$/.test(value)) { + callback(new Error(i18n.t('common.notParenthesis'))) + } else { + callback() + } + }, + trigger: ['blur', 'change'] +} + export default { IpCheck, Required, RequiredChange, EmailCheck, specialEmojiCheck, - matchAlphanumericUnderscore + matchAlphanumericUnderscore, + MatchExcludeParenthesis } export const JsonRequired = { diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 775892d94..3f08d8a96 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -867,6 +867,7 @@ "SecretKey": "Secret Key", "NotSpecialEmoji": "No special emoji allowed", "notAlphanumericUnderscore": "Only numbers, letters and underscores can be entered", + "notParenthesis": "Not contain ( )", "Task": "Task", "Cas": "CAS", "Invalid": "Invalid", diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json index 31af15cd9..c05aacdac 100644 --- a/src/i18n/langs/ja.json +++ b/src/i18n/langs/ja.json @@ -804,6 +804,7 @@ "FormatError": "フォーマットエラー", "NotSpecialEmoji": "特殊な表情記号の入力は許可されていません", "notAlphanumericUnderscore": "数字、文字、アンダースコアのみ入力可能", + "notParenthesis": "含まない ( )", "WeekCronSelect": { "Monday": "月曜日", "Tuesday": "火曜日", diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index f423ed19c..487e808c4 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -838,6 +838,7 @@ "FormatError": "格式错误", "NotSpecialEmoji": "不允许输入特殊表情符号", "notAlphanumericUnderscore": "只能输入字母、数字、下划线", + "notParenthesis": "不能包含 ( )", "WeekCronSelect": { "Monday": "星期一", "Tuesday": "星期二", diff --git a/src/views/settings/Applet/AppletHost/AppletHostCreateUpdate.vue b/src/views/settings/Applet/AppletHost/AppletHostCreateUpdate.vue index e15c2316d..6f4e0e528 100644 --- a/src/views/settings/Applet/AppletHost/AppletHostCreateUpdate.vue +++ b/src/views/settings/Applet/AppletHost/AppletHostCreateUpdate.vue @@ -4,6 +4,7 @@