| | |
| | | import { useDrop } from 'react-dnd' |
| | | import { is, fromJS } from 'immutable' |
| | | import update from 'immutability-helper' |
| | | import { Col, Button } from 'antd' |
| | | import { Col, Button, Popover } from 'antd' |
| | | import { EditOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import Card from './card' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, show, showField, handleList, handleMenu, deleteMenu }) => { |
| | | const Container = ({list, setting, handleList, handleMenu, deleteMenu, handleSetting }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | } |
| | | }) |
| | | |
| | | let radio = 6 |
| | | if (cards.length > 0) { |
| | | radio = cards[cards.length - 1].ratio || 6 |
| | | } |
| | | let radio = setting.searchRatio || 6 |
| | | let labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3 |
| | | let advanceType = setting.advanceType || 'modal' |
| | | |
| | | return ( |
| | | <div ref={drop} className="ant-row"> |
| | | {cards.map(card => ( |
| | | <Col key={card.uuid} span={card.ratio || 6}> |
| | | <Card |
| | | id={`${card.uuid}`} |
| | | card={card} |
| | | showField={showField} |
| | | moveCard={moveCard} |
| | | copyCard={copyCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | /> |
| | | </Col> |
| | | ))} |
| | | {cards.length > 0 && show !== 'false' ? <Col key="action" className="action" span={radio < 6 ? 6 : radio}> |
| | | {cards.map(card => { |
| | | let _ratio = card.ratio || 6 |
| | | if (card.advanced === 'true' && advanceType !== 'pulldown') { |
| | | _ratio = 6 |
| | | } |
| | | return ( |
| | | <Col className="mk-search-item-wrap" key={card.uuid} span={_ratio}> |
| | | <Card |
| | | id={`${card.uuid}`} |
| | | card={card} |
| | | moveCard={moveCard} |
| | | copyCard={copyCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | /> |
| | | </Col> |
| | | ) |
| | | })} |
| | | {cards.length > 0 ? <Col className={'mk-search-item-wrap action ' + (setting.show === 'false' ? 'hide-button' : '')} key="action" span={radio}> |
| | | <div className="ant-row ant-form-item" style={{whiteSpace: 'nowrap', lineHeight: '40px', height: '55px', marginBottom: 0}}> |
| | | <div className="ant-col ant-form-item-label ant-col-xs-24 ant-col-sm-8"> |
| | | </div> |
| | | <div className="ant-col ant-form-item-control-wrapper ant-col-xs-24 ant-col-sm-16"> |
| | | <Button type="primary">搜索</Button> |
| | | <Button style={{ marginLeft: 8 }}>重置</Button> |
| | | <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div> |
| | | </div> |
| | | <div className="ant-col ant-form-item-label" style={{width: labelwidth + '%'}}></div> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <EditOutlined className="edit" onClick={() => handleSetting()} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="ant-col ant-form-item-control-wrapper"> |
| | | <Button type="primary">搜索</Button> |
| | | <Button style={{ marginLeft: 8 }}>重置</Button> |
| | | <div style={{position: 'absolute', top: 0, bottom: 0, left: 0, right: 0}}></div> |
| | | </div> |
| | | </Popover> |
| | | </div> |
| | | </Col> : null} |
| | | {cards.length === 0 ? |