From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- src/tabviews/custom/components/carousel/data-card/index.jsx | 40 ++++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 56b9535..8e744fc 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -29,6 +29,7 @@ sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 card: null, // 鍗$墖璁剧疆 data: null, // 鏁版嵁 + BData: null } UNSAFE_componentWillMount () { @@ -92,7 +93,7 @@ componentDidMount () { MKEmitter.addListener('resetSelectLine', this.resetParentParam) - MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } @@ -117,12 +118,10 @@ }) this.setState({sync: false, data: _data}) - } else if (nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { - if (config.setting.syncRefresh === 'true') { - this.setState({}, () => { - this.loadData() - }) - } + } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { + this.setState({}, () => { + this.loadData() + }) } } @@ -131,7 +130,7 @@ return } MKEmitter.removeListener('resetSelectLine', this.resetParentParam) - MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } @@ -165,7 +164,7 @@ if (!config.setting.supModule || config.setting.supModule !== MenuID) return if (id !== this.state.BID) { - this.setState({ BID: id }, () => { + this.setState({ BID: id, BData: data }, () => { this.loadData() }) } @@ -174,15 +173,15 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - getexceloutparam = (menuId, btnId) => { + queryModuleParam = (menuId, btnId) => { const { mainSearch } = this.props const { arr_field, config } = this.state if (config.uuid !== menuId) return - let searches = mainSearch ? fromJS(mainSearch).toJS() : [] + let searches = config.setting.useMSearch && mainSearch ? fromJS(mainSearch).toJS() : [] - MKEmitter.emit('execExcelout', config.uuid, btnId, { + MKEmitter.emit('returnModuleParam', config.uuid, btnId, { arr_field: arr_field, orderBy: config.setting.order || '', search: searches, @@ -192,7 +191,7 @@ async loadData () { const { mainSearch, menuType } = this.props - const { config, arr_field, BID } = this.state + const { config, arr_field, BID, BData } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ @@ -202,7 +201,11 @@ return } - let searches = mainSearch ? fromJS(mainSearch).toJS() : [] + let searches = config.setting.useMSearch && mainSearch ? fromJS(mainSearch).toJS() : [] + let requireFields = searches.filter(item => item.required && item.value === '') + if (requireFields.length > 0) { + return + } this.setState({ loading: true @@ -218,6 +221,7 @@ item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' + item.$$BData = BData || '' return item }), loading: false @@ -261,10 +265,10 @@ } if (card.setting.joint === 'true') { - newtab.param.BID = item.$$uuid + newtab.param.$BID = item.$$uuid } - if (['linkage_navigation', 'linkage'].includes(window.GLOB.navBar)) { + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { this.props.modifyTabview([newtab]) } else { let tabs = this.props.tabviews.filter((tab, i) => { @@ -272,7 +276,7 @@ return tab.MenuID !== newtab.MenuID }) - if (this.props.tabviews.length !== tabs.length) { + if (this.props.tabviews.length > tabs.length) { this.props.modifyTabview(fromJS(tabs).toJS()) } @@ -315,7 +319,7 @@ const { config, loading, data, card } = this.state return ( - <div className="custom-data-carousel-box" style={{...config.style, minHeight: config.wrap.minHeight}}> + <div className="custom-data-carousel-box" style={config.style}> {loading ? <div className="loading-mask"> {data ? <div className="ant-spin-blur"></div> : null} -- Gitblit v1.8.0