From 4863086bb1444d866faae56ab0201d58046ddb30 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 8 Nov 2019 17:25:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=85=AC=E5=BC=8F=E6=97=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/database_index/database_index.model.ts | 4 ++++ .../src/modules/components/database_index/database_index.ts | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/web/src/modules/components/database_index/database_index.model.ts b/src/web/src/modules/components/database_index/database_index.model.ts index b315a7e..8f49f47 100644 --- a/src/web/src/modules/components/database_index/database_index.model.ts +++ b/src/web/src/modules/components/database_index/database_index.model.ts @@ -7,6 +7,7 @@ export class DatabaseIndexModel extends Model { state() { return { inputValue: '' as string | number, + inputType: 'int', }; } @@ -14,5 +15,8 @@ export class DatabaseIndexModel extends Model { setInpueValue: (value: string | number) => { this.model.inputValue = value; }, + setInputType: (value: string) => { + this.model.inputType = value; + }, } } diff --git a/src/web/src/modules/components/database_index/database_index.ts b/src/web/src/modules/components/database_index/database_index.ts index face893..1bef951 100644 --- a/src/web/src/modules/components/database_index/database_index.ts +++ b/src/web/src/modules/components/database_index/database_index.ts @@ -23,11 +23,12 @@ export class DatabaseIndex extends BI.Widget { render() { const { value, inputType } = this.options; this.store.setInpueValue(value); + this.store.setInputType(inputType); return { type: TabXtype, single: true, - showIndex: inputType, + showIndex: this.model.inputType, ref: (_ref: any) => { this.databaseIndexTab = _ref; }, @@ -68,6 +69,7 @@ export class DatabaseIndex extends BI.Widget { public setSelect(value: string) { this.databaseIndexTab.setSelect(value); + this.store.setInputType(value); if (value === 'formula') { openFormulaPopover({ formula: this.model.inputValue === 0 ? '' : this.model.inputValue as string, @@ -79,6 +81,6 @@ export class DatabaseIndex extends BI.Widget { } public getValue() { - return this.model.inputValue; + return this.model.inputType === 'int' ? parseInt(`${this.model.inputValue}`, 10) : this.model.inputValue; } }