king
2020-11-03 37a134bd23ec4b227a0e010b08a1a89c2bbaaa0d
src/templates/formtabconfig/dragelement/index.jsx
@@ -9,7 +9,6 @@
import './index.scss'
const Container = ({list, type, groupId, setting, placeholder, handleList, handleMenu, deleteMenu, profileMenu }) => {
  let target = null
  const [cards, setCards] = useState(list)
  const moveCard = (id, atIndex) => {
    const { card, index } = findCard(id)
@@ -81,10 +80,6 @@
    deleteMenu({card: card, type: type})
  }
  const hasDrop = (item) => {
    target = item
  }
  const [, drop] = useDrop({
    accept: ItemTypes[type],
    drop(item) {
@@ -141,19 +136,19 @@
        newcard.verify = null
      }
      
      let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
      if (target) {
        targetId = target.uuid
      let targetId = ''
      if (item.dropTargetId) {
        targetId = item.dropTargetId
        delete item.dropTargetId
      } else if (cards.length > 0) {
        targetId = cards[cards.length - 1].uuid
      }
      const { index: overIndex } = findCard(`${targetId}`)
      let targetIndex = overIndex
      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
      targetIndex++
      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
      handleList(type, _cards, newcard, groupId)
      target = null
    }
  })
@@ -172,7 +167,6 @@
          delCard={delCard}
          profileCard={profileCard}
          findCard={findCard}
          hasDrop={hasDrop}
        />
      ))}
      {type === 'search' && cards.map(card => (
@@ -188,7 +182,6 @@
            delCard={delCard}
            copyCard={copyCard}
            findCard={findCard}
            hasDrop={hasDrop}
          />
        </Col>
      ))}