| | |
| | | const [, drop] = useDrop({ |
| | | accept: 'action', |
| | | drop(item) { |
| | | if (item.$init) { // 拖拽添加 |
| | | let newcard = {} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | // 显示列过滤 |
| | | if (parent.type === 'custom' && item.class !== 'element') { |
| | | delete item.overIndex |
| | | return |
| | | } else if (parent.type === 'action' && item.class === 'element') { |
| | | delete item.overIndex |
| | | return |
| | | } |
| | | |
| | | if (item.class === 'element') { |
| | | newcard.eleType = item.value |
| | | newcard.datatype = 'dynamic' |
| | | newcard.height = 1 |
| | | } else { |
| | | newcard.eleType = 'button' |
| | | newcard.label = 'button' |
| | | newcard.verify = null |
| | | newcard.show = 'link' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.value |
| | | newcard.class = 'primary' |
| | | |
| | | 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) |
| | | } else { |
| | | handleList([...cards, newcard]) |
| | | } |
| | | |
| | | handleMenu(newcard) |
| | | |
| | | delete item.overIndex |
| | | return |
| | | } |
| | | |
| | | const { index } = findCard(item.id) |
| | | if (index > -1) return |
| | | dropButton(item.id) |
| | |
| | | id={card.uuid} |
| | | key={card.uuid} |
| | | card={card} |
| | | parent={parent} |
| | | copyCard={copyCard} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |