From e9c48bd7356462ba9257540b130a47a65ad1861d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 26 八月 2021 17:17:11 +0800
Subject: [PATCH] 2021-08-26

---
 src/tabviews/zshare/actionList/popupbutton/index.jsx |  129 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 104 insertions(+), 25 deletions(-)

diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx
index c519a94..a0429e7 100644
--- a/src/tabviews/zshare/actionList/popupbutton/index.jsx
+++ b/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 } 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,108 @@
     }
   }
 
+  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 = ''
+
+    if (show === 'button') {
+      label = btn.label
+      icon = btn.icon || ''
+    } else if (show === 'link') {
+      label = <span>{btn.label}{btn.icon ? <Icon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
+      icon = ''
+    } else if (show === 'icon') {
+      icon = btn.icon || ''
+    } else {
+      label = btn.label
+    }
 
     return (
       <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
@@ -211,30 +310,10 @@
           loading={loading}
           disabled={disabled}
           style={btn.style}
-          icon={show === 'text' ? '' : (btn.icon || '')}
+          icon={icon}
           onClick={() => {this.actionTrigger()}}
-        >{show === 'icon' && btn.icon ? '' : btn.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>
+        >{label}</Button> : null}
+        {this.getPop()}
       </div>
     )
   }

--
Gitblit v1.8.0