rules: [{ required: true, message: '請填寫水域面積,應爲大於 0 的整數,而且最大長度不能超過 13 位!' }, { pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '請輸入正整數!' } ] pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '請填寫寬度,保留一位小數而且最大長度不能超過15位!' regionPeople: { rules: [{ required: true, message: '請填寫常住人口,應爲大於 0 的整數,而且最大長度不能超過 13 位!' }, { pattern: /^[+]{0,1}(\d+)$/, message: '請輸入正整數!' } ] }, pattern: /^1[3456789]\d{9}$/, message: '請填寫正確的聯繫電話!' pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '保留兩位小數!' {pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '請輸入正確的座機號碼'},
rules: [{ required: true, message: '請輸入用戶帳號!' }, { validator: this.validateUsername, }] validateUsername(rule, value, callback) { var params = { tableName: '', fieldName: 'username', fieldVal: value, dataId: this.userId }; getAction("/sys/duplicate/checkUserName",params).then((res) => { if (res.success) { callback() } else { callback("用戶名已存在!") } }) },
rules: [{
required: true,
pattern: /[a-zA-Z0-9]{6,16}$/,
message: '密碼由長度6到16位的字母或者數字組成!'
}, {
validator: this.validateToNextPassword,
}],ide
validateToNextPassword(rule, value, callback) {
const form = this.form;
const confirmpassword = form.getFieldValue('confirmpassword');ui
if (value && confirmpassword && value !== confirmpassword) { callback('兩次輸入的密碼不同!'); } if (value && this.confirmDirty) { form.validateFields(['confirm'], {force: true}) } callback(); },
compareToFirstPassword(rule, value, callback) {
const form = this.form;
if (value && value !== form.getFieldValue('password')) {
callback('兩次輸入的密碼不同!');
} else {
callback()
}
},this
validatePhone(rule, value, callback) {
if (!value) {
callback()
} else {
//update-begin--Author:kangxiaolin Date:20190826 for:[05] 手機號不支持199號碼段--------------------
if (new RegExp(/^1[3|4|5|6|7|8|9][0-9]\d{8}$/).test(value)) {
//update-end--Author:kangxiaolin Date:20190826 for:[05] 手機號不支持199號碼段--------------------code
var params = { tableName: '', fieldName: 'phone', fieldVal: value, dataId: this.userId }; getAction("/sys/duplicate/checkUserPhone",params).then((res) => { if (res.success) { callback() } else { callback("手機號已存在!") } }) } else { callback("請輸入正確格式的手機號碼!"); } } },