From 37a134bd23ec4b227a0e010b08a1a89c2bbaaa0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 03 十一月 2020 17:10:14 +0800 Subject: [PATCH] 2020-11-03 --- src/tabviews/custom/index.jsx | 43 ++++++++++++++----------------------------- 1 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index cd29a77..a3a5325 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import {connect} from 'react-redux' +import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { notification, Spin, Row, Col, Button, message } from 'antd' import moment from 'moment' @@ -22,6 +22,7 @@ const AntvTabs = asyncSpinComponent(() => import('./components/tabs/antv-tabs')) const DataCard = asyncSpinComponent(() => import('./components/card/data-card')) const PropCard = asyncSpinComponent(() => import('./components/card/prop-card')) +const MainSearch = asyncSpinComponent(() => import('./components/search/main-search')) class CustomPage extends Component { static propTpyes = { @@ -365,27 +366,6 @@ }) } - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - this.setState({ - mainSearch: searches - }) - } - - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ loadingview: true, viewlost: false, lostmsg: '', data: null, loading: false, search: '' - }, () => { - this.loadconfig() - }) - } - handleviewconfig = (e) => { e.stopPropagation() @@ -413,12 +393,7 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { - if (nextProps.refreshTab.position === 'view') { - this.reloadview() - } - this.props.refreshTabView('') - } + } shouldComponentUpdate (nextProps, nextState) { @@ -432,6 +407,10 @@ this.setState = () => { return } + } + + resetSearch = (search) => { + this.setState({mainSearch: search}) } getComponents = () => { @@ -453,10 +432,16 @@ <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> </Col> ) + } else if (item.type === 'search') { + return ( + <Col span={item.width} key={item.uuid}> + <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> + </Col> + ) } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> </Col> ) } else if (item.type === 'card') { -- Gitblit v1.8.0