From 8e3b4c6dede34e8be6ba47a20ecd9a70576675cf Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 13 一月 2025 18:02:33 +0800
Subject: [PATCH] 2025-01-13

---
 src/menu/pastecontroller/index.jsx |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx
index a570034..51b273d 100644
--- a/src/menu/pastecontroller/index.jsx
+++ b/src/menu/pastecontroller/index.jsx
@@ -5,6 +5,7 @@
 import { SnippetsOutlined } from '@ant-design/icons'
 import md5 from 'md5'
 
+import Utils from '@/utils/utils.js'
 import MenuUtils from '@/utils/utils-custom.js'
 import asyncComponent from '@/utils/asyncComponent'
 // import './index.scss'
@@ -291,7 +292,7 @@
     }
 
     this.pasteFormRef.handleConfirm().then(res => {
-      if (!res.copyType) {
+      if (!res.copyType || (res.copyType === 'components' && this.props.vType !== res.type)) {
         notification.warning({
           top: 92,
           message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�',
@@ -307,6 +308,54 @@
 
       let menu = fromJS(window.GLOB.customMenu).toJS()
       
+      if (res.copyType === 'components') {
+        let commonId = Utils.getuuid()
+
+        res.interfaces = res.interfaces.map(inter => {
+          inter.uuid = md5(commonId + inter.uuid)
+          return inter
+        })
+
+        res.components = MenuUtils.resetConfig(res.components, commonId, true)
+
+        if (menu.components.length) {
+          if (
+            menu.components.findIndex(m => m.type === 'search' || (m.type === 'topbar' && m.wrap.type !== 'navbar')) > -1 && 
+            res.components.findIndex(m => m.type === 'search' || (m.type === 'topbar' && m.wrap.type !== 'navbar')) > -1
+          ) {
+            notification.warning({
+              top: 92,
+              message: '鎼滅储鏉′欢涓嶅彲閲嶅娣诲姞锛�',
+              duration: 5
+            })
+            return
+          }
+          if (
+            menu.components.findIndex(m => m.type === 'topbar') > -1 &&
+            res.components.findIndex(m => m.type === 'topbar') > -1
+          ) {
+            notification.warning({
+              top: 92,
+              message: '瀵艰埅鏍忎笉鍙噸澶嶆坊鍔狅紒',
+              duration: 5
+            })
+            return
+          }
+        }
+
+        this.setState({visible: false})
+
+        this.props.insert(res)
+  
+        notification.success({
+          top: 92,
+          message: '绮樿创鎴愬姛锛�',
+          duration: 2
+        })
+
+        return
+      }
+
       if (!options.includes(res.copyType)) {
         if (type && types[res.copyType]) {
           notification.warning({

--
Gitblit v1.8.0