| | |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.autoMatic) { |
| | | if (result.data && result.data.length > 0) { |
| | | MKEmitter.emit('autoGetData', config.MenuID) |
| | | } else { |
| | | MKEmitter.emit('autoMaticOver', config.MenuID) |
| | | } |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | |
| | | if (config.autoMatic) { |
| | | MKEmitter.emit('autoMaticError', config.MenuID) |
| | | } |
| | | |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | |
| | | * @description 表格条件改变时重置数据(分页或排序) |
| | | */ |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | | if (sorter.order) { |
| | | let _chg = { |
| | | ascend: 'asc', |
| | | descend: 'desc' |
| | | if (!sorter) { // 无人值守 |
| | | this.setState({ |
| | | pageIndex: pagination.pageIndex |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } else { |
| | | if (sorter.order) { |
| | | let _chg = { |
| | | ascend: 'asc', |
| | | descend: 'desc' |
| | | } |
| | | sorter.order = _chg[sorter.order] |
| | | } |
| | | sorter.order = _chg[sorter.order] |
| | | |
| | | this.setState({ |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | render() { |
| | | const { BID, setting, actions, config, columns, selectedData, BData, data } = this.state |
| | | |
| | | |
| | | return ( |
| | | <div className="custom-base-table" style={config.style}> |
| | | {config.search.length ? |
| | | <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null |
| | | } |
| | | {actions.length ? <MainAction |
| | | {actions.length > 0 ? <MainAction |
| | | BID={BID} |
| | | setting={setting} |
| | | actions={actions} |
| | | BData={BData} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | /> : <div style={{height: '15px'}}></div>} |
| | | /> : <div style={{height: '25px'}}></div>} |
| | | <div className="main-table-box"> |
| | | <MainTable |
| | | data={data} |
| | |
| | | MenuID={config.uuid} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | autoMatic={config.autoMatic} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |