king
2019-12-10 88f02c2c018fb1e5c171bd4975dac534c584c3ba
src/templates/comtableconfig/dragelement/index.jsx
@@ -14,7 +14,8 @@
    const { card, index } = findCard(id)
    const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] })
    setCards(_cards)
    handleList({[type]: _cards})
    handleList(type, _cards)
    // handleList({[type]: _cards})
  }
  const findCard = id => {
@@ -40,15 +41,6 @@
    let copycard = JSON.parse(JSON.stringify(card))
    copycard.uuid = Utils.getuuid()
    copycard.origin = false
    // let names = cards.map(car => { return car.label })
    // let index = 1
    // let origin = copycard.label.split('(copy')[0] || 'button'
    // let label = origin + '(copy)'
    // while (names.includes(label)) {
    //   label = origin + `(copy${index})`
    //   index++
    // }
    copycard.label = copycard.label + '(copy)'
    
    let indexes = cards.map(car => { return car.id })
@@ -57,12 +49,6 @@
      newid++
    }
    copycard.id = newid
    // const { index: overIndex } = findCard(`${card.id}`)
    // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
    // setCards(_cards)
    // handleList({action: _cards})
    copyElement(copycard)
  }
@@ -110,6 +96,7 @@
        newcard.innerFunc = ''
        newcard.outerFunc = ''
        newcard.sql = ''
        newcard.sqlType = ''
        newcard.Ot = 'requiredSgl'
        newcard.OpenType = item.subType
        newcard.icon = ''
@@ -161,7 +148,7 @@
      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
      setCards(_cards)
      handleList({[type]: _cards})
      handleList(type, _cards, newcard)
      target = null
    }
  })