From 060be7c5526b28bc05a75c0bdf06a2918e4adc94 Mon Sep 17 00:00:00 2001 From: dengbf Date: Mon, 4 Aug 2025 17:21:14 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E5=85=B3=E8=81=94]=20#[1480340827242496]?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=9F=9F=E5=8A=A0=E4=B8=8A=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F=E6=A0=A1=E9=AA=8C=20http://192.168.0.96:8090/demo/rdm?= =?UTF-8?q?.html#/story-detail/939050947543040/939050947543042/14803408272?= =?UTF-8?q?42496?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TsSheet/form/component/formtextarea.vue | 39 ++++++++- .../TsSheet/form/config/formtextarea-conf.vue | 79 ++++++++++++++++++- 2 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/resources/plugins/TsSheet/form/component/formtextarea.vue b/src/resources/plugins/TsSheet/form/component/formtextarea.vue index 2da251c4..8894c317 100644 --- a/src/resources/plugins/TsSheet/form/component/formtextarea.vue +++ b/src/resources/plugins/TsSheet/form/component/formtextarea.vue @@ -9,7 +9,7 @@ :value="actualValue" :readonly="readonly" :disabled="disabled" - :validateList="validateList" + :validateList="actualValidateList" :readonlyTextIsHighlight="readonlyTextIsHighlight" @on-blur=" val => { @@ -48,6 +48,21 @@ export default { beforeDestroy() {}, destroyed() {}, methods: { + 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: {}, computed: { @@ -60,6 +75,28 @@ export default { } } return null; + }, + actualValidateList() { + let validateList = this.validateList || []; + 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; } }, watch: {} diff --git a/src/resources/plugins/TsSheet/form/config/formtextarea-conf.vue b/src/resources/plugins/TsSheet/form/config/formtextarea-conf.vue index f8adf877..d25b266b 100644 --- a/src/resources/plugins/TsSheet/form/config/formtextarea-conf.vue +++ b/src/resources/plugins/TsSheet/form/config/formtextarea-conf.vue @@ -20,6 +20,34 @@ }" > + + + + + + + + -- Gitee