From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 01 九月 2021 10:31:45 +0800 Subject: [PATCH] 2021-09-01 --- src/templates/sharecomponent/tablecomponent/index.jsx | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index 492811a..8c8f4b4 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: [], // 宸查�夎〃 @@ -112,7 +112,7 @@ if (/^nvarchar/.test(_type)) { try { // 瀛樺湪max _length = +_type.match(/\d+/)[0] || 50 - } catch { + } catch (e) { _length = 2048 } _type = 'text' @@ -131,12 +131,13 @@ } return { - field: item.FieldName, + field: item.FieldName || '', label: item.FieldDec, type: _type, datatype: _type, decimal: _decimal, length: _length, + $datatype: item.FieldType.toLowerCase() } }) } @@ -153,8 +154,7 @@ this.setState({ tableFields: _columns }) - - this.props.updatetable(this.props.config, _columns) + window.GLOB.tableFields = _columns }) } @@ -183,7 +183,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 (e) { + _length = 2048 + } _type = 'text' } else if (/^int/.test(_type)) { _type = 'number' @@ -209,11 +213,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 +249,9 @@ tableFields: _fields }) - this.props.updatetable({...config, tables: _tables}, _fields) + window.GLOB.tableFields = _fields + + this.props.updatetable({...config, tables: _tables}) } /** -- Gitblit v1.8.0