From 044a4ec4ebe85f8c00e889fe3914de17a6ea1f28 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 17 十月 2024 18:18:01 +0800 Subject: [PATCH] 2024-10-17 --- src/tabviews/zshare/actionList/popupbutton/index.jsx | 65 ++++++++++++-------------------- 1 files changed, 25 insertions(+), 40 deletions(-) diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index a92a711..c6a9e99 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -20,6 +20,7 @@ btn: PropTypes.object, // 鎸夐挳 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 disabled: PropTypes.any, // 琛屾寜閽鐢� + name: PropTypes.any } state = { @@ -29,6 +30,7 @@ disabled: false, hidden: false, loading: false, + dict: window.GLOB.dict } UNSAFE_componentWillMount () { @@ -140,31 +142,28 @@ /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (triggerId, record, type) => { - const { setting, BID, btn, selectedData } = this.props - const { loading, disabled } = this.state + actionTrigger = (triggerId, record, type, lid) => { + const { setting, BID, btn, selectedData, LID } = this.props + const { loading, disabled, dict } = this.state if (loading || disabled) return if (triggerId && btn.uuid !== triggerId) return + if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return + + let data = record || selectedData || [] if (setting.supModule && !BID) { notification.warning({ top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', + message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒', duration: 5 }) return - } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) { - return - } - - let data = record || selectedData || [] - - if (btn.Ot === 'requiredSgl' && data.length !== 1) { + } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 notification.warning({ top: 92, - message: data.length === 0 ? '璇烽�夋嫨琛岋紒' : '璇烽�夋嫨鍗曡鏁版嵁锛�', + message: data.length === 0 ? dict['select_row'] || '璇烽�夋嫨琛岋紒' : dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�', duration: 5 }) return @@ -173,9 +172,9 @@ let _data = null let primaryId = '' - if (btn.Ot === 'requiredSgl' && setting.primaryKey) { + if (btn.Ot === 'requiredSgl') { _data = data[0] - primaryId = _data.$$uuid || _data[setting.primaryKey] || '' + primaryId = _data.$$uuid || '' } this.setState({ @@ -232,7 +231,7 @@ getPop = () => { const { btn } = this.props - const { popData, primaryId, visible } = this.state + const { popData, primaryId, visible, dict } = this.state let ratio = btn.ratio || 85 @@ -250,7 +249,7 @@ visible={visible} onCancel={this.popclose} footer={[ - <Button key="close" onClick={this.popclose}>鍏抽棴</Button> + <Button key="close" onClick={this.popclose}>{dict['close'] || '鍏抽棴'}</Button> ]} destroyOnClose > @@ -294,7 +293,7 @@ {btn.$view === 'popview' ? <PopView Tab={btn} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} <div className="close-drawer"> <Button onClick={this.popclose}> - 鍏抽棴 + {dict['close'] || '鍏抽棴'} </Button> </div> </Drawer> @@ -303,45 +302,31 @@ } render() { - const { btn } = this.props + const { btn, name } = this.props const { loading, disabled, hidden } = this.state if (hidden) return null let label = '' - let icon = '' - let type = 'link' - let className = '' - if (btn.show === 'button') { - label = btn.label - icon = btn.icon || '' - } else if (btn.show === 'link') { - label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> - icon = '' + if (btn.show === 'link') { + label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span> } else if (btn.show === 'icon') { - icon = btn.icon || '' - } else if (!btn.$toolbtn) { - icon = btn.icon || '' - label = btn.label - className = 'mk-btn mk-' + btn.class + label = !loading ? <MkIcon type={btn.icon} /> : null } else { - type = '' - icon = btn.icon || '' - label = btn.label - className = 'mk-btn mk-' + btn.class + label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{name || btn.label}</span> } return ( <> <Button - type={type} + type="link" + id={'button' + btn.uuid} title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} - loading={loading} + loading={loading && !name} disabled={disabled} style={btn.style} - icon={icon} - className={className} + className={btn.hover || ''} onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} >{label}</Button> <span onClick={(e) => {e.stopPropagation()}} onDoubleClick={(e) => {e.stopPropagation()}}>{this.getPop()}</span> -- Gitblit v1.8.0