From a4ba5d208b8335c634dffd612c2bf310b1dea607 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 八月 2020 15:49:30 +0800 Subject: [PATCH] 2020-08-17 --- src/templates/sharecomponent/fieldscomponent/index.jsx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 07aa9f6..ad2643a 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -60,6 +60,13 @@ columns.set(item.field, {...item, selected: true, datatype: _datatype}) } }) + } else if (type === 'fields') { + config.columns.forEach(item => { + if (columns.has(item.field)) { + let _datatype = columns.get(item.field).datatype + columns.set(item.field, {...item, selected: true, datatype: _datatype}) + } + }) } // 鏄剧ず瀛楁闆嗗脊绐� @@ -183,18 +190,60 @@ items.push(newcard) } }) + } else if (type === 'fields') { + config.columns.forEach(item => { + if (columnsMap.has(item.field)) { + let cell = columnsMap.get(item.field) + + if (cell.selected) { + items.push(item) + } + columnsMap.delete(item.field) + } else { + items.push(item) + } + }) + + let _columns = [...columnsMap.values()] + + _columns.forEach(item => { + if (item.selected) { + let newcard = { + uuid: Utils.getuuid(), + label: item.label, + field: item.field, + datatype: item.type === 'number' ? 'Decimal(18,0)' : 'Nvarchar(50)' + } + + items.push(newcard) + } + }) } let _config = null if (type === 'search') { _config = {...this.props.config, search: items} + + this.props.updatefield(_config) + + notification.success({ + top: 92, + message: '鎿嶄綔鎴愬姛', + duration: 2 + }) } else if (type === 'columns') { _config = {...this.props.config, columns: items} - } - if (_config) { this.props.updatefield(_config) + + notification.success({ + top: 92, + message: '鎿嶄綔鎴愬姛', + duration: 2 + }) + } else if (type === 'fields') { + this.props.updatefield(items) notification.success({ top: 92, @@ -225,11 +274,13 @@ if (type === 'search') { label = dict['header.menu.search.add'] } else if (type === 'columns') { - label = dict['header.menu.column.add'] + label = dict['model.menu.column.add'] + } else if (type === 'fields') { + label = dict['model.menu.field.add'] } return ( - <div> + <div className="quickly-add"> <Button type="primary" block onClick={this.queryField}>{label}</Button> {/* 鏍规嵁瀛楁鍚嶆坊鍔犳樉绀哄垪鍙婃悳绱㈡潯浠� */} <Modal -- Gitblit v1.8.0