king
2023-03-22 afb39f8ab004b2607bb718edab02e99c7a010114
src/menu/components/share/pastecomponent/index.jsx
@@ -21,19 +21,8 @@
    visible: false
  }
  handleMenuClick = () => {
    this.setState({visible: true})
  }
  resetconfig = (item, copyBtns, config) => {
  resetconfig = (item, config) => {
    let _uuid = Utils.getuuid()
    if (item.OpenType === 'popview') {
      let _cell = fromJS(item).toJS()
      _cell.$originUuid = _cell.uuid
      _cell.uuid = _uuid
      copyBtns.set(_uuid, _cell)
    }
    if (item.uuid) {
      item.uuid = _uuid
@@ -109,14 +98,7 @@
          })
        } else if (_item.type === 'action' && _item.elements) {
          _item.elements = _item.elements.map(cell => {
            let _uuid = Utils.getuuid()
            if (cell.OpenType === 'popview') {
              let _cell = fromJS(cell).toJS()
              _cell.$originUuid = _cell.uuid
              _cell.uuid = _uuid
              copyBtns.set(_uuid, _cell)
            }
            cell.uuid = _uuid
            cell.uuid = Utils.getuuid()
            return cell
          })
        }
@@ -130,33 +112,28 @@
  pasteSubmit = () => {
    const { options } = this.props
    this.pasteFormRef.handleConfirm().then(res => {
      if (!options.includes(res.copyType)) {
        notification.warning({ top: 92, message: '配置信息格式错误!', duration: 5 })
        return
      }
      if (!this.props.config) {
        this.props.updateConfig(res)
        this.setState({visible: false})
        return
      }
      let type = res.copyType
      let config = fromJS(this.props.config).toJS()
      let copyBtns = new Map()
      res = this.resetconfig(res, copyBtns, config)
      res = this.resetconfig(res, config)
      delete res.copyType
      copyBtns = [...copyBtns.values()]
      if (copyBtns.length > 0) {
        MKEmitter.emit('copyButtons', copyBtns)
      }
      if (config.type === 'form') {
        this.props.updateConfig(res)
        this.setState({visible: false})
        return
      } else if (type === 'action') {
        config.action = config.action || []
        config.action = config.action.filter(item => !item.origin)
        if (['line', 'bar', 'scatter'].includes(config.type) && !['excelOut', 'excelIn'].includes(res.OpenType)) {
          notification.warning({ top: 92, message: '图表中不支持此类按钮!', duration: 5 })
          return
@@ -205,7 +182,7 @@
        })
      }
      this.props.updateConfig(config)
      this.props.updateConfig(config, type)
      this.setState({visible: false})
      notification.success({