From 46f59e30133c25f1f01074b1c92445f9e85b8c98 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2019 15:58:37 +0800
Subject: [PATCH] 2019-12-31

---
 src/templates/tableshare/dragelement/index.jsx |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/templates/tableshare/dragelement/index.jsx b/src/templates/tableshare/dragelement/index.jsx
index 44f5461..2d7f306 100644
--- a/src/templates/tableshare/dragelement/index.jsx
+++ b/src/templates/tableshare/dragelement/index.jsx
@@ -7,7 +7,7 @@
 import ItemTypes from './itemtypes'
 import './index.scss'
 
-const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn, showfield }) => {
+const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, profileMenu, handleGridBtn, showfield }) => {
   let target = null
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
@@ -28,6 +28,11 @@
   const editCard = id => {
     const { card } = findCard(id)
     handleMenu(card)
+  }
+  
+  const profileCard = id => {
+    const { card } = findCard(id)
+    profileMenu(card)
   }
 
   const delCard = id => {
@@ -59,6 +64,9 @@
       }
 
       let newcard = {}
+      newcard.uuid = Utils.getuuid()
+      newcard.focus = true
+      
       if (item.type === 'search') {
         let _match = 'like'
         if (item.subType === 'select' || item.subType === 'link') {
@@ -68,7 +76,7 @@
         } else if (item.subType === 'dateweek' || item.subType === 'daterange') {
           _match = 'between'
         }
-        newcard.uuid = Utils.getuuid()
+        
         newcard.label = 'label'
         newcard.field = ''
         newcard.initval = ''
@@ -85,7 +93,6 @@
         newcard.match = _match
         newcard.display = 'dropdown'
       } else if (item.type === 'action') {
-        newcard.uuid = Utils.getuuid()
         newcard.label = 'button'
         newcard.innerFunc = ''
         newcard.outerFunc = ''
@@ -114,7 +121,6 @@
           newcard.label = item.label
         }
       } else if (item.type === 'columns') {
-        newcard.uuid = Utils.getuuid()
         newcard.Align = 'left'
         newcard.label = 'label'
         newcard.field = ''
@@ -137,12 +143,12 @@
 
       const { index: overIndex } = findCard(`${targetId}`)
       let targetIndex = overIndex
-      if (!target) {
-        targetIndex++
-      }
-      if (targetIndex < 0) {
-        targetIndex = 0
-      }
+      // if (!target) {
+      targetIndex++
+      // }
+      // if (targetIndex < 0) {
+      //   targetIndex = 0
+      // }
 
       const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
       setCards(_cards)
@@ -190,6 +196,7 @@
           editCard={editCard}
           delCard={delCard}
           copyCard={copyCard}
+          profileCard={profileCard}
           findCard={findCard}
           hasDrop={hasDrop}
         />

--
Gitblit v1.8.0