From f4b9504cad034ddcdef21c2081d14a4984fcd2d3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 15 七月 2024 17:14:48 +0800 Subject: [PATCH] 2024-07-15 --- src/menu/components/share/actioncomponent/dragaction/index.jsx | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/menu/components/share/actioncomponent/dragaction/index.jsx b/src/menu/components/share/actioncomponent/dragaction/index.jsx index 13bbd48..a90eb21 100644 --- a/src/menu/components/share/actioncomponent/dragaction/index.jsx +++ b/src/menu/components/share/actioncomponent/dragaction/index.jsx @@ -1,6 +1,7 @@ import React, { useState } from 'react' import { useDrop } from 'react-dnd' import { is, fromJS } from 'immutable' +import { message } from 'antd' import update from 'immutability-helper' import Utils from '@/utils/utils.js' @@ -64,19 +65,16 @@ let _val = fromJS(copycard).toJS() if (_val.control) { - _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') + let srcid = localStorage.getItem(window.GLOB.sysSign + 'srcId') if (srcid) { _val.$srcId = srcid } @@ -94,18 +92,61 @@ oInput.select() document.execCommand('Copy') document.body.removeChild(oInput) + + message.success('澶嶅埗鎴愬姛銆�') + } else { + message.warning('澶嶅埗澶辫触銆�') } - const { index: overIndex } = findCard(id) + // const { index: overIndex } = findCard(id) - const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) + // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) - handleList(_cards, copycard) + // handleList(_cards, copycard) } const [, drop] = useDrop({ accept: 'action', drop(item) { + if (item.$init) { // 鎷栨嫿娣诲姞 + if (item.class === 'element') { + delete item.overIndex + return + } + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + newcard.label = 'button' + newcard.verify = null + newcard.show = 'button' + newcard.Ot = 'requiredSgl' + newcard.OpenType = item.value + newcard.class = 'primary' + newcard.style = { marginRight: '15px' } + + if (newcard.OpenType === 'excelIn') { + newcard.label = item.text + newcard.class = 'border-dgreen' + newcard.Ot = 'notRequired' + } else if (newcard.OpenType === 'excelOut') { + newcard.label = item.text + newcard.execSuccess = 'never' + newcard.class = 'dgreen' + newcard.Ot = 'requiredOnce' + } + + 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) -- Gitblit v1.8.0