From 95afd40fc2741ac0ce59c2091f6cfce1f98877d4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 六月 2021 09:15:45 +0800 Subject: [PATCH] 2021-06-24 --- src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx b/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx index 4a560c4..101f3ab 100644 --- a/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searcheditable/index.jsx @@ -116,9 +116,8 @@ <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> <Popconfirm - title={props.dict['header.form.query.delete']} - okText={props.dict['model.confirm']} - cancelText={props.dict['model.cancel']} + overlayClassName="popover-confirm" + title={props.dict['model.query.delete']} onConfirm={() => this.handleDelete(record.key) }> <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> @@ -172,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 = () => { @@ -186,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 => { @@ -201,6 +203,7 @@ ...row }) this.setState({ dataSource: newData }) + this.props.onChange && this.props.onChange(newData) } resetColumn = (type) => { @@ -227,9 +230,8 @@ <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> <Popconfirm - title={this.props.dict['header.form.query.delete']} - okText={this.props.dict['model.confirm']} - cancelText={this.props.dict['model.cancel']} + overlayClassName="popover-confirm" + title={this.props.dict['model.query.delete']} onConfirm={() => this.handleDelete(record.key) }> <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> -- Gitblit v1.8.0