From c51f5e007a3e03c9d6731ab7f28f0080de009990 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 17 十一月 2021 18:38:32 +0800 Subject: [PATCH] 2021-11-17 --- src/tabviews/zshare/actionList/excelInbutton/index.jsx | 69 +++++++++++++++++----------------- 1 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 55277b0..0961633 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -12,7 +12,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import MKEmitter from '@/utils/events.js' -import './index.scss' +// import './index.scss' class ExcelInButton extends Component { static propTpyes = { @@ -28,7 +28,9 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, loading: false, + selines: null, disabled: false, + hidden: false, primaryId: '', } @@ -43,7 +45,7 @@ disabled = true } }) - this.setState({disabled}) + this.setState({disabled, hidden: disabled && btn.control === 'hidden'}) } } @@ -52,11 +54,7 @@ } componentDidMount () { - const { position } = this.props - - if (position === 'toolbar') { - MKEmitter.addListener('triggerBtnId', this.actionTrigger) - } + MKEmitter.addListener('triggerBtnId', this.actionTrigger) } UNSAFE_componentWillReceiveProps (nextProps) { @@ -73,7 +71,7 @@ } }) } - this.setState({disabled}) + this.setState({disabled, hidden: disabled && btn.control === 'hidden'}) } } @@ -83,30 +81,15 @@ } MKEmitter.removeListener('triggerBtnId', this.actionTrigger) } - - /** - * @description 鎸夐挳鐘舵�佹敼鍙� - */ - updateStatus = (type) => { - if (type === 'start') { - this.setState({ - loading: true - }) - } else if (type === 'over') { - this.setState({ - loading: false - }) - } - } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (triggerId, record) => { + actionTrigger = (triggerId, record, type) => { const { setting, Tab, BID, btn, selectedData } = 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({ @@ -115,6 +98,10 @@ duration: 5 }) return + } else if (type === 'linkbtn' && selectedData && selectedData.length === 1) { + if (record[0].$Index !== selectedData[0].$Index) { + return + } } let data = record || selectedData || [] @@ -142,6 +129,7 @@ } this.setState({ + selines: data, primaryId: primaryId }, () => { this.refs.excelIn.exceltrigger() @@ -182,7 +170,12 @@ }) if (btn.execSuccess !== 'never') { - MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', this.state.selines) + } + if (btn.switchTab && btn.switchTab.length > 0) { + let id = btn.switchTab[btn.switchTab.length - 1] + let node = document.getElementById('tab' + id) + node && node.click() } } @@ -221,7 +214,7 @@ }) if (btn.execError !== 'never') { - MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) } } @@ -252,7 +245,7 @@ }) } - this.updateStatus('over') + this.setState({ loading: false }) return } @@ -262,7 +255,7 @@ message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + sheetName + '銆嬫暟鎹紒', duration: 5 }) - this.updateStatus('over') + this.setState({ loading: false }) return } else if (data.length * btn.verify.columns.length > 30000) { notification.warning({ @@ -280,7 +273,7 @@ message: result.errors, duration: 5 }) - this.updateStatus('over') + this.setState({ loading: false }) return } @@ -317,6 +310,10 @@ } param.menuname = btn.logLabel + + if (window.GLOB.probation) { + param.s_debug_type = 'Y' + } Api.genericInterface(param).then((res) => { if (res.status) { @@ -442,7 +439,9 @@ render() { const { btn, show } = this.props - const { loading, disabled } = this.state + const { loading, disabled, hidden } = this.state + + if (hidden) return null if (show === 'actionList') { return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> @@ -453,7 +452,7 @@ className={'mk-btn mk-' + btn.class} onClick={() => {this.actionTrigger()}} >{btn.label}</Button> - <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> + <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" /> </div> } else { // icon銆乼ext銆� all 鍗$墖 let label = '' @@ -463,7 +462,7 @@ label = btn.label icon = btn.icon || '' } else if (show === 'link') { - label = <span>{btn.label}{btn.icon ? <Icon type={btn.icon}/> : ''}</span> + label = <span>{btn.label}{btn.icon ? <Icon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> icon = '' } else if (show === 'icon') { icon = btn.icon || 'upload' @@ -482,7 +481,7 @@ icon={icon} onClick={() => {this.actionTrigger()}} >{label}</Button> - <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" /> + <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" /> </div> } } -- Gitblit v1.8.0