| | |
| | | }) |
| | | } |
| | | |
| | | tolowercase = (type) => { |
| | | const that = this |
| | | confirm({ |
| | | content: type === 'sub' ? '确定将子表字段转为小写吗?' : '确定将字段转为小写吗?', |
| | | onOk() { |
| | | that.execlowercase(type) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | execlowercase = (type) => { |
| | | const { subColumns, columns } = this.state |
| | | |
| | | if (type === 'sub') { |
| | | this.setState({subColumns: fromJS(subColumns).toJS().map(col => { |
| | | col.field = col.field.toLowerCase() |
| | | return col |
| | | })}) |
| | | } else { |
| | | this.setState({columns: fromJS(columns).toJS().map(col => { |
| | | col.field = col.field.toLowerCase() |
| | | return col |
| | | })}) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | type="fields" |
| | | updatefield={this.updatefields} |
| | | /> |
| | | <SwapOutlined className="columns-lowercase" title="转小写" onClick={() => this.tolowercase()}/> |
| | | <ExcelOut data={columns} setting={setting}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> |
| | | </TabPane> : <TabPane tab={ |
| | |
| | | type="fields" |
| | | updatefield={this.updateSubfields} |
| | | /> |
| | | <SwapOutlined className="columns-lowercase" title="转小写" onClick={() => this.tolowercase('sub')}/> |
| | | <ExcelOut data={subColumns} setting={setting}/> |
| | | <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.subdatasource = inst} data={subColumns} columns={colColumns} onChange={(subColumns) => this.setState({subColumns})}/> |
| | | </TabPane> : null} |