| | |
| | | import options from '@/store/options.js' |
| | | import { buttonConfig, tabConfig } from '../config' |
| | | |
| | | import SubTable from '@/tabviews/zshare/normalTable' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import SubAction from '../actionList' |
| | | import SubSearch from '../topSearch' |
| | | |
| | | import './index.scss' |
| | | |
| | | const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) |
| | | |
| | | class VerupSubTabViewTable extends Component { |
| | | static propTpyes = { |
| | |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | selectedData: [], // 已选表格数据 |
| | | resetTable: false, // 表格重置,值在true与false之间切换,切换时表格重置 |
| | | total: 0, // 总数 |
| | | loading: false, // 列表数据加载中 |
| | | pageIndex: 1, // 页码 |
| | |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.refs.subTable.resetTable() |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | this.setState({ |
| | | pageIndex: 1, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable, |
| | | }, () => { |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | }) |
| | | } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | |
| | | this.reloadtable() |
| | |
| | | * 含有初始不加载的页面,修改设置 |
| | | */ |
| | | refreshbysearch = (searches) => { |
| | | this.refs.subTable.resetTable() |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | | search: searches |
| | | selectedData: [], |
| | | search: searches, |
| | | resetTable: !this.state.resetTable |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | selectedData: [], |
| | | pageIndex: pagination.current, |
| | | pageSize: pagination.pageSize, |
| | | orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' |
| | |
| | | * @description 表格刷新 |
| | | */ |
| | | reloadtable = () => { |
| | | this.refs.subTable.resetTable() |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1 |
| | | pageIndex: 1, |
| | | selectedData: [], |
| | | resetTable: !this.state.resetTable |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格选择项切换 |
| | | */ |
| | | changeSelectedData = (selectedData) => { |
| | | this.setState({selectedData}) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表格选择项 |
| | | */ |
| | | gettableselected = () => { |
| | | let data = [] |
| | | this.refs.subTable.state.selectedRowKeys.forEach(item => { |
| | | data.push(this.refs.subTable.props.data[item]) |
| | | }) |
| | | return data |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type = this.props.Tab.uuid, id = '', data = '') => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { config, setting, searchlist, actions, columns, pickup } = this.state |
| | | const { config, setting, searchlist, actions, columns, pickup, selectedData } = this.state |
| | | |
| | | return ( |
| | | <div className="subtable" id={'subtable' + this.props.MenuID}> |
| | |
| | | {actions ? |
| | | <div className="sub-action"> |
| | | <SubAction |
| | | ref="subButton" |
| | | type="sub" |
| | | setting={setting} |
| | | actions={actions} |
| | |
| | | BID={this.props.BID} |
| | | BData={this.props.BData} |
| | | dict={this.state.dict} |
| | | selectedData={selectedData} |
| | | MenuID={this.props.SupMenuID} |
| | | logcolumns={this.state.logcolumns} |
| | | refreshdata={this.refreshbyaction} |
| | | ContainerId={this.props.ContainerId} |
| | | getexceloutparam={this.getexceloutparam} |
| | | gettableselected={this.gettableselected} |
| | | /> |
| | | </div> : null |
| | | } |
| | |
| | | <Switch title="收起" className="subtable-pickup" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null |
| | | } |
| | | <SubTable |
| | | ref="subTable" |
| | | menuType="HS" |
| | | tableId={this.props.Tab.uuid} |
| | | pickup={pickup} |
| | | config={config} |
| | |
| | | refreshdata={this.refreshbytable} |
| | | buttonTrigger={() => {}} |
| | | handleTableId={this.handleTableId} |
| | | resetTable={this.state.resetTable} |
| | | chgSelectData={this.changeSelectedData} |
| | | /> |
| | | </div> : null |
| | | } |