| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | async loadmaindata () { |
| | | const { setting } = this.state |
| | | let param = this.getDefaultParam() |
| | | |
| | | this.setState({ |
| | |
| | | if (result.status) { |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.LongParam = Utils.UnformatOptions(item.LongParam) |
| | | item.key = index |
| | | item.$$uuid = item[setting.primaryKey] || '' |
| | | return item |
| | | }), |
| | | total: result.total, |
| | |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | MKEmitter.emit('resetTable', this.props.MenuID) // 列表重置 |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 列表重置 |
| | | MKEmitter.emit('resetTable', this.props.MenuID) // 列表重置 |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | |
| | | }, () => { |
| | | this.loadconfig() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项 |
| | | */ |
| | | refreshbyaction = (btn, type) => { |
| | | if (btn.execSuccess === 'grid' && type === 'success') { |
| | | this.reloadtable() |
| | | } else if (btn.execError === 'grid' && type === 'error') { |
| | | this.reloadtable() |
| | | } else if (btn.execSuccess === 'view' && type === 'success') { |
| | | this.reloadview() |
| | | } else if (btn.execError === 'view' && type === 'error') { |
| | | this.reloadview() |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | MenuID={this.props.MenuID} |
| | | selectedData={selectedData} |
| | | ContainerId={this.state.ContainerId} |
| | | refreshdata={this.refreshbyaction} |
| | | refreshdata={this.reloadtable} |
| | | /> |
| | | <div className="main-table-box"> |
| | | {this.state.data && this.state.data.length > 0 ? |
| | |
| | | </div> : null |
| | | } |
| | | <MainTable |
| | | tableId="mainTable" |
| | | tableId={this.props.MenuID} |
| | | pickup={pickup} |
| | | setting={setting} |
| | | columns={columns} |
| | |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={() => {}} |
| | | handleTableId={() => {}} |
| | | chgSelectData={this.changeSelectedData} |
| | | /> |
| | | </div> |