From 76a4300654a18d228838c3f27455dc8e7a8cd616 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 一月 2021 17:04:42 +0800 Subject: [PATCH] Merge branch 'master' into bms --- src/tabviews/zshare/actionList/popupbutton/index.jsx | 61 ++++++++++++++++++++++-------- 1 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index c29a385..8baae5f 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -11,8 +11,9 @@ import './index.scss' const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) +const CustomPage = asyncSpinComponent(() => import('@/tabviews/custom')) -class NormalButton extends Component { +class PopupButton extends Component { static propTpyes = { show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 position: PropTypes.any, // 鎸夐挳浣嶇疆锛屽伐鍏锋爮涓簍oolbar @@ -23,7 +24,6 @@ MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� } state = { @@ -44,15 +44,47 @@ if (position === 'toolbar') { MKEmitter.addListener('triggerBtnId', this.actionTrigger) } + MKEmitter.addListener('openNewTab', this.openNewTab) + MKEmitter.addListener('refreshPopButton', this.refreshPopButton) } componentWillUnmount () { this.setState = () => { return } + MKEmitter.removeListener('openNewTab', this.openNewTab) MKEmitter.removeListener('triggerBtnId', this.actionTrigger) + MKEmitter.removeListener('refreshPopButton', this.refreshPopButton) } + /** + * @description 鎵撳紑鏂版爣绛炬椂锛屽叧闂脊绐楁爣绛鹃〉 + */ + openNewTab = () => { + this.setState({ + visible: false, + loading: false + }) + } + + /** + * @description 寮圭獥鏍囩椤靛埛鏂� + */ + refreshPopButton = (tabId) => { + const { btn } = this.props + + if (btn.uuid !== tabId) return + + if (btn.$type === 'CustomPage') { + if (btn.popClose !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) + } + } else { + let position = btn.popClose !== 'never' ? btn.popClose : 'grid' + MKEmitter.emit('refreshByButtonResult', btn.$menuId, position, btn) + } + } + /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ @@ -114,12 +146,6 @@ }) } - // 鎿嶄綔鍚庡埛鏂颁富琛� - reloadtable = () => { - const { btn } = this.props - this.props.updateStatus('refresh', 'grid', btn) - } - /** * @description 寮圭獥鍏抽棴 */ @@ -131,7 +157,9 @@ loading: false }) - this.props.updateStatus('refresh', btn.popClose, btn) + if (btn.popClose !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) + } } render() { @@ -148,15 +176,16 @@ >{btn.label}</Button> : null} {show !== 'actionList' ? <Button type="link" + title={show === 'icon' ? btn.label : ''} loading={loading} style={btn.btnstyle} icon={show === 'text' ? '' : (btn.icon || '')} onClick={() => {this.actionTrigger()}} >{show === 'icon' && btn.icon ? '' : btn.label}</Button> : null} <Modal - className="popview-modal" + className={'popview-modal ' + (btn.$type === 'CustomPage' ? 'custom-popview' : '')} title={btn.label} - width={'80vw'} + width={'85vw'} maskClosable={false} visible={this.state.visible} onCancel={this.popclose} @@ -165,14 +194,14 @@ ]} destroyOnClose > - <SubTabTable + {btn.$type !== 'CustomPage' ? <SubTabTable Tab={btn} MenuID={btn.linkTab} + SupMenuID={this.props.MenuID} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData} - SupMenuID={this.props.MenuID} - refreshSupView={this.reloadtable} - /> + /> : null} + {btn.$type === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null} </Modal> </div> ) @@ -189,4 +218,4 @@ return {} } -export default connect(mapStateToProps, mapDispatchToProps)(NormalButton) \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(PopupButton) \ No newline at end of file -- Gitblit v1.8.0