From fc55bf4131e3056a84ac7bae16540a4e714214b8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 16 二月 2023 18:13:00 +0800
Subject: [PATCH] 2023-02-16

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 3a5c539..55028c5 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2424,6 +2424,12 @@
         this.setState({
           visible: true
         })
+
+        if (btnconfig.setting.display === 'modal' && btnconfig.setting.moveable === 'true') {
+          setTimeout(() => {
+            this.setMove()
+          }, 100)
+        }
       }
     } else {
       Api.getCacheConfig({
@@ -2677,15 +2683,17 @@
         width = btnconfig.setting.width > 100 ? btnconfig.setting.width : btnconfig.setting.width + '%'
         container = () => document.getElementById(btn.ContainerId)
       }
+
       return (
         <Modal
           title={title}
           maskClosable={clickouter}
           getContainer={container}
-          wrapClassName='action-modal'
+          wrapClassName={'action-modal' + (btnconfig.setting.moveable === 'true' ? ' moveable-modal modal-' + btn.uuid : '')}
           visible={visible}
           width={width}
           onOk={this.handleOk}
+          maskStyle={btnconfig.setting.moveable === 'true' ?  {backgroundColor: 'rgba(0, 0, 0, 0.15)'} : null}
           confirmLoading={this.state.confirmLoading}
           onCancel={this.handleCancel}
           destroyOnClose
@@ -2704,6 +2712,43 @@
     }
   }
 
+  setMove = () => {
+    const { btn } = this.props
+    let wrap = document.getElementsByClassName('modal-' + btn.uuid)[0]
+
+    if (!wrap) return
+
+    let node = wrap.getElementsByClassName('ant-modal-header')[0]
+
+    if (!node) return
+
+    node.onmousedown = function(e) {
+      let orileft = 0
+      let oritop = 0
+      let oleft = e.clientX
+      let otop = e.clientY
+
+      if (node.parentNode.style.left) {
+        orileft = parseFloat(node.parentNode.style.left)
+      }
+      if (node.parentNode.style.top) {
+        oritop = parseFloat(node.parentNode.style.top)
+      }
+
+      document.onmousemove = function(e) {
+        let left = e.clientX - oleft
+        let top = e.clientY - otop
+
+        node.parentNode.style.left = (orileft + left) + 'px'
+        node.parentNode.style.top = (oritop + top) + 'px'
+      }
+    }
+
+    document.onmouseup = function() {
+      document.onmousemove = null
+    }
+  }
+
   render() {
     const { btn } = this.props
     const { loadingNumber, loadingTotal, loading, disabled, hidden, check } = this.state

--
Gitblit v1.8.0