king
2021-08-23 cd8bf53b0a1ed5ec9e668bfe190e149f5b7489de
src/tabviews/zshare/actionList/popupbutton/index.jsx
@@ -2,7 +2,7 @@
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { Button, Modal, notification, Icon } from 'antd'
import { Button, Modal, notification, Icon, Drawer } from 'antd'
import asyncSpinComponent from '@/utils/asyncSpinComponent'
import zhCN from '@/locales/zh-CN/main.js'
@@ -192,9 +192,93 @@
    }
  }
  getPop = () => {
    const { btn } = this.props
    const { popData, primaryId, visible } = this.state
    let ratio = btn.ratio || 85
    if (btn.display !== 'drawer') {
      if (ratio > 100) {
        ratio = ratio + 'px'
      } else {
        ratio = ratio + 'vw'
      }
      return <Modal
        className={'popview-modal ' + (btn.$view === 'CustomPage' ? 'custom-popview' : '')}
        title={btn.label}
        width={ratio}
        maskClosable={false}
        visible={visible}
        onCancel={this.popclose}
        footer={[
          <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button>
        ]}
        destroyOnClose
      >
        {btn.$view !== 'CustomPage' ? <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} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null}
      </Modal>
    } else {
      let height = '100vh'
      let width = '100vw'
      if (btn.placement === 'top' || btn.placement === 'bottom') {
        if (ratio > 100) {
          ratio = ratio + 'px'
        } else {
          ratio = ratio + 'vh'
        }
        height = ratio
      } else {
        if (ratio > 100) {
          ratio = ratio + 'px'
        } else {
          ratio = ratio + 'vw'
        }
        width = ratio
      }
      return (
        <Drawer
          title={btn.label}
          className={btn.$view === 'CustomPage' ? 'custom-drawer-popview' : ''}
          width={width}
          height={height}
          maskClosable={false}
          onClose={this.popclose}
          visible={visible}
          placement={btn.placement || 'right'}
          destroyOnClose
        >
          {btn.$view !== 'CustomPage' ? <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} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null}
          <div className="close-drawer">
            <Button onClick={this.popclose}>
              关闭
            </Button>
          </div>
        </Drawer>
      )
    }
  }
  render() {
    const { btn, show } = this.props
    const { loading, popData, primaryId, disabled } = this.state
    const { loading, disabled } = this.state
    let label = ''
    let icon = ''
@@ -207,7 +291,6 @@
      icon = ''
    } else if (show === 'icon') {
      icon = btn.icon || ''
    // } else if (show === 'text') {
    } else {
      label = btn.label
    }
@@ -230,27 +313,7 @@
          icon={icon}
          onClick={() => {this.actionTrigger()}}
        >{label}</Button> : null}
        <Modal
          className={'popview-modal ' + (btn.$view === 'CustomPage' ? 'custom-popview' : '')}
          title={btn.label}
          width={'85vw'}
          maskClosable={false}
          visible={this.state.visible}
          onCancel={this.popclose}
          footer={[
            <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button>
          ]}
          destroyOnClose
        >
          {btn.$view !== 'CustomPage' ? <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} param={{$BID: (popData ? primaryId : this.props.BID), ...(popData || this.props.BData || {})}} /> : null}
        </Modal>
        {this.getPop()}
      </div>
    )
  }