From 95f2f60ba9eb343c2605e1ae68c221443d75f704 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 30 十一月 2019 00:55:07 +0800
Subject: [PATCH] commontable-update

---
 src/templates/comtableconfig/dragelement/index.jsx |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/templates/comtableconfig/dragelement/index.jsx b/src/templates/comtableconfig/dragelement/index.jsx
index 71e0022..9e0c293 100644
--- a/src/templates/comtableconfig/dragelement/index.jsx
+++ b/src/templates/comtableconfig/dragelement/index.jsx
@@ -7,7 +7,7 @@
 import ItemTypes from './itemtypes'
 import './index.scss'
 
-const Container = ({list, setting, type, placeholder, handleList, handleMenu }) => {
+const Container = ({list, setting, type, placeholder, handleList, handleMenu, copyElement }) => {
   let target = null
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
@@ -35,16 +35,16 @@
     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++
-    }
+    // 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 = label
+    copycard.label = copycard.label + '(copy)'
     
     let indexes = cards.map(car => { return car.id })
     let newid = 0
@@ -53,11 +53,13 @@
     }
     copycard.id = newid
 
-    const { index: overIndex } = findCard(`${card.id}`)
+    // const { index: overIndex } = findCard(`${card.id}`)
 
-    const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
-    setCards(_cards)
-    handleList({action: _cards})
+    // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
+    // setCards(_cards)
+    // handleList({action: _cards})
+
+    copyElement(copycard)
   }
 
   const hasDrop = (item) => {
@@ -102,12 +104,14 @@
         newcard.label = 'button'
         newcard.innerFunc = ''
         newcard.outerFunc = ''
+        newcard.sql = ''
         newcard.Ot = 'requiredSgl'
         newcard.OpenType = item.subType
         newcard.icon = ''
         newcard.class = 'default'
         newcard.intertype = 'inner'
         newcard.interface = ''
+        newcard.method = 'POST'
         newcard.position = 'toolbar'
         newcard.execSuccess = 'grid'
         newcard.execError = 'never'

--
Gitblit v1.8.0