king
2025-01-16 325aa13d3b61d1c066f8fcab107003ef36713df3
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({