| | |
| | | import { useDrop } from 'react-dnd' |
| | | import { is, fromJS } from 'immutable' |
| | | import update from 'immutability-helper' |
| | | import { Icon } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Card from './card' |
| | | import './index.scss' |
| | | |
| | | const Container = ({plus, list, handleList, handleMenu, deleteMenu, profileMenu, doubleClickCard }) => { |
| | | const Container = ({list, handleList, handleMenu, deleteMenu, profileMenu, doubleClickCard }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | drop() {} |
| | | }) |
| | | |
| | | const addaction = () => { |
| | | let newcard = {} |
| | | newcard.uuid = Utils.getuuid() |
| | | newcard.focus = true |
| | | |
| | | newcard.label = 'button' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = 'prompt' |
| | | newcard.icon = '' |
| | | newcard.class = 'primary' |
| | | newcard.intertype = 'system' |
| | | newcard.method = 'POST' |
| | | newcard.execSuccess = 'grid' |
| | | newcard.execError = 'never' |
| | | newcard.popClose = 'never' |
| | | newcard.errorTime = 10 |
| | | newcard.verify = null |
| | | newcard.show = 'icon' |
| | | |
| | | let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 |
| | | |
| | | const { index: overIndex } = findCard(`${targetId}`) |
| | | let targetIndex = overIndex |
| | | |
| | | targetIndex++ |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | |
| | | handleList(_cards, newcard) |
| | | } |
| | | |
| | | return ( |
| | | <div ref={drop} className="ant-row"> |
| | | {cards.map(card => ( |
| | |
| | | doubleClickCard={doubleClickBtn} |
| | | /> |
| | | ))} |
| | | {plus !== 'false' ? <Icon type="plus" title="添加按钮" onClick={addaction}/> : null} |
| | | </div> |
| | | ) |
| | | } |