| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | let setting = {..._config.setting, ..._config.wrap} |
| | | setting.tableId = Utils.getuuid() |
| | | |
| | |
| | | setting.operType = 'btnMode' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | let _columns = [] |
| | | let signAdd = false |
| | | _config.cols.forEach(column => { |
| | |
| | | |
| | | return !cell.Hide |
| | | }) |
| | | } |
| | | |
| | | if (column.type === 'custom') { |
| | | column.elements = column.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | } else if (column.type === 'action') { |
| | | column.operations = column.elements |
| | | } |
| | | |
| | | _columns.push(column) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, setting, actions, config, columns, BData, selectedData, lock } = this.state |
| | | const { BID, setting, actions, config, columns, BData, data, selectedData, lock } = this.state |
| | | |
| | | let style = {...config.style} |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) { |
| | | style.display = 'none' |
| | | } |
| | | |
| | | return ( |
| | | <div className="custom-edit-table" id={'anchor' + config.uuid} style={config.style}> |
| | | <div className="custom-edit-table" id={'anchor' + config.uuid} style={style}> |
| | | <NormalHeader config={config}/> |
| | | {config.search && config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |