From f895e8af9e6a393f71fec0dc26fdf1b9b6616cb4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 11 十二月 2020 18:53:04 +0800 Subject: [PATCH] 2020-12-11 --- src/menu/components/table/normal-table/columns/index.jsx | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 6a09532..b2c1597 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -119,9 +119,9 @@ ) class EditableCell extends Component { - updateCard = (vals) => { + updateCard = (vals, action) => { const { column } = this.props - this.props.upComponent({...column, elements: vals}) + this.props.upComponent({...column, elements: vals}, action) } shouldComponentUpdate (nextProps, nextState) { @@ -131,6 +131,7 @@ return !is(fromJS(column), fromJS(nextProps.column)) || !is(fromJS(config.columns), fromJS(nextProps.config.columns)) || + !is(fromJS(config.action), fromJS(nextProps.config.action)) || !is(fromJS(config.search), fromJS(nextProps.config.search)) } @@ -145,7 +146,7 @@ ) } else if (column && column.type === 'action') { return ( - <td style={{padding: '0 5px', textAlign: column.Align, minWidth: column.Width || 100}} className={className}> + <td style={{padding: '0 5px', textAlign: column.Align, minWidth: column.Width || 100}} className={'action-column ' + className}> <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> </td> ) @@ -208,6 +209,7 @@ return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) || !is(fromJS(config.search), fromJS(nextProps.config.search)) || + !is(fromJS(config.action), fromJS(nextProps.config.action)) || config.setting.laypage !== nextProps.config.setting.laypage } @@ -223,7 +225,7 @@ }) } - updateCol = (col) => { + updateCol = (col, action) => { let _columns = fromJS(this.state.columns).toJS() if (col.isSub) { @@ -250,7 +252,11 @@ this.setState({ columns: _columns, }, () => { - this.props.updatecolumn({...this.props.config, cols: _columns}) + if (action) { + this.props.updatecolumn({...this.props.config, cols: _columns, action}) + } else { + this.props.updatecolumn({...this.props.config, cols: _columns}) + } }) } @@ -392,7 +398,7 @@ cell: EditableCell } } - + const columns = this.state.columns.map((col, index) => { return { title: col.label, -- Gitblit v1.8.0