From 106263ec10e60ce6c406e4fd5eb76d195772d0f0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 18 十二月 2020 18:07:05 +0800 Subject: [PATCH] 2020-12-18 --- src/tabviews/custom/components/card/table-card/index.jsx | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 140a11c..cb76eae 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -3,13 +3,15 @@ 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 = { @@ -24,13 +26,12 @@ BID: '', // 涓婄骇ID config: null, // 鍥捐〃閰嶇疆淇℃伅 loading: false, // 鏁版嵁鍔犺浇鐘舵�� + search: null, // 鎼滅储鏉′欢 preIndex: 0, // 寮�濮嬬储寮� pageIndex: 1, // 椤电爜 total: 0, // 鎬绘暟 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 data: null, // 鏁版嵁 - title: '', // 鏍囬 - showHeader: false // 瀛樺湪鏍囬銆佹悳绱� } /** @@ -87,12 +88,11 @@ }) 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') { @@ -172,7 +172,7 @@ 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({ @@ -183,7 +183,7 @@ return } - let searches = [] + let searches = fromJS(search).toJS() if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 let keys = searches.map(item => item.key) mainSearch.forEach(item => { @@ -292,8 +292,17 @@ 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}}> @@ -303,10 +312,7 @@ <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} -- Gitblit v1.8.0