| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { BackTop, notification, Spin, Tabs} from 'antd' |
| | | import { BackTop, notification, Spin, Tabs, Icon} from 'antd' |
| | | import moment from 'moment' |
| | | import Api from '@/api' |
| | | import MainSearch from './mainSearch' |
| | |
| | | MenuID: this.props.MenuID |
| | | } |
| | | let result = await Api.getSystemCacheConfig(param) |
| | | if (result.status && result.LongParam) { |
| | | if (result.status) { |
| | | let config = '' |
| | | |
| | | try { // 配置信息解析 |
| | |
| | | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.page.settingerror'], |
| | | duration: 10 |
| | | this.setState({ |
| | | loadingview: false, |
| | | viewlost: true |
| | | }) |
| | | return |
| | | } |
| | |
| | | loading: true |
| | | }, () => { |
| | | this.improveSearch() |
| | | this.loadmaindata() |
| | | if (config.setting.onload !== 'false') { |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | } |
| | | |
| | | refreshbysearch = (searches) => { |
| | | const { setting } = this.state |
| | | // 搜索条件变化 |
| | | this.refs.mainTable.resetTable() |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | if (setting.onload === 'false') { |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | | search: searches, |
| | | setting: {...setting, onload: 'true'} |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } else { |
| | | this.refs.mainTable.resetTable() |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | pageIndex: 1, |
| | | search: searches |
| | | }, () => { |
| | | this.loadmaindata() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | refreshbytable = (pagination, filters, sorter) => { |
| | |
| | | |
| | | render() { |
| | | const { setting, searchlist, actions, columns, loadingview, viewlost, tabviews } = this.state |
| | | console.log(setting) |
| | | |
| | | return ( |
| | | <div className="commontable" id={'commontable' + this.props.MenuID}> |
| | | {loadingview && <Spin size="large" />} |
| | |
| | | dict={this.state.dict} |
| | | /> : null |
| | | } |
| | | {actions && |
| | | {actions && setting.onload !== 'false' && |
| | | <MainAction |
| | | ref="mainButton" |
| | | MenuID={this.props.MenuID} |
| | |
| | | dict={this.state.dict} |
| | | /> |
| | | } |
| | | {columns && |
| | | {columns && setting.onload !== 'false' && |
| | | <MainTable |
| | | ref="mainTable" |
| | | dict={this.state.dict} |
| | |
| | | buttonTrigger={this.buttonTrigger} |
| | | /> |
| | | } |
| | | {setting && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && |
| | | {setting && setting.onload !== 'false' && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && |
| | | <Tabs defaultActiveKey="0" tabPosition="top"> |
| | | {tabviews.map((_tab, index) => ( |
| | | <TabPane tab={ _tab.label } key={`${index}`}> |
| | | {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={this.props.MenuID} BID={this.state.BID} /> : null} |
| | | <TabPane tab={ |
| | | <span> |
| | | {_tab.icon ? <Icon type={_tab.icon} /> : null} |
| | | {_tab.label} |
| | | </span> |
| | | } key={`${index}`}> |
| | | {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={_tab.linkTab} BID={this.state.BID} /> : null} |
| | | </TabPane> |
| | | ))} |
| | | </Tabs> |