| | |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | | disabled: PropTypes.any, // 行按钮禁用 |
| | | } |
| | | |
| | | state = { |
| | |
| | | excelName: '', // 文件名 |
| | | search: '', // 搜索条件 |
| | | loading: false, // 导出中 |
| | | hidden: false |
| | | hidden: false, |
| | | disabled: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, BData } = this.props |
| | | const { btn, BData, disabled } = this.props |
| | | |
| | | if (btn.control === 'parent') { |
| | | if (!BData || !BData.hasOwnProperty(btn.controlField)) { |
| | |
| | | this.setState({hidden: false}) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (disabled) { |
| | | this.setState({disabled: true}) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({hidden: false}) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (nextProps.disabled) { |
| | | this.setState({disabled: true}) |
| | | } else { |
| | | this.setState({disabled: false}) |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | actionTrigger = (triggerId) => { |
| | | const { setting, Tab, BID, btn } = this.props |
| | | const { loading } = this.state |
| | | const { loading, disabled } = this.state |
| | | |
| | | if ((triggerId && btn.uuid !== triggerId) || loading) return |
| | | if ((triggerId && btn.uuid !== triggerId) || loading || disabled) return |
| | | |
| | | if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { |
| | | notification.warning({ |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { loading, hidden } = this.state |
| | | const { loading, hidden, disabled } = this.state |
| | | |
| | | if (hidden) return null |
| | | |
| | |
| | | <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | disabled={disabled} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | loading={loading} |
| | | >{btn.label}</Button> |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | icon={icon} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |