king
2020-09-26 ab60d53b67f802878662aaa5a5b52580cca421b8
src/menu/components/card/cardcellcomponent/dragaction/index.jsx
@@ -2,13 +2,11 @@
import { useDrop } from 'react-dnd'
import { is, fromJS } from 'immutable'
import update from 'immutability-helper'
import { Icon } from 'antd'
import Utils from '@/utils/utils.js'
import Card from './card'
import './index.scss'
const Container = ({type, list, handleList, handleMenu, deleteMenu }) => {
const Container = ({list, handleList, handleMenu, deleteMenu }) => {
  const [cards, setCards] = useState(list)
  const moveCard = (id, atIndex) => {
    const { card, index } = findCard(id)
@@ -45,29 +43,6 @@
    drop() {}
  })
  const addelement = () => {
    let newcard = {}
    newcard.uuid = Utils.getuuid()
    newcard.focus = true
    newcard.eleType = 'text'
    newcard.datatype = 'dynamic'
    newcard.color = 'rgba(0,0,0,0.85)'
    newcard.padding = '5px'
    newcard.align = 'left'
    let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
    const { index: overIndex } = findCard(`${targetId}`)
    let targetIndex = overIndex
    targetIndex++
    const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
    handleList(_cards, newcard)
  }
  return (
    <div ref={drop} className="ant-row card-detail-row">
      {cards.map(card => (
@@ -82,7 +57,6 @@
          findCard={findCard}
        />
      ))}
      <Icon type="plus" title="添加元素" onClick={addelement}/>
    </div>
  )
}