From 29c5821ce140e89a8b35e53f41672dd86da56982 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2020 18:43:38 +0800 Subject: [PATCH] 2020-02-18 --- src/tabviews/formtab/index.jsx | 62 +++++++++++++++++-------------- 1 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index f64cfe6..7e20e0a 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -44,10 +44,10 @@ BIDs: {}, // 涓婄骇琛╥d setsingle: false, // 涓昏〃鍗曢�夊閫夊垏鎹� pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - isLinkMain: false, // 鏄惁瀛樺湪涓庝富琛ㄥ叧鑱旂殑瀛愯〃 popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - primaryId: null + primaryId: null, + refreshtabs: null } /** @@ -111,34 +111,11 @@ // if (!config[group]) return // config[group] = config[group].filter(tab => permAction[tab.uuid]) // }) - - let _isLinkMain = false // 妫�鏌ユ槸鍚︽湁涓庝富琛ㄥ叧鑱旂殑瀛愯〃 - let supmenus = {} - config.tabgroups.forEach(group => { - if (config[group] && config[group].length > 0) { - config[group] = config[group].map(tab => { - if (tab.subtabs && tab.subtabs.length > 0) { - tab.subtabs.forEach(id => { - supmenus[id] = tab.uuid - }) - } - if (config.setting.subtabs.includes(tab.uuid)) { - tab.supMenu = 'mainTable' - _isLinkMain = true - } else if (supmenus[tab.uuid]) { - tab.supMenu = supmenus[tab.uuid] - } - - return tab - }) - } - }) this.setState({ config: config, setting: config.setting, actions: config.action, - isLinkMain: _isLinkMain, arr_field: _arrField, primaryId: this.props.param.primaryId || '', data: config.setting.datatype === 'query' ? null : this.props.param.data, @@ -476,6 +453,34 @@ }) } + /** + * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� + */ + handleMainTable = (type, tab) => { + if (type === 'maingrid' && tab.supMenu === 'mainTable') { + this.loadmaindata() + } else if (type === 'maingrid' && tab.supMenu) { + this.setState({ + refreshtabs: [tab.supMenu] + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { + this.setState({ + refreshtabs: tab.equalTab + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } + } + + /** + * @description 鑾峰彇琛ㄥ崟鍙傛暟 + */ getFormData = () => { return this.formGroupRef.handleConfirm() } @@ -499,7 +504,7 @@ } render() { - const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state + const { setting, actions, loadingview, viewlost, config, groups, data } = this.state let hasform = false if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { @@ -507,7 +512,7 @@ } return ( - <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> + <div className="formtab" id={this.state.ContainerId}> {loadingview && <Spin size="large" />} {hasform ? <FormGroup @@ -550,11 +555,12 @@ Tab={_tab} MenuID={_tab.linkTab} SupMenuID={this.props.MenuID} + refreshtabs={this.state.refreshtabs} ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} handleTableId={this.handleTableId} - handleMainTable={this.handleMainTable} + handleMainTable={(type) => this.handleMainTable(type, _tab)} /> : null} </TabPane> ) -- Gitblit v1.8.0