From 177fdf97062a35fa11e04956fdccf9ca62045df5 Mon Sep 17 00:00:00 2001 From: alan Date: Mon, 30 Sep 2019 13:59:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20DEC-10149=20=E6=95=B0=E6=8D=AE=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=90=8D=E7=A7=B0=E4=B8=8D=E8=83=BD=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?200=E4=B8=AA=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/zh_cn.properties | 2 +- private/i18n.ts | 1 + src/modules/app.service.ts | 4 ++++ src/modules/pages/maintain/forms/form.ts | 12 +++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/i18n/zh_cn.properties b/i18n/zh_cn.properties index aef5cde..1f0edee 100644 --- a/i18n/zh_cn.properties +++ b/i18n/zh_cn.properties @@ -110,7 +110,7 @@ Dec-Dcm_Connection_Deleted=该数据连接已被删除,无法进行操作 Dec-Dcm_Connection_Click_Connect_Database=点击连接数据库 Dec-Dcm_Connection_Read_Mode_List=以读取模式列表 Dec-Dcm_Connection_NO_Connection_Pool=无数据连接,可在数据连接管理页面添加 - +Dec-Dcm_Connection_Cannot_Too_Lang=文本长度不能大于200个字符 BI-Multi_Date_Quarter_End= 季度末 BI-Multi_Date_Month_Begin= 月初 BI-Multi_Date_YMD= 年月日 diff --git a/private/i18n.ts b/private/i18n.ts index 96bd362..1fdf08b 100644 --- a/private/i18n.ts +++ b/private/i18n.ts @@ -109,6 +109,7 @@ export default { 'Dec-Dcm_Connection_Click_Connect_Database': '点击连接数据库', 'Dec-Dcm_Connection_Read_Mode_List': '以读取模式列表', 'Dec-Dcm_Connection_NO_Connection_Pool': '无数据连接,可在数据连接管理页面添加', + 'Dec-Dcm_Connection_Cannot_Too_Lang': '文本长度不能大于200个字符', 'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Month_Begin': '月初', 'BI-Multi_Date_YMD': '年月日', diff --git a/src/modules/app.service.ts b/src/modules/app.service.ts index 9200db4..a770f78 100644 --- a/src/modules/app.service.ts +++ b/src/modules/app.service.ts @@ -98,3 +98,7 @@ export function getTextByDatabaseType(databaseType: string) { return database ? database.text : ''; } + +export function getChartLength(str: string) { + return str.replace(/[^\x00-\xff]/g, '01').length; +} diff --git a/src/modules/pages/maintain/forms/form.ts b/src/modules/pages/maintain/forms/form.ts index 05a1903..15e40c2 100644 --- a/src/modules/pages/maintain/forms/form.ts +++ b/src/modules/pages/maintain/forms/form.ts @@ -6,7 +6,7 @@ import { FormPluginXtype } from './components/form.plugin'; import { connectionType } from '@constants/env'; import { ConnectionJDBC, Connection } from 'src/modules/crud/crud.typings'; import { DEFAULT_JNDI_DATA, DEFAULT_JDBC_POOL, DATEBASE_FILTER_TYPE } from '@constants/constant'; -import { getJdbcDatabaseType } from 'src/modules/app.service'; +import { getJdbcDatabaseType, getChartLength } from '../../../app.service'; export const MaintainFormXtype = 'dec.dcm.maintain.form'; @shortcut(MaintainFormXtype) @store(MaintainFormModelXtype) @@ -190,6 +190,11 @@ export class MaintainForm extends BI.Widget { return false; } } + if (getChartLength(value.connectionName) > 200) { + this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); + + return false; + } return true; } @@ -221,6 +226,11 @@ export class MaintainForm extends BI.Widget { return; } + if (getChartLength(formValue.connectionName) > 200) { + this.setFromError(BI.i18nText('Dec-Dcm_Connection_Cannot_Too_Lang')); + + return false; + } if (this.isEdit || this.model.isCopy) { formValue.connectionId = this.connectionName; }