From 81a5ae579e84d7cfe0cda268d4156d4b78a27454 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 30 十二月 2024 13:46:34 +0800
Subject: [PATCH] 2024-12-30

---
 src/menu/components/share/pastecomponent/index.jsx |   54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/src/menu/components/share/pastecomponent/index.jsx b/src/menu/components/share/pastecomponent/index.jsx
index 5c2b417..f0e89a1 100644
--- a/src/menu/components/share/pastecomponent/index.jsx
+++ b/src/menu/components/share/pastecomponent/index.jsx
@@ -6,6 +6,7 @@
 
 import Utils from '@/utils/utils.js'
 import MKEmitter from '@/utils/events.js'
+import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 // import './index.scss'
 
@@ -28,7 +29,9 @@
       item.uuid = _uuid
     }
 
-    if (item.copyType === 'cardcell' && config.subtype === 'datacard') {
+    if (item.copyType === 'action') {
+      MenuUtils.resetBtn(item, _uuid)
+    } else if (item.copyType === 'cardcell' && config.subtype === 'datacard') {
       item.setting = item.setting || {}
       item.$cardType = 'extendCard'
       item.setting.width = item.setting.width || 6
@@ -39,6 +42,10 @@
             cell.datatype = 'static'
           }
           cell.uuid = Utils.getuuid()
+
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -48,6 +55,10 @@
             cell.datatype = 'static'
           }
           cell.uuid = Utils.getuuid()
+
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -64,12 +75,18 @@
       if (item.elements) {
         item.elements = item.elements.map(cell => {
           cell.uuid = Utils.getuuid()
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
       if (item.backElements) {
         item.backElements = item.backElements.map(cell => {
           cell.uuid = Utils.getuuid()
+          if (cell.eleType === 'button') {
+            MenuUtils.resetBtn(cell, _uuid)
+          }
           return cell
         })
       }
@@ -87,6 +104,9 @@
           } else if (col.type === 'custom' && col.elements) {
             col.elements = col.elements.map(cell => {
               cell.uuid = Utils.getuuid()
+              if (cell.eleType === 'button') {
+                MenuUtils.resetBtn(cell, _uuid)
+              }
               return cell
             })
           }
@@ -112,6 +132,10 @@
         this.props.updateConfig(res)
         this.setState({visible: false})
         return
+      }
+
+      if (res.copyType === 'editcols') {
+        res.copyType = 'cols'
       }
 
       let type = res.copyType
@@ -168,13 +192,29 @@
       } else if (type === 'cols') {
         config.cols = config.cols.filter(col => !col.origin)
 
-        let keys = config.cols.map(col => (col.field || '$empty'))
-
-        res.cols.forEach(col => {
-          if (!keys.includes(col.field)) {
-            config.cols.push(col)
+        if ((config.subtype === 'normaltable' || config.subtype === 'editable') && res.cols.length === 1) {
+          config.cols.push(...res.cols)
+        } else {
+          let keys = config.cols.map(col => (col.field || '$empty'))
+  
+          let cols = []
+          res.cols.forEach(col => {
+            if (!col.field || !keys.includes(col.field)) {
+              cols.push(col)
+            }
+          })
+  
+          if (cols.length === 0) {
+            notification.warning({
+              top: 92,
+              message: '鏄剧ず鍒楀凡瀛樺湪锛�',
+              duration: 5
+            })
+            return
+          } else {
+            config.cols.push(...cols)
           }
-        })
+        }
       }
 
       this.props.updateConfig(config, type)

--
Gitblit v1.8.0