| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, notification, Col, Empty, Pagination } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const CardCellComponent = asyncComponent(() => import('../cardcellList')) |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | |
| | | class TableCard extends Component { |
| | | static propTpyes = { |
| | |
| | | BID: '', // 上级ID |
| | | config: null, // 图表配置信息 |
| | | loading: false, // 数据加载状态 |
| | | search: null, // 搜索条件 |
| | | preIndex: 0, // 开始索引 |
| | | pageIndex: 1, // 页码 |
| | | total: 0, // 总数 |
| | | sync: false, // 是否统一请求数据 |
| | | data: null, // 数据 |
| | | title: '', // 标题 |
| | | showHeader: false // 存在标题、搜索 |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | |
| | | this.setState({ |
| | | showHeader: showHeader, |
| | | title: _config.wrap.title, |
| | | sync: _sync, |
| | | BID: BID || '', |
| | | data: _data, |
| | | config: _config, |
| | | search: Utils.initMainSearch(_config.search), |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, BID } = this.state |
| | | const { config, arr_field, pageIndex, search, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | |
| | | return |
| | | } |
| | | |
| | | let searches = [] |
| | | let searches = fromJS(search).toJS() |
| | | if (mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key) |
| | | mainSearch.forEach(item => { |
| | |
| | | return line |
| | | } |
| | | |
| | | refreshSearch = (list) => { |
| | | this.setState({ |
| | | search: list, |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, loading, data, title, showHeader, pageIndex, preIndex, total } = this.state |
| | | const { config, loading, data, BID, pageIndex, preIndex, total } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-table-card-box" style={{...config.style, height: config.wrap.height}}> |
| | |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | {showHeader ? <div className="table-header" style={config.headerStyle}> |
| | | <span className="table-title">{title}</span> |
| | | {/* <searchLine /> */} |
| | | </div> : null} |
| | | <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} /> |
| | | {data && data.length > 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}> |
| | | {data.map((item, index) => this.getLines(item, preIndex + index + 1))} |
| | | </div> : null} |