From 7442a435d058bd17d6fc679e1b7956bf3a5d32ae Mon Sep 17 00:00:00 2001
From: zenglf <18502938215@163.com>
Date: 星期四, 17 八月 2023 22:36:11 +0800
Subject: [PATCH] 设备管理代码提交

---
 src/components/jeecg/JModal/JModal.vue |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/components/jeecg/JModal/JModal.vue b/src/components/jeecg/JModal/JModal.vue
index 1e5bb9f..bc8936e 100644
--- a/src/components/jeecg/JModal/JModal.vue
+++ b/src/components/jeecg/JModal/JModal.vue
@@ -8,7 +8,7 @@
     v-on="$listeners"
     @ok="handleOk"
     @cancel="handleCancel"
-    destroyOnClose
+    :destroyOnClose="destroyOnClose"
   >
 
     <slot></slot>
@@ -49,13 +49,17 @@
 
 import { getClass, getStyle } from '@/utils/props-util'
 import { triggerWindowResizeEvent } from '@/utils/util'
+import ModalDragMixins from './ModalDragMixins'
 
 export default {
     name: 'JModal',
+    mixins: [ModalDragMixins],
     props: {
       title: String,
       // 鍙娇鐢� .sync 淇グ绗�
       visible: Boolean,
+      // 鏄惁寮�鍚嫋鎷�
+      draggable: Boolean,
       // 鏄惁鍏ㄥ睆寮圭獥锛屽綋鍏ㄥ睆鏃舵棤璁哄浣曢兘浼氱姝� body 婊氬姩銆傚彲浣跨敤 .sync 淇グ绗�
       fullscreen: {
         type: Boolean,
@@ -68,6 +72,11 @@
       },
       // 鐐瑰嚮纭畾鎸夐挳鐨勬椂鍊欐槸鍚﹀叧闂脊绐�
       okClose: {
+        type: Boolean,
+        default: true
+      },
+      // 鍏抽棴鏃堕攢姣佸脊绐楀唴瀹�
+      destroyOnClose: {
         type: Boolean,
         default: true
       },
@@ -162,6 +171,19 @@
       toggleFullscreen() {
         this.innerFullscreen = !this.innerFullscreen
         triggerWindowResizeEvent()
+        // 寮�鍚嫋鎷藉悗鐨勭壒娈婂鐞�
+        if (this.draggable) {
+          // 鍏ㄥ睆鐨勬椂鍊欑姝㈡嫋鍔�
+          if (this.innerFullscreen) {
+            // 杩樺師寮圭獥鐨勪綅缃负0,0
+            this.setModalPosition(0, 0, false)
+            this.dragSettings.headerEl.style.cursor = null
+          } else {
+            // 鍙栨秷鍏ㄥ睆鐨勬椂鍊欙紝灏嗗脊绐楃Щ鍔ㄥ埌涓婃璁板綍鐨勪綅缃�
+            this.resetModalPosition()
+            this.dragSettings.headerEl.style.cursor = 'move'
+          }
+        }
       },
 
     }

--
Gitblit v1.9.3