king
2023-06-14 08cce3334a2dc81d690b518136b0aaea64e48b0b
src/menu/components/share/actioncomponent/dragaction/index.jsx
@@ -1,6 +1,7 @@
import React, { useState } from 'react'
import { useDrop } from 'react-dnd'
import { is, fromJS } from 'immutable'
import { message } from 'antd'
import update from 'immutability-helper'
import Utils from '@/utils/utils.js'
@@ -69,7 +70,6 @@
    }
    copycard.uuid = Utils.getuuid()
    copycard.originCard = card
    try {
      delete _val.$srcId
@@ -92,44 +92,47 @@
      oInput.select()
      document.execCommand('Copy')
      document.body.removeChild(oInput)
      message.success('复制成功。')
    } else {
      message.warning('复制失败。')
    }
    const { index: overIndex } = findCard(id)
    // const { index: overIndex } = findCard(id)
    const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
    // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
    handleList(_cards, copycard)
    // handleList(_cards, copycard)
  }
  const [, drop] = useDrop({
    accept: 'action',
    drop(item) {
      if (item.$init) { // 拖拽添加
        let newcard = {}
        newcard.uuid = Utils.getuuid()
        newcard.focus = true
        if (item.class === 'element') {
          delete item.overIndex
          return
        } else {
          newcard.label = 'button'
          newcard.verify = null
          newcard.show = 'link'
          newcard.Ot = 'requiredSgl'
          newcard.OpenType = item.value
          newcard.class = 'primary'
          newcard.style = { marginRight: '15px' }
        }
        let newcard = {}
        newcard.uuid = Utils.getuuid()
        newcard.focus = true
        newcard.label = 'button'
        newcard.verify = null
        newcard.show = 'button'
        newcard.Ot = 'requiredSgl'
        newcard.OpenType = item.value
        newcard.class = 'primary'
        newcard.style = { marginRight: '15px' }
          if (newcard.OpenType === 'excelIn') {
            newcard.label = item.text
            newcard.class = 'dgreen'
            newcard.Ot = 'notRequired'
          } else if (item.subType === 'excelOut') {
            newcard.label = item.text
            newcard.execSuccess = 'never'
            newcard.class = 'dgreen'
          }
        if (newcard.OpenType === 'excelIn') {
          newcard.label = item.text
          newcard.class = 'border-dgreen'
          newcard.Ot = 'notRequired'
        } else if (newcard.OpenType === 'excelOut') {
          newcard.label = item.text
          newcard.execSuccess = 'never'
          newcard.class = 'dgreen'
          newcard.Ot = 'requiredOnce'
        }
        if (item.overIndex) {