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/menu/components/card/cardcellcomponent/dragaction/index.jsx | 33 +++++++++++++++++++++++---------- 1 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx index 3c2561c..bc62df0 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx @@ -8,7 +8,7 @@ import Action from './action' import './index.scss' -const Container = ({list, fields, handleList, handleMenu, deleteMenu, profileAction, handleStyle, updateMarks, dropButton, handleSubConfig }) => { +const Container = ({list, parent, fields, handleList, handleMenu, deleteMenu, profileAction, handleStyle, updateMarks, dropButton, handleSubConfig }) => { const [cards, setCards] = useState(list) const moveCard = (id, atIndex) => { const { card, index } = findCard(id) @@ -34,18 +34,25 @@ } const copyCard = id => { - const { card, index: overIndex } = findCard(id) + const { card } = findCard(id) let copycard = fromJS(card).toJS() + let _cards = fromJS(cards).toJS() - copycard.uuid = Utils.getuuid() - copycard.copyType = 'customCardElement' + if (card.eleType === 'button') { + copycard.copyType = 'action' + } else { + copycard.copyType = 'customCardElement' + } copycard.focus = true - let _val = '' + let _val = fromJS(copycard).toJS() + + copycard.uuid = Utils.getuuid() + copycard.originCard = card try { - _val = window.btoa(window.encodeURIComponent(JSON.stringify(copycard))) - } catch { + _val = window.btoa(window.encodeURIComponent(JSON.stringify(_val))) + } catch (e) { console.warn('Stringify Failure') _val = '' } @@ -59,7 +66,7 @@ document.body.removeChild(oInput) } - const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) + _cards.push(copycard) handleList(_cards) handleMenu(copycard) @@ -77,9 +84,12 @@ const doubleClickCard = id => { const { card } = findCard(id) - if (card.OpenType === 'pop') { - handleSubConfig(card) + + if (card.eleType !== 'button') { + return } + + handleSubConfig(card) } const delCard = id => { @@ -105,6 +115,8 @@ id={card.uuid} key={card.uuid} card={card} + parent={parent} + copyCard={copyCard} moveCard={moveCard} editCard={editCard} changeStyle={changeStyle} @@ -120,6 +132,7 @@ id={card.uuid} key={card.uuid} card={card} + parent={parent} fields={fields} moveCard={moveCard} copyCard={copyCard} -- Gitblit v1.8.0