king
2020-09-26 ab60d53b67f802878662aaa5a5b52580cca421b8
src/menu/searchcomponent/dragsearch/index.jsx
@@ -2,7 +2,7 @@
import { useDrop } from 'react-dnd'
import { is, fromJS } from 'immutable'
import update from 'immutability-helper'
import { Col, Icon } from 'antd'
import { Col } from 'antd'
import Utils from '@/utils/utils.js'
import Card from './card'
import './index.scss'
@@ -80,34 +80,34 @@
    drop() {}
  })
  const addsearch = (e) => {
    e.stopPropagation()
  // const addsearch = (e) => {
  //   e.stopPropagation()
    let newcard = {}
    newcard.uuid = Utils.getuuid()
    newcard.focus = true
  //   let newcard = {}
  //   newcard.uuid = Utils.getuuid()
  //   newcard.focus = true
    newcard.label = 'label'
    newcard.initval = ''
    newcard.type = 'select'
    newcard.resourceType = '0'
    newcard.options = []
    newcard.setAll = 'false'
    newcard.orderType = 'asc'
    newcard.display = 'dropdown'
    newcard.match = '='
  //   newcard.label = 'label'
  //   newcard.initval = ''
  //   newcard.type = 'select'
  //   newcard.resourceType = '0'
  //   newcard.options = []
  //   newcard.setAll = 'false'
  //   newcard.orderType = 'asc'
  //   newcard.display = 'dropdown'
  //   newcard.match = '='
    
    let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
  //   let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
    const { index: overIndex } = findCard(`${targetId}`)
    let targetIndex = overIndex
  //   const { index: overIndex } = findCard(`${targetId}`)
  //   let targetIndex = overIndex
    targetIndex++
  //   targetIndex++
    const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
  //   const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
    handleList(_cards, newcard)
  }
  //   handleList(_cards, newcard)
  // }
  return (
    <div ref={drop} className="ant-row">
@@ -125,7 +125,7 @@
          />
        </Col>
      ))}
      <Icon type="plus" onClick={addsearch}/>
      {/* <Icon type="plus" onClick={addsearch}/> */}
    </div>
  )
}