From 822bc67061448c6e3a1eb77d39be4ad2b84b416a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 27 二月 2020 09:36:34 +0800 Subject: [PATCH] 2020-02-27 --- src/templates/tableshare/verifycardexcelin/index.jsx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/src/templates/tableshare/verifycardexcelin/index.jsx b/src/templates/tableshare/verifycardexcelin/index.jsx index e5b8a3e..7c57b0d 100644 --- a/src/templates/tableshare/verifycardexcelin/index.jsx +++ b/src/templates/tableshare/verifycardexcelin/index.jsx @@ -12,6 +12,7 @@ class VerifyCard extends Component { static propTpyes = { + columns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� card: PropTypes.object, } @@ -153,6 +154,52 @@ range: _verify.range || 0, columns: _columns, scripts: _verify.scripts || [] + } + }) + } + + columnFieldInput = () => { + const { columns } = this.props + const { verify } = this.state + + let _columns = JSON.parse(JSON.stringify(verify.columns)) + + let _cols = _columns.map(col => col.Column ) + + columns.forEach(col => { + if (col.field && !_cols.includes(col.field)) { + let _type = 'Nvarchar(50)' + let _limit = '50' + if (col.type === 'number' && col.decimal === 0) { + _type = 'Int' + _limit = '' + } else if (col.type === 'number') { + _type = 'Decimal(18,' + col.decimal + ')' + _limit = col.decimal + } + + let _cell = { + uuid: col.uuid, + Column: col.field, + Text: col.label, + type: _type, + limit: _limit, + required: 'true' + } + + if (_type !== 'Nvarchar(50)') { + _cell.min = 0 + _cell.max = 999999 + } + + _columns.push(_cell) + } + }) + + this.setState({ + verify: { + ...verify, + columns: _columns } }) } @@ -441,6 +488,9 @@ columnChange={this.columnChange} wrappedComponentRef={(inst) => this.columnForm = inst} /> + <Button className="excel-col-add" title="娣诲姞鏄剧ず鍒楀瓧娈�" onClick={this.columnFieldInput} type="primary"> + 蹇嵎娣诲姞 + </Button> <Table bordered rowKey="uuid" -- Gitblit v1.8.0