From 4baacf51f86d85a20eb3fd2c49ea72eefff723b1 Mon Sep 17 00:00:00 2001 From: yaojn Date: Tue, 17 Jun 2025 12:22:14 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AEdb=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=8A=A5=E9=94=99=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=BE=93=E5=85=A5=E5=9F=9F=E5=90=8D=20=20=20=20-=20[?= =?UTF-8?q?=E5=85=B3=E8=81=94]#[1445562421837824]=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AEdb=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=8A=A5=E9=94=99=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=BE=93=E5=85=A5=E5=9F=9F=E5=90=8D=20http://192.168.?= =?UTF-8?q?0.96:8090/demo/rdm.html#/bug-detail/939050947543040/93905094754?= =?UTF-8?q?3057/1445562421837824?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsForm/TsValidtor.js | 13 +++++++++++++ .../config/env/db-resource-setting-dialog.vue | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/resources/plugins/TsForm/TsValidtor.js b/src/resources/plugins/TsForm/TsValidtor.js index cef7a5cf..1c8ca147 100755 --- a/src/resources/plugins/TsForm/TsValidtor.js +++ b/src/resources/plugins/TsForm/TsValidtor.js @@ -102,6 +102,19 @@ let validtor = { trigger: 'change', message: $t('message.pleaseentertruetarget', {target: $t('page.ipaddress')}) }, + domainOrIP: { + validator: function(rule, value) { + // 校验域名或者IP是否合法 + if (!utils.isEmpty(value)) { + const hostRegex = /^((([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,})|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.|$)){4})$/; + return hostRegex.test(value); + } else { + return true; + } + }, + trigger: 'change', + message: $t('message.pleaseentertruetarget', {target: $t('page.domain') + $t('page.or') + 'IP'}) + }, ipAndPort: { validator: function(rule, value) { let hasComma = value.indexOf('\n'); // 逗号 diff --git a/src/views/pages/deploy/application-config/config/env/db-resource-setting-dialog.vue b/src/views/pages/deploy/application-config/config/env/db-resource-setting-dialog.vue index ee69e1ea..1e807248 100644 --- a/src/views/pages/deploy/application-config/config/env/db-resource-setting-dialog.vue +++ b/src/views/pages/deploy/application-config/config/env/db-resource-setting-dialog.vue @@ -75,7 +75,7 @@ export default { name: 'ip', type: 'text', label: 'IP', - validateList: ['ip'] + validateList: ['domainOrIP'] }, { name: 'port', @@ -130,7 +130,7 @@ export default { const attrObj = res.Return || {}; const validMap = { name: ['name-special'], - ip: ['ip'], + ip: ['domainOrIP'], port: ['port'] }; this.formList.forEach((item) => { -- Gitee