From bde2916433c7830e2879e6524e32b9f6c8bd0bab Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 02 一月 2022 16:31:32 +0800 Subject: [PATCH] 2022-01-02 --- src/tabviews/zshare/actionList/popupbutton/index.jsx | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index bf0e1e3..19e2982 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -23,6 +23,7 @@ MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 + disabled: PropTypes.any, // 琛屾寜閽鐢� } state = { @@ -59,6 +60,10 @@ } } } + + if (this.props.disabled || disabled) { + this.setState({disabled: true}) + } } shouldComponentUpdate (nextProps, nextState) { @@ -75,9 +80,8 @@ UNSAFE_componentWillReceiveProps (nextProps) { const { btn, selectedData, BData } = this.props + let disabled = false if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { - let disabled = false - if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 琛ㄦ牸涓寜閽殣钘忔帶鍒� nextProps.selectedData.forEach(item => { let s = item[btn.controlField] + '' @@ -86,7 +90,7 @@ } }) } - this.setState({disabled, hidden: disabled && btn.control === 'hidden'}) + this.setState({hidden: disabled && btn.control === 'hidden'}) } else if (btn.control === 'parent' && !is(fromJS(nextProps.BData || {}), fromJS(BData || {}))) { if (!nextProps.BData || !nextProps.BData.hasOwnProperty(btn.controlField)) { this.setState({hidden: true}) @@ -98,6 +102,12 @@ this.setState({hidden: false}) } } + } + + if (nextProps.disabled || disabled) { + this.setState({disabled: true}) + } else { + this.setState({disabled: false}) } } @@ -279,7 +289,7 @@ return ( <Drawer title={btn.label} - className={btn.$view === 'CustomPage' ? 'custom-drawer-popview' : ''} + className={btn.$view === 'CustomPage' ? 'custom-drawer-popview' : 'table-drawer-popview'} width={width} height={height} maskClosable={btn.clickouter === 'close'} -- Gitblit v1.8.0