| | |
| | | import { Button, Modal, notification, Drawer } from 'antd' |
| | | |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import './index.scss' |
| | | |
| | | const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) |
| | | const CustomPage = asyncSpinComponent(() => import('@/tabviews/custom')) |
| | | const PopView = asyncSpinComponent(() => import('@/tabviews/custom/popview')) |
| | | |
| | | class PopupButton extends Component { |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | visible: false, |
| | | popData: null, |
| | | primaryId: '', |
| | |
| | | |
| | | if (btn.uuid !== tabId) return |
| | | |
| | | if (btn.$view === 'CustomPage') { |
| | | if (btn.$view === 'popview') { |
| | | if (btn.popClose !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (setting.tabType === 'subtab') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '弹窗页面不支持此设置!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _data = null |
| | |
| | | |
| | | if (btn.Ot === 'requiredSgl' && setting.primaryKey) { |
| | | _data = data[0] |
| | | primaryId = _data[setting.primaryKey] || '' |
| | | primaryId = _data.$$uuid || _data[setting.primaryKey] || '' |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn) |
| | | } |
| | | |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | if (btn.syncComponentId) { |
| | | if (btn.syncComponentId === 'multiComponent') { |
| | | btn.syncComponentIds.forEach((id, i) => { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('reloadData', id) |
| | | }, 20 * i) |
| | | }) |
| | | } else { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | } |
| | | } |
| | | } |
| | | |
| | | getPop = () => { |
| | |
| | | ratio = ratio + 'vw' |
| | | } |
| | | return <Modal |
| | | wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview')} |
| | | wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} |
| | | title={btn.label} |
| | | width={ratio} |
| | | maskClosable={btn.clickouter === 'close'} |
| | | visible={visible} |
| | | onCancel={this.popclose} |
| | | footer={[ |
| | | <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> |
| | | <Button key="close" onClick={this.popclose}>关闭</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {!btn.$view ? <SubTabTable Tab={btn} MenuID={btn.linkTab} SupMenuID={this.props.MenuID} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData}/> : null} |
| | | {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} MenuName={btn.label} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | {btn.$view === 'popview' ? <PopView Tab={btn} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | </Modal> |
| | | } else { |
| | |
| | | destroyOnClose |
| | | > |
| | | {!btn.$view ? <SubTabTable Tab={btn} MenuID={btn.linkTab} SupMenuID={this.props.MenuID} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData}/> : null} |
| | | {btn.$view === 'CustomPage' ? <CustomPage Tab={btn} MenuName={btn.label} MenuID={btn.uuid} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null} |
| | | {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}> |