diff --git a/src/resources/assets/languages/message/en.json b/src/resources/assets/languages/message/en.json
index 9c77232b3924bb4a30c5ad281fe4853880086cb1..6a19f22db70b84be89493e90040f504e5420f3b0 100644
--- a/src/resources/assets/languages/message/en.json
+++ b/src/resources/assets/languages/message/en.json
@@ -208,7 +208,13 @@
"leastoneselectattr": "Please select at least one inherent attribute of the matrix",
"staticrepeat": "There is duplicate data in the static data option, please edit again",
"syncsceneattrtip": "The default scene contains attributes A, B, and C, and the current scene does not contain A, B, and C. Add the A, B, and C attributes to the current scene",
- "editwechattouser": "To be consistent with the user account in the user management of the enterprise WeChat backend"
+ "editwechattouser": "To be consistent with the user account in the user management of the enterprise WeChat backend",
+ "regex": "Regular verification",
+ "regextip": "Customize regular expressions to verify the validity of text box input; Do not verify when not filled in",
+ "regularexpression": "regular expression",
+ "regexvalidtip": "After the input verification fails, the user can re-enter according to this verification prompt",
+ "regexvalidplaceholder": "The specific meaning of regular expressions, such as containing only numbers",
+ "validtip": "Verification prompt"
},
"dashboard": {
"templatehelp": "The template needs to comply with the vue template syntax specification, and must specify a root tag, typically a div, that supports all iView components. The data source results are returned in the form of an array, and the root attribute is: dataList. When accessing data, please directly iterate over the dataList to obtain the required data.",
diff --git a/src/resources/assets/languages/message/zh.json b/src/resources/assets/languages/message/zh.json
index 6e11df8fcefdfe2f16c22b4b03a41546278ee8f3..46e13dd2803a4bdbc9c22d50015c3eb6213815ad 100644
--- a/src/resources/assets/languages/message/zh.json
+++ b/src/resources/assets/languages/message/zh.json
@@ -208,7 +208,13 @@
"leastoneselectattr": "请至少选择一个矩阵固有属性",
"staticrepeat": "静态数据选项存在重复数据,请重新编辑",
"syncsceneattrtip": "默认场景包含属性A、B、C,且当前场景不包含A、B、C,将A、B、C属性添加至当前场景",
- "editwechattouser": "要与企业微信后台的用户管理中用户账号一致"
+ "editwechattouser": "要与企业微信后台的用户管理中用户账号一致",
+ "regex": "正则校验",
+ "regextip": "自定义正则表达式,校验文本框输入合法性;未填写时不校验",
+ "regularexpression": "正则表达式",
+ "regexvalidtip": "输入校验失败后,用户可根据此校验提示重新输入",
+ "regexvalidplaceholder": "正则表达式具体含义,如:仅包含数字",
+ "validtip": "校验提示"
},
"dashboard": {
"templatehelp": "模板需要符合vue模板语法规范,必须指定一个根标签,一般是div,支持所有iView组件。数据源结果以数组的形式返回,根属性为:dataList,访问数据时请直接迭代dataList获取需要的数据。",
diff --git a/src/resources/mixins/formMixins.js b/src/resources/mixins/formMixins.js
index ff0b54065016c72e64703fd2100d8a862992fec9..97edd1120891bad1320c9959a943fb04abde9fbc 100644
--- a/src/resources/mixins/formMixins.js
+++ b/src/resources/mixins/formMixins.js
@@ -270,13 +270,16 @@ export default {
this.isValidPass = true;
}
},
- validateList() {
- this.currentValidList = this.filterValid(this.validateList) || [];
- if (this.$utils.isEmpty(this.currentValidList)) {
- // 修复传递errorMessage错误提示文案没有显示问题
- this.validMesage = '';
- this.isValidPass = true;
- }
+ validateList: {
+ handler() {
+ this.currentValidList = this.filterValid(this.validateList) || [];
+ if (this.$utils.isEmpty(this.currentValidList)) {
+ // 修复传递errorMessage错误提示文案没有显示问题
+ this.validMesage = '';
+ this.isValidPass = true;
+ }
+ },
+ deep: true
}
}
};
diff --git a/src/resources/plugins/TsSheet/TsSheet.vue b/src/resources/plugins/TsSheet/TsSheet.vue
index 2e8c35a95b5c62df29704d7270d0294ea100ea6d..7184b6520dcfc1fa0ccabb7563d49d91facbcd9f 100644
--- a/src/resources/plugins/TsSheet/TsSheet.vue
+++ b/src/resources/plugins/TsSheet/TsSheet.vue
@@ -863,12 +863,30 @@ export default {
for (let key in this.formData) {
const formitem = this.formItemList.find(d => d.uuid === key);
if (formitem) {
+ this.clearPrivateAttr(this.formData[key]);
formItemList.push({ attributeUuid: key, handler: formitem.handler, dataList: this.formData[key] });
}
}
// console.log(JSON.stringify(formItemList, null, 2));
return formItemList;
},
+ clearPrivateAttr(value) { //清除私有属性
+ if (!this.$utils.isEmpty(value)) {
+ if (Array.isArray(value)) {
+ value.forEach(fitem => {
+ if (!this.$utils.isEmpty(fitem)) {
+ for (let k in fitem) {
+ if (k.startsWith('_')) {
+ delete fitem[k];
+ } else {
+ this.clearPrivateAttr(fitem[k]);
+ }
+ }
+ }
+ });
+ }
+ }
+ },
//是否包含class
hasClass(classname) {
for (let i = 0; i < this.selectedCell.length; i++) {
diff --git a/src/resources/plugins/TsSheet/form/component/formtext.vue b/src/resources/plugins/TsSheet/form/component/formtext.vue
index 9dec5e89e3e183cb37eb0a06182ffd3d89ac9331..1982e23771734a20767e0d5eb83c6829bcb50baf 100644
--- a/src/resources/plugins/TsSheet/form/component/formtext.vue
+++ b/src/resources/plugins/TsSheet/form/component/formtext.vue
@@ -52,6 +52,21 @@ export default {
errorList.push({uuid: this.formItem.uuid, error: this.$refs.formitem.validMesage});
}
return errorList;
+ },
+ validConfig() {
+ const errorList = this.validDataForAllItem();
+ if (!this.$utils.isEmpty(this.config.regex) && this.$utils.isEmpty(this.config.regexMessage)) {
+ errorList.push({ field: 'regexMessage', error: this.$t('form.placeholder.pleaseinput', {'target': this.$t('message.framework.validtip')}) });
+ }
+ return errorList;
+ },
+ isValidRegex(regexString) { //判断正则表达式是否合法
+ try {
+ new RegExp(regexString);
+ return true;
+ } catch (error) {
+ return false;
+ }
}
},
filter: {},
@@ -68,8 +83,23 @@ export default {
},
actualValidateList() {
let validateList = this.validateList || [];
- if (this.config.validate) {
- validateList.push(this.config.validate);
+ if (!this.$utils.isEmpty(this.config)) {
+ if (this.config.validate) {
+ validateList.push(this.config.validate);
+ }
+ if (!this.$utils.isEmpty(this.config.regex) && this.isValidRegex(this.config.regex)) {
+ let findRegex = validateList.find(item => item.name === 'regex');
+ if (findRegex) {
+ this.$set(findRegex, 'pattern', this.config.regex);
+ this.$set(findRegex, 'message', this.config.regexMessage);
+ } else {
+ validateList.push({
+ name: 'regex',
+ pattern: this.config.regex,
+ message: this.config.regexMessage
+ });
+ }
+ }
}
return validateList;
}
diff --git a/src/resources/plugins/TsSheet/form/config/formtext-conf.vue b/src/resources/plugins/TsSheet/form/config/formtext-conf.vue
index 3b3910a6211a1dfbb1e37e10f36fb6753fe5d3cc..49506119a079b8fa3e817d5f02b9f219073f586a 100644
--- a/src/resources/plugins/TsSheet/form/config/formtext-conf.vue
+++ b/src/resources/plugins/TsSheet/form/config/formtext-conf.vue
@@ -20,6 +20,33 @@
}"
>
+
+ {
+ setConfig('regex', val);
+ }"
+ >
+
+
+
+ {
+ setConfig('regexMessage', val);
+ }"
+ >
+
+
+