king
2022-11-23 891e8aaad3b2ce6980fd44d1cf49192dca1c3c66
src/menu/pastecontroller/index.jsx
@@ -4,7 +4,6 @@
import { SnippetsOutlined } from '@ant-design/icons'
import MenuUtils from '@/utils/utils-custom.js'
import MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
// import './index.scss'
@@ -19,7 +18,7 @@
    visible: false
  }
  resetconfig = (item, copyBtns, uuids = {}) => {
  resetconfig = (item, uuids = {}) => {
    let appType = sessionStorage.getItem('appType')
    
    if (item.type === 'tabs') {
@@ -31,17 +30,13 @@
      item.subtabs.forEach(tab => {
        uuids[tab.uuid] = MenuUtils.getuuid()
        tab.uuid = uuids[tab.uuid]
        tab.parentId = item.uuid
        if (appType !== 'mob') {
          tab.components = tab.components.filter(cell => cell.type !== 'menubar')
        }
        tab.components = tab.components.map(cell => {
          cell.tabId = tab.uuid
          cell.parentId = tab.parentId
          cell = this.resetconfig(cell, copyBtns, uuids)
          cell = this.resetconfig(cell, uuids)
          return cell
        })
      })
@@ -52,31 +47,28 @@
      item.name = item.setting.name
      item.components = item.components.map(cell => {
        cell.tabId = item.tabId || ''
        cell.parentId = item.parentId || ''
        cell = MenuUtils.resetComponentConfig(cell, copyBtns, uuids)
        cell = MenuUtils.resetComponentConfig(cell, uuids)
        return cell
      })
    } else {
      item = MenuUtils.resetComponentConfig(item, copyBtns, uuids)
      item = MenuUtils.resetComponentConfig(item, uuids)
    }
    return item
  }
  pasteSubmit = () => {
    let options = ['tabs', 'menubar', 'topbar', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter']
    let appType = sessionStorage.getItem('appType')
    let options = ['tabs', 'timeline', 'datacard', 'propcard', 'mainsearch', 'simpleform', 'stepform', 'tabform', 'balcony', 'group', 'normaltable', 'tablecard', 'line', 'bar', 'pie', 'dashboard', 'scatter', 'iframe', 'sandbox']
    if (appType === 'mob') {
      options.push('menubar', 'topbar')
    } else {
      options.push('editable', 'antvG6')
    }
    this.pasteFormRef.handleConfirm().then(res => {
      if ((res.copyType === 'menubar' || res.copyType === 'topbar') && sessionStorage.getItem('appType') !== 'mob') {
        notification.warning({
          top: 92,
          message: '当前系统不支持菜单组件!',
          duration: 5
        })
        return
      } else if (!options.includes(res.copyType)) {
      if (!options.includes(res.copyType)) {
        notification.warning({
          top: 92,
          message: '配置信息格式错误!',
@@ -85,19 +77,11 @@
        return
      }
      let copyBtns = new Map()
      res = this.resetconfig(res)
      res = this.resetconfig(res, copyBtns)
      delete res.copyType
      // delete res.copyType
      
      this.props.insert(res)
      copyBtns = [...copyBtns.values()]
      if (copyBtns.length > 0) {
        MKEmitter.emit('copyButtons', copyBtns)
      }
      this.setState({visible: false})
    })