From b3547d1c531e479021219fda5df153a11b9b52a3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 31 八月 2020 17:28:09 +0800 Subject: [PATCH] 2020-08-31 --- src/templates/sharecomponent/tablecomponent/index.jsx | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index 543f4ee..3979db7 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -97,23 +97,15 @@ columns: res.FDName.map(item => { let _type = item.FieldType.toLowerCase() let _decimal = 0 + let _length = 50 if (/^nvarchar/.test(_type)) { + _length = +_type.match(/\d+/)[0] || 50 _type = 'text' } else if (/^int/.test(_type)) { _type = 'number' } else if (/^decimal/.test(_type)) { _decimal = _type.split(',')[1] _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } _type = 'number' } else if (/^datetime/.test(_type)) { _type = 'datetime' @@ -128,7 +120,8 @@ label: item.FieldDec, type: _type, datatype: _type, - decimal: _decimal + decimal: _decimal, + length: _length, } }) } @@ -173,7 +166,9 @@ columns: res.FDName.map(item => { let _type = item.FieldType.toLowerCase() let _decimal = 0 + let _length = 50 if (/^nvarchar/.test(_type)) { + _length = +_type.match(/\d+/)[0] || 50 _type = 'text' } else if (/^int/.test(_type)) { _type = 'number' @@ -194,7 +189,8 @@ label: item.FieldDec, type: _type, datatype: _type, - decimal: _decimal + decimal: _decimal, + length: _length } }) } -- Gitblit v1.8.0