From b09b821ef36fd1ea979e9a5daa98e95732ac81d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 16 七月 2025 18:16:00 +0800 Subject: [PATCH] 2025-07-16 --- src/tabviews/zshare/actionList/funczip/index.jsx | 107 ++++++++++++++++++++--------------------------------- 1 files changed, 40 insertions(+), 67 deletions(-) diff --git a/src/tabviews/zshare/actionList/funczip/index.jsx b/src/tabviews/zshare/actionList/funczip/index.jsx index 28d6ed2..7c36866 100644 --- a/src/tabviews/zshare/actionList/funczip/index.jsx +++ b/src/tabviews/zshare/actionList/funczip/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Button, Modal, notification, message, Progress } from 'antd' +import { Button, Modal, notification, message } from 'antd' import JSZip from 'jszip' import { saveAs } from 'file-saver' @@ -10,7 +10,7 @@ import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' -import './index.scss' +// import './index.scss' class FuncZip extends Component { static propTpyes = { @@ -21,10 +21,8 @@ state = { loading: false, disabled: false, - loadingNumber: '', - loadingTotal: '', hidden: false, - visible: false + dict: window.GLOB.dict } UNSAFE_componentWillMount () { @@ -102,37 +100,34 @@ /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (triggerId, record, type) => { - const { BID, btn, selectedData, setting } = this.props - const { loading, disabled } = this.state + actionTrigger = (triggerId, record, type, lid) => { + const { BID, btn, selectedData, setting, 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: setting.supModTip || 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 !== 'notRequired' && data.length === 0) { + } else if (btn.Ot !== 'notRequired' && data.length === 0) { notification.warning({ top: 92, - message: '璇烽�夋嫨琛岋紒', + message: dict['select_row'] || '璇烽�夋嫨琛岋紒', duration: 5 }) return } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { notification.warning({ top: 92, - message: '璇烽�夋嫨鍗曡鏁版嵁锛�', + message: dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�', duration: 5 }) return @@ -340,9 +335,7 @@ const { btn } = this.props this.setState({ - loading: false, - loadingNumber: '', - loadingTotal: '' + loading: false }) if (btn.execSuccess !== 'never') { @@ -359,45 +352,47 @@ */ execError = (res) => { const { btn } = this.props + const { dict } = this.state this.setState({ - loading: false, - loadingNumber: '', - loadingTotal: '' + loading: false }) if (res.ErrCode === '01') { - message.error('鏈幏鍙栧埌涓嬭浇鏂囦欢銆�') + message.error(dict['exc_fail'] || '鏈幏鍙栧埌涓嬭浇鏂囦欢銆�') return } else if (res.ErrCode === '02') { Modal.error({ - title: '閮ㄥ垎鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + title: dict['exc_fail'] || '閮ㄥ垎鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + okText: dict['got_it'] || '鐭ラ亾浜�' }) return } else if (res.ErrCode === '03') { Modal.error({ - title: '鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + title: dict['exc_fail'] || '鏂囦欢涓嬭浇澶辫触锛�1銆佽妫�鏌ユ枃浠惰矾寰勬槸鍚︽纭紝2銆佽妫�鏌ユ枃浠舵槸鍚﹁法鍩熴��', + okText: dict['got_it'] || '鐭ラ亾浜�' }) return } else if (res.ErrCode === 'E') { Modal.error({ - title: res.message || res.ErrMesg, + title: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', + okText: dict['got_it'] || '鐭ラ亾浜�' }) } else if (res.ErrCode === 'N') { notification.error({ top: 92, - message: res.message || res.ErrMesg, + message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', duration: 10 }) } else if (res.ErrCode === 'F') { notification.error({ className: 'notification-custom-error', top: 92, - message: res.message || res.ErrMesg, + message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', duration: 10 }) } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) + message.error(res.message || dict['exc_fail'] || '鎵ц澶辫触锛�') } if (btn.execError !== 'never') { @@ -411,52 +406,30 @@ render() { const { btn } = this.props - const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state + 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>{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} /> : ''}{btn.label}</span> } - if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) { - label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label - } - return ( - <> - <Button - type={type} - title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} - loading={loading} - disabled={disabled} - style={btn.style} - icon={icon} - className={className} - onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} - >{label}</Button> - {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null} - </> + <Button + type="link" + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + loading={loading} + disabled={disabled} + style={btn.style} + className={btn.hover || ''} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> ) } } -- Gitblit v1.8.0