From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 07 四月 2021 23:25:29 +0800 Subject: [PATCH] 2021-04-07 --- src/templates/sharecomponent/tablecomponent/index.jsx | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index 04a1a64..e52ef08 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -23,7 +23,7 @@ } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, tables: [], // 绯荤粺琛� tableFields: [], // 宸查�夎〃瀛楁闆� selectedTables: [], // 宸查�夎〃 @@ -153,8 +153,7 @@ this.setState({ tableFields: _columns }) - - this.props.updatetable(this.props.config, _columns) + window.GLOB.tableFields = _columns }) } @@ -183,7 +182,11 @@ let _decimal = 0 let _length = 50 if (/^nvarchar/.test(_type)) { - _length = +_type.match(/\d+/)[0] || 50 + try { // 瀛樺湪max + _length = +_type.match(/\d+/)[0] || 50 + } catch { + _length = 2048 + } _type = 'text' } else if (/^int/.test(_type)) { _type = 'number' @@ -209,11 +212,16 @@ } }) } + + let _columns = [...tableFields, tabmsg] + this.setState({ - tableFields: [...tableFields, tabmsg] + tableFields: _columns }) - this.props.updatetable(_config, [...tableFields, tabmsg]) + window.GLOB.tableFields = _columns + + this.props.updatetable(_config) } else { notification.warning({ top: 92, @@ -240,7 +248,9 @@ tableFields: _fields }) - this.props.updatetable({...config, tables: _tables}, _fields) + window.GLOB.tableFields = _fields + + this.props.updatetable({...config, tables: _tables}) } /** -- Gitblit v1.8.0