From 5733fc7e386a51217ba6d07e272ca8bd95045abc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 16 一月 2025 10:14:35 +0800 Subject: [PATCH] Merge branch 'develop' --- src/menu/pastecontroller/index.jsx | 65 +++++++++++++++++++++++++++++++- 1 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index b9b8937..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' @@ -177,11 +178,23 @@ btn.anchors = this.modules[id] || this.modules[_id] || null } if (btn.syncComponent && btn.syncComponent[0] === 'multiComponent' && btn.syncComponents) { + if (btn.syncComponents[0] && Array.isArray(btn.syncComponents[0])) { // 鍏煎闂鏁版嵁 + btn.syncComponents = btn.syncComponents.map((item, i) => { + return { + syncComId: item, + label: '', + uuid: 'fixed' + i + } + }) + } + btn.syncComponents = btn.syncComponents.map(m => { let id = m.syncComId[m.syncComId.length - 1] let _id = md5(commonId + id) - return this.modules[id] || this.modules[_id] || null + m.syncComId = this.modules[id] || this.modules[_id] || null + + return m.syncComId ? m : null }) btn.syncComponents = btn.syncComponents.filter(Boolean) @@ -279,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: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', @@ -295,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