From 41c55c1f103658b997f7a828a7067bdb228f1df0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 04 十月 2022 23:35:10 +0800
Subject: [PATCH] 2022-10-04

---
 src/menu/components/share/actioncomponent/dragaction/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/menu/components/share/actioncomponent/dragaction/index.jsx b/src/menu/components/share/actioncomponent/dragaction/index.jsx
index afa3b70..d52c80d 100644
--- a/src/menu/components/share/actioncomponent/dragaction/index.jsx
+++ b/src/menu/components/share/actioncomponent/dragaction/index.jsx
@@ -7,7 +7,7 @@
 import Card from './card'
 import './index.scss'
 
-const Container = ({list, handleList, handleMenu, deleteMenu, profileMenu, changeBtnStyle, dropButton, doubleClickCard }) => {
+const Container = ({list, type, handleList, handleMenu, deleteMenu, profileMenu, changeBtnStyle, dropButton, doubleClickCard }) => {
   const [cards, setCards] = useState(list)
   const moveCard = (id, atIndex) => {
     const { card, index } = findCard(id)
@@ -63,12 +63,24 @@
 
     let _val = fromJS(copycard).toJS()
 
+    if (_val.control) {
+      delete _val.controlField
+      delete _val.controlVal
+    }
+
     copycard.uuid = Utils.getuuid()
     copycard.originCard = card
 
     try {
+      delete _val.$srcId
+    
+      let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId')
+      if (srcid) {
+        _val.$srcId = srcid
+      }
+      
       _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val)))
-    } catch {
+    } catch (e) {
       console.warn('Stringify Failure')
       _val = ''
     }
@@ -92,6 +104,46 @@
   const [, drop] = useDrop({
     accept: 'action',
     drop(item) {
+      if (item.$init) { // 鎷栨嫿娣诲姞
+        let newcard = {}
+        newcard.uuid = Utils.getuuid()
+        newcard.focus = true
+        
+        if (item.class === 'element') {
+          delete item.overIndex
+          return
+        } else {
+          newcard.label = 'button'
+          newcard.verify = null
+          newcard.show = 'link'
+          newcard.Ot = 'requiredSgl'
+          newcard.OpenType = item.value
+          newcard.class = 'primary'
+          newcard.style = { marginRight: '15px' }
+
+          if (newcard.OpenType === 'excelIn') {
+            newcard.label = item.text
+            newcard.class = 'dgreen'
+            newcard.Ot = 'notRequired'
+          } else if (item.subType === 'excelOut') {
+            newcard.label = item.text
+            newcard.execSuccess = 'never'
+            newcard.class = 'dgreen'
+          }
+        }
+
+        if (item.overIndex) {
+          const { index } = findCard(item.overIndex)
+          const _cards = update(cards, { $splice: [[index + 1, 0, newcard]] })
+          handleList(_cards, newcard)
+        } else {
+          handleList([...cards, newcard], newcard)
+        }
+
+        delete item.overIndex
+        return
+      }
+
       const { index } = findCard(item.id)
       if (index > -1) return
       dropButton(item.id)
@@ -105,6 +157,7 @@
           id={card.uuid}
           key={card.uuid}
           card={card}
+          type={type}
           moveCard={moveCard}
           copyCard={copyCard}
           editCard={editCard}

--
Gitblit v1.8.0