From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 七月 2021 11:39:39 +0800 Subject: [PATCH] 2021-07-28 --- src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx b/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx index 7465a79..eb43982 100644 --- a/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx @@ -113,14 +113,14 @@ render: (text, record) => this.state.dataSource.length >= 1 ? ( <div> - <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> + <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> <Popconfirm overlayClassName="popover-confirm" title={props.dict['model.query.delete']} onConfirm={() => this.handleDelete(record.key) }> - <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> + <span style={{color: '#ff4d4f', cursor: 'pointer'}}><Icon type="delete" /></span> </Popconfirm> </div> ) : null, @@ -171,8 +171,9 @@ } handleDelete = key => { - const dataSource = [...this.state.dataSource] - this.setState({ dataSource: dataSource.filter(item => item.key !== key) }) + const dataSource = this.state.dataSource.filter(item => item.key !== key) + this.setState({ dataSource }) + this.props.onChange && this.props.onChange(dataSource) } handleAdd = () => { @@ -185,10 +186,12 @@ if (type === 'link') { newData.ParentID = `${count}` } + let data = [...dataSource, newData] this.setState({ - dataSource: [...dataSource, newData], + dataSource: data, count: count + 1 }) + this.props.onChange && this.props.onChange(data) } handleSave = row => { @@ -200,6 +203,7 @@ ...row }) this.setState({ dataSource: newData }) + this.props.onChange && this.props.onChange(newData) } resetColumn = (type) => { -- Gitblit v1.8.0