From 8190d6e5ac14616d85e3992169ecef6d99d03b76 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 13 十一月 2020 15:29:57 +0800 Subject: [PATCH] 2020-11-13 --- src/tabviews/custom/index.jsx | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index f667bbb..5d699e3 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -36,12 +36,12 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id - BID: null, // 椤甸潰璺宠浆鏃舵惡甯D + BID: '', // 椤甸潰璺宠浆鏃舵惡甯D loadingview: true, // 椤甸潰鍔犺浇涓� viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 - mainSearch: null, + mainSearch: null, // 涓绘悳绱� userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� data: null, // 鍒楄〃鏁版嵁闆� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� @@ -81,7 +81,7 @@ userConfig = null } } - + // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { this.setState({ @@ -141,7 +141,7 @@ let params = [] let BID = param && param.BID ? param.BID : '' - config.components = this.formatSetting(config.components, params, mainSearch, permAction, BID) + config.components = this.formatSetting(config.components, params, mainSearch, permAction) this.setState({ BID: BID, @@ -209,7 +209,7 @@ } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, mainSearch, permAction, BID) => { + formatSetting = (components, params, mainSearch, permAction) => { return components.map(component => { if (component.type === 'tabs') { component.subtabs = component.subtabs.map(tab => { @@ -268,7 +268,7 @@ // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') { - let param = this.getDefaultParam(component, mainSearch, BID) + let param = this.getDefaultParam(component, mainSearch) params.push(param) } else if (component.floor === 1) { component.setting.sync = 'false' @@ -281,7 +281,7 @@ /** * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ - getDefaultParam = (component, mainSearch, BID) => { + getDefaultParam = (component, mainSearch) => { const { columns, search, setting, dataName, format } = component let searchlist = [] @@ -318,9 +318,6 @@ } _customScript = _customScript.replace(item.reg, item.value) }) - - _dataresource = _dataresource.replace(/@BID@/ig, BID) - _customScript = _customScript.replace(/@BID@/ig, BID) } let _search = '' @@ -377,7 +374,8 @@ let param = { func: 'sPC_Get_structured_data', LText: LText.join(' union all '), - LText_field: LText_field.join(' union all ') + LText_field: LText_field.join(' union all '), + BID: this.state.BID || '' } param.LText = Utils.formatOptions(param.LText) @@ -439,7 +437,10 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - + if (nextProps.refreshTab && nextProps.refreshTab.MenuID === this.props.MenuID) { + this.reloadview() + this.props.refreshTabView('') + } } shouldComponentUpdate (nextProps, nextState) { @@ -453,6 +454,18 @@ this.setState = () => { return } + } + + reloadview = () => { + this.setState({ + BID: '', // 椤甸潰璺宠浆鏃舵惡甯D + loadingview: true, // 椤甸潰鍔犺浇涓� + viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 + config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 + loading: false // 鍒楄〃鏁版嵁鍔犺浇涓� + }, () => { + this.loadconfig() + }) } resetSearch = (search) => { @@ -537,7 +550,6 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - tabviews: state.tabviews, refreshTab: state.refreshTab, permAction: state.permAction, permRoles: state.permRoles, -- Gitblit v1.8.0