定制校验消息

1.基本功能 1.基本功能

平台支持自定义校验规则对应的消息提示模板,该配置是视图级配置,作用于整个视图上的校验消息提示。平台优先读取用户配置的消息提示模板,如果没有配置,则取平台默带的消息提示模板。

2.配置方法 2.配置方法

配置

  1. 项目管理–项目初始化–校验规则消息模板:点击【新增】按钮,输入的【校验规则名称】、【语言显示】、【模板】,例如非空校验,模板内容为:【{0}】不能为空!!!,其中{0}为属性描述。其余校验规则消息模板配置类似。
    QQ截图20200831134451
    QQ截图20200831141126
  2. 编辑业务对象,新增非空校验,然后提交业务对象并生成代码。

附:平台校验消息模板,目前平台支持简体中文、繁体中文和英文三种语言

###REQUIRE
REQUIRE.zh = 【{0}】不能为空
REQUIRE.zh_CN = 【{0}】不能为空
REQUIRE.zh_TW = 【{0}】不能為空
REQUIRE.en = 【{0}】must be not null
REQUIRE.en_US = 【{0}】must be not null
###NOT_NULL
NOT_NULL.zh = 【{0}】不能为空
NOT_NULL.zh_CN = 【{0}】不能为空
NOT_NULL.zh_TW = 【{0}】不能為空
NOT_NULL.en = 【{0}】must be not null
NOT_NULL.en_US = 【{0}】must be not null
###NOT_EMPTY
NOT_EMPTY.zh = 【{0}】不能为空
NOT_EMPTY.zh_CN = 【{0}】不能为空
NOT_EMPTY.zh_TW = 【{0}】不能為空
NOT_EMPTY.en = 【{0}】must be not null
NOT_EMPTY.en_US = 【{0}】must be not null
###LENGTH
LENGTH.zh = 【{0}】长度必须大于等于{1}小于等于{2}|【{0}】长度必须小于等于{1}
LENGTH.zh_CN = 【{0}】长度必须大于等于{1}小于等于{2}|【{0}】长度必须小于等于{1}
LENGTH.zh_TW = 【{0}】長度必須大於等於{1}小於等於{2}|【{0}】長度必須小於等於{1}
LENGTH.en = 【{0}】length must be equal or greater than {1} and less then or
equal to {2}.|【{0}】length must be less then or equal to {1}
LENGTH.en_US = 【{0}】length must be equal or greater than {1} and less then or
equal to {2}.|【{0}】length must be less then or equal to {1}
###RICH_LENGTH
RICH_LENGTH.zh = 【{0}】长度必须大于等于{1}小于等于{2}|【{0}】长度必须小于等于{1}
RICH_LENGTH.zh_CN = 【{0}】长度必须大于等于{1}小于等于{2}|【{0}】长度必须小于等于{1}
RICH_LENGTH.zh_TW = 【{0}】長度必須大於等於{1}小於等於{2}|【{0}】長度必須小於等於{1}
RICH_LENGTH.en = 【{0}】length must be equal or greater than {1} and less then or
equal to {2}.|【{0}】length must be less then or equal to {1}
RICH_LENGTH.en_US = 【{0}】length must be equal or greater than {1} and less then
or equal to {2}.|【{0}】length must be less then or equal to {1}
###EMAIL
EMAIL.zh = 【{0}】邮箱格式不正确
EMAIL.zh_CN = 【{0}】邮箱格式不正确
EMAIL.zh_TW = 【{0}】郵箱格式不正確
EMAIL.en = 【{0}】email address format is not correct
EMAIL.en_US = 【{0}】email address format is not correct
###ZIPCODE
ZIPCODE.zh = 【{0}】邮编格式不正确
ZIPCODE.zh_CN = 【{0}】邮编格式不正确
ZIPCODE.zh_TW = 【{0}】郵編格式不正確
ZIPCODE.en = 【{0}】zip format is not correct
ZIPCODE.en_US = 【{0}】zip format is not correct
###MOBILEPHONE
MOBILEPHONE.zh = 【{0}】手机格式不正确
MOBILEPHONE.zh_CN = 【{0}】手机格式不正确
MOBILEPHONE.zh_TW = 【{0}】手機格式不正確
MOBILEPHONE.en = 【{0}】mobile phone format is not correct
MOBILEPHONE.en_US = 【{0}】mobile phone format is not correct
###TELEPHONE
TELEPHONE.zh = 【{0}】邮编格式不正确
TELEPHONE.zh_CN = 【{0}】邮编格式不正确
TELEPHONE.zh_TW = 【{0}】郵編格式不正確
TELEPHONE.en = 【{0}】zip format is not correct
TELEPHONE.en_US = 【{0}】zip format is not correct
###NUMC
NUMC.zh = 【{0}】必须为数字
NUMC.zh_CN = 【{0}】必须为数字
NUMC.zh_TW = 【{0}】必須為數字
NUMC.en = 【{0}】must be numeric
NUMC.en_US = 【{0}】must be numeric
###RANGE
RANGE.zh = 【{0}】必须在区间({1}~{2})
RANGE.zh_CN = 【{0}】必须在区间({1}~{2})
RANGE.zh_TW = 【{0}】必須在區間({1}~{2})
RANGE.en = 【{0}】must be in the range ({1}~{2})
RANGE.en_US = 【{0}】must be in the range ({1}~{2})
###NOT_SPCL_CHAR
NOT_SPCL_CHAR.zh = 【{0}】不得包含特殊字符
NOT_SPCL_CHAR.zh_CN = 【{0}】不得包含特殊字符
NOT_SPCL_CHAR.zh_TW = 【{0}】不得包含特殊字符
NOT_SPCL_CHAR.en = 【{0}】must not contain special characters
NOT_SPCL_CHAR.en_US = 【{0}】must not contain special characters
###URL
URL.zh = 【{0}】URL格式不正确
URL.zh_CN = 【{0}】URL格式不正确
URL.zh_TW = 【{0}】URL格式不正確
URL.en = 【{0}】the url format is correct
URL.en_US = 【{0}】the url format is correct
###CHINA_ID
CHINA_ID.zh = 【{0}】身份证格式不正确
CHINA_ID.zh_CN = 【{0}】身份证格式不正确
CHINA_ID.zh_TW = 【{0}】身份證格式不正確
CHINA_ID.en = 【{0}】id card format is correct
CHINA_ID.en_US = 【{0}】id card format is correct
###CAR_NUMBER
CAR_NUMBER.zh = 【{0}】车牌号格式不正确
CAR_NUMBER.zh_CN = 【{0}】车牌号格式不正确
CAR_NUMBER.zh_TW = 【{0}】車牌號格式不正確
CAR_NUMBER.en = 【{0}】licence plate number format is correct
CAR_NUMBER.en_US = 【{0}】licence plate number format is correct
###ASCII_CODE
ASCII_CODE.zh = 【{0}】只能输入ASCII码字符
ASCII_CODE.zh_CN = 【{0}】只能输入ASCII码字符
ASCII_CODE.zh_TW = 【{0}】只能輸入ASCII碼字符
ASCII_CODE.en = 【{0}】can only enter ASCII characters
ASCII_CODE.en_US = 【{0}】can only enter ASCII characters
###DYNA_REQURE
DYNA_REQURE.zh = 【{0}】不能为空
DYNA_REQURE.zh_CN = 【{0}】不能为空
DYNA_REQURE.zh_TW = 【{0}】不能為空
DYNA_REQURE.en = 【{0}】not blank
DYNA_REQURE.en_US = 【{0}】not blank
###DYNA_ASCII
DYNA_ASCII.zh = 【{0}】只能输入ASCII码字符
DYNA_ASCII.zh_CN = 【{0}】只能输入ASCII码字符
DYNA_ASCII.zh_TW = 【{0}】只能輸入ASCII碼字符
DYNA_ASCII.en = 【{0}】can only enter ASCII characters
DYNA_ASCII.en_US = 【{0}】can only enter ASCII characters
###ENGLISH_LOWER_CASE_NUM_UL_STR
ENGLISH_LOWER_CASE_NUM_UL_STR.zh = 【{0}】由小写英文、下划线、数字组成
ENGLISH_LOWER_CASE_NUM_UL_STR.zh_CN = 【{0}】由小写英文、下划线、数字组成
ENGLISH_LOWER_CASE_NUM_UL_STR.zh_TW = 【{0}】由小寫英文、下劃線、數字組成
ENGLISH_LOWER_CASE_NUM_UL_STR.en = 【{0}】Underlined by lowercase English Numbers
ENGLISH_LOWER_CASE_NUM_UL_STR.en_US = 【{0}】Underlined by lowercase English
Numbers
###ENGLISH_NUM_STR
ENGLISH_NUM_STR.zh = 【{0}】由英文、数字字符串组成
ENGLISH_NUM_STR.zh_CN = 【{0}】由英文、数字字符串组成
ENGLISH_NUM_STR.zh_TW = 【{0}】由英文、數字字符串組成
ENGLISH_NUM_STR.en = 【{0}】Is made up of Numbers in English
ENGLISH_NUM_STR.en_US = 【{0}】Is made up of Numbers in English
###FIRST_LETTER_LOWER
FIRST_LETTER_LOWER.zh = 【{0}】首字母必须为字母且小写
FIRST_LETTER_LOWER.zh_CN = 【{0}】首字母必须为字母且小写
FIRST_LETTER_LOWER.zh_TW = 【{0}】首字母必須為字母且小寫
FIRST_LETTER_LOWER.en = 【{0}】first letter must lower
FIRST_LETTER_LOWER.en_US = 【{0}】first letter must lower
###UP_ENGLISH_NUM_STR
UP_ENGLISH_NUM_STR.zh = 【{0}】由英文、数字且首字符必须大写组成
UP_ENGLISH_NUM_STR.zh_CN = 【{0}】由英文、数字且首字符必须大写组成
UP_ENGLISH_NUM_STR.zh_TW = 【{0}】由英文、數字且首字符必須大寫組成
UP_ENGLISH_NUM_STR.en = 【{0}】a number by the English and the first letter must
be capitalized
UP_ENGLISH_NUM_STR.en_US = 【{0}】a number by the English and the first letter
must be capitalized
###FIRST_LETTER_LOWER
ENGLISH_NUM_UL_STR.zh = 【{0}】由英文、下划线、数字组成
ENGLISH_NUM_UL_STR.zh_CN = 【{0}】由英文、下划线、数字组成
ENGLISH_NUM_UL_STR.zh_TW = 【{0}】由英文、下劃線、數字組成
ENGLISH_NUM_UL_STR.en = 【{0}】Underlined by English Numbers
ENGLISH_NUM_UL_STR.en_US = 【{0}】Underlined by English Numbers
###ENGLISH_UPPER_CASE_NUM_UL_STR
ENGLISH_UPPER_CASE_NUM_UL_STR.zh = 【{0}】由大写英文、下划线、数字组成
ENGLISH_UPPER_CASE_NUM_UL_STR.zh_CN = 【{0}】由大写英文、下划线、数字组成
ENGLISH_UPPER_CASE_NUM_UL_STR.zh_TW = 【{0}】由大寫英文、下劃線、數字組成
ENGLISH_UPPER_CASE_NUM_UL_STR.en = 【{0}】Underlined by English Numbers and the
first letter must be capitalized
ENGLISH_UPPER_CASE_NUM_UL_STR.en_US = 【{0}】Underlined by English Numbers and
the first letter must be capitalized
###FIRST_LETTER_LOWER
ENGLISH_STR.zh = 【{0}】由英文字符组成
ENGLISH_STR.zh_CN = 【{0}】由英文字符组成
ENGLISH_STR.zh_TW = 【{0}】由英文字符組成
ENGLISH_STR.en = 【{0}】Consists of English letters
ENGLISH_STR.en_US = 【{0}】Consists of English letters
###NOT_LESS_CUR_DATE
NOT_LESS_CUR_DATE.zh = 【{0}】不得小于当前日期
NOT_LESS_CUR_DATE.zh_CN = 【{0}】不得小于当前日期
NOT_LESS_CUR_DATE.zh_TW = 【{0}】不得小於當前日期
NOT_LESS_CUR_DATE.en = 【{0}】Shall not be less than the current date
NOT_LESS_CUR_DATE.en_US = 【{0}】Shall not be less than the current date
###NOT_LESS_EQ_CUR_DATE
NOT_LESS_EQ_CUR_DATE.zh = 【{0}】不得小于等于当前日期
NOT_LESS_EQ_CUR_DATE.zh_CN = 【{0}】不得小于等于当前日期
NOT_LESS_EQ_CUR_DATE.zh_TW = 【{0}】不得小於等於當前日期
NOT_LESS_EQ_CUR_DATE.en = 【{0}】Shall not be less than or equal to the current
date
NOT_LESS_EQ_CUR_DATE.en_US = 【{0}】Shall not be less than or equal to the
current date
###NOT_GREATER_CUR_DATE
NOT_GREATER_CUR_DATE.zh = 【{0}】不得大于当前日期
NOT_GREATER_CUR_DATE.zh_CN = 【{0}】不得大于当前日期
NOT_GREATER_CUR_DATE.zh_TW = 【{0}】不得大於當前日期
NOT_GREATER_CUR_DATE.en = 【{0}】Shall not be greater than the current date
NOT_GREATER_CUR_DATE.en_US = 【{0}】Shall not be greater than the current date
###NOT_GREATER_EQ_CUR_DATE
NOT_GREATER_EQ_CUR_DATE.zh = 【{0}】不得大于等于当前日期
NOT_GREATER_EQ_CUR_DATE.zh_CN = 【{0}】不得大于等于当前日期
NOT_GREATER_EQ_CUR_DATE.zh_TW = 【{0}】不得大於等於當前日期
NOT_GREATER_EQ_CUR_DATE.en = 【{0}】Shall not be greater than or equal to the
current date
NOT_GREATER_EQ_CUR_DATE.en_US = 【{0}】Shall not be greater than or equal to the
current date
###MUST_MORE_THAN_ZERO
MUST_MORE_THAN_ZERO.zh = 【{0}】必须大于0
MUST_MORE_THAN_ZERO.zh_CN = 【{0}】必须大于0
MUST_MORE_THAN_ZERO.zh_TW = 【{0}】必須大於0
MUST_MORE_THAN_ZERO.en = 【{0}】Must be greater than zero
MUST_MORE_THAN_ZERO.en_US = 【{0}】Must be greater than zero
###NUM_LENGTH
NUM_LENGTH.zh = 【{0}】数字,数字的长度不正确
NUM_LENGTH.zh_CN = 【{0}】数字,数字的长度不正确
NUM_LENGTH.zh_TW = 【{0}】數字,數字的長度不正確
NUM_LENGTH.en = 【{0}】Digits lenght wrong
NUM_LENGTH.en_US = 【{0}】Digits lenght wrong
###MUST_MORE_THAN_OR_EQ_ZERO
MUST_MORE_THAN_OR_EQ_ZERO.zh = 【{0}】必须大于等于0
MUST_MORE_THAN_OR_EQ_ZERO.zh_CN = 【{0}】必须大于等于0
MUST_MORE_THAN_OR_EQ_ZERO.zh_TW = 【{0}】必須大於等於0
MUST_MORE_THAN_OR_EQ_ZERO.en = 【{0}】Must be greater than or eq zero
MUST_MORE_THAN_OR_EQ_ZERO.en_US = 【{0}】Must be greater than or eq zero
###COMPARE_GREATER
COMPARE_GREATER.zh = 【{0}】必须大于【{1}】
COMPARE_GREATER.zh_CN = 【{0}】必须大于【{1}】
COMPARE_GREATER.zh_TW = 【{0}】必須大於【{1}】
COMPARE_GREATER.en = 【{0}】Must be greater than 【{1}】
COMPARE_GREATER.en_US = 【{0}】Must be greater than 【{1}】
###COMPARE_GREATER_EQ
COMPARE_GREATER_EQ.zh = 【{0}】必须大于等于【{1}】
COMPARE_GREATER_EQ.zh_CN = 【{0}】必须大于等于【{1}】
COMPARE_GREATER_EQ.zh_TW = 【{0}】必須大於等於【{1}】
COMPARE_GREATER_EQ.en = 【{0}】Must be greater than or equal to 【{1}】
COMPARE_GREATER_EQ.en_US = 【{0}】Must be greater than or equal to 【{1}】
###COMPARE_GREATER
COMPARE_LESS.zh = 【{0}】必须小于【{1}】
COMPARE_LESS.zh_CN = 【{0}】必须小于【{1}】
COMPARE_LESS.zh_TW = 【{0}】必須小於【{1}】
COMPARE_LESS.en = 【{0}】Must be less than 【{1}】
COMPARE_LESS.en_US = 【{0}】Must be less than 【{1}】
###COMPARE_LESS_EQ
COMPARE_LESS_EQ.zh = 【{0}】必须小于等于【{1}】
COMPARE_LESS_EQ.zh_CN = 【{0}】必须小于等于【{1}】
COMPARE_LESS_EQ.zh_TW = 【{0}】必須小於等於【{1}】
COMPARE_LESS_EQ.en = 【{0}】Must be less than or equal to 【{1}】
COMPARE_LESS_EQ.en_US = 【{0}】Must be less than or equal to 【{1}】
###ALL_MATCH
ALL_MATCH.zh = ${n},两次输入不一致.|${n},必须全部一样
ALL_MATCH.zh_CN = ${n},两次输入不一致.|${n},必须全部一样
ALL_MATCH.zh_TW = ${n},兩次輸入不壹致.|${n},必須全部壹樣
ALL_MATCH.en = ${n},Two input is inconsistent.|${n},All must be consistent
ALL_MATCH.en_US = ${n},Two input is inconsistent.|${n},All must be consistent
###EITHER_NOT_BLANK
EITHER_NOT_BLANK.zh = ${n},必须有一个不为空
EITHER_NOT_BLANK.zh_CN = ${n},必须有一个不为空
EITHER_NOT_BLANK.zh_TW = ${n},必須有壹個不為空
EITHER_NOT_BLANK.en = ${n}There must be a is not empty
EITHER_NOT_BLANK.en_US = ${n}There must be a is not empty
###EITHER_NOT_NULL
EITHER_NOT_NULL.zh = ${n},必须有一个不为空
EITHER_NOT_NULL.zh_CN = ${n},必须有一个不为空
EITHER_NOT_NULL.zh_TW = ${n},必須有壹個不為空
EITHER_NOT_NULL.en = ${n}There must be a is not empty
EITHER_NOT_NULL.en_US = ${n}There must be a is not empty
###UNIQUE
UNIQUE.zh = ${n}必须唯一
UNIQUE.zh_CN = ${n}必须唯一
UNIQUE.zh_TW = ${n}必須唯壹
UNIQUE.en = ${n}Must be the only
UNIQUE.en_US = ${n}Must be the only
###UNIQUEGL
UNIQUEGL.zh = ${n}必须唯一
UNIQUEGL.zh_CN = ${n}必须唯一
UNIQUEGL.zh_TW = ${n}必須唯壹
UNIQUEGL.en = ${n}Must be the only
UNIQUEGL.en_US = ${n}Must be the only

代码

校验规则文件中对应字段会生成require校验规则

define({rules:[{{{property:"testExam3301Zym.asnNo",ruleName:"require",message:"Require.testExam3301Zym.asnNo"}}]});

校验消息提示文件中对应字段会生成校验提示消息"Require.testExam3301Zym.asnNo":"【入库单号】不能为空!!!"

define({"root":{""Require.testExam3301Zym.asnNo":"【入库单号】不能为空!!!"}});

3. 常用扩展 3. 常用扩展

4. 版本更新 4. 版本更新

6.7.2,2020.08.30

新特性

  • 平台支持自定义校验规则对应的消息提示模板