From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 10:31:45 +0800
Subject: [PATCH] 2021-09-01

---
 src/templates/sharecomponent/actioncomponent/dragaction/index.jsx |   31 ++++++++++---------------------
 1 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
index a30105b..36fdccb 100644
--- a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx
@@ -7,8 +7,6 @@
 import './index.scss'
 
 const Container = ({list, setting, placeholder, handleList, handleMenu, deleteMenu, profileMenu, doubleClickCard }) => {
-  let target = null
-
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -55,7 +53,6 @@
     copycard.uuid = Utils.getuuid()
     copycard.origin = false
     copycard.copyType = 'action'
-    copycard.label = copycard.label + '(copy)'
     copycard.focus = true
 
     copycard.originCard = card
@@ -69,7 +66,7 @@
     try {
       _val.uuid = Utils.getuuid()
       _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val)))
-    } catch {
+    } catch (e) {
       console.warn('Stringify Failure')
       _val = ''
     }
@@ -90,10 +87,6 @@
     handleList(_cards, copycard)
   }
 
-  const hasDrop = (item) => {
-    target = item
-  }
-
   const [, drop] = useDrop({
     accept: 'action',
     drop(item) {
@@ -112,13 +105,11 @@
       newcard.tabType = 'SubTable'
       newcard.icon = ''
       newcard.class = 'default'
-      newcard.intertype = 'inner'
-      newcard.method = 'POST'
+      newcard.intertype = 'system'
       newcard.position = 'toolbar'
       newcard.execSuccess = 'grid'
       newcard.execError = 'never'
       newcard.popClose = 'never'
-      newcard.errorTime = 10
       newcard.verify = null
 
       if (item.subType === 'excelIn') {
@@ -136,20 +127,19 @@
         newcard.class = 'dgreen'
       }
       
-      let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
-      if (target) {
-        targetId = target.uuid
+      let targetId = ''
+
+      if (item.dropTargetId) {
+        targetId = item.dropTargetId
+        delete item.dropTargetId
+      } else if (cards.length > 0) {
+        targetId = cards.slice(-1)[0].uuid
       }
 
       const { index: overIndex } = findCard(`${targetId}`)
-      let targetIndex = overIndex
-
-      targetIndex++
-
-      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
+      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
 
       handleList(_cards, newcard)
-      target = null
     }
   })
 
@@ -165,7 +155,6 @@
           editCard={editCard}
           delCard={delCard}
           findCard={findCard}
-          hasDrop={hasDrop}
           profileCard={profileCard}
           doubleClickCard={doubleClickBtn}
         />

--
Gitblit v1.8.0