| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Select, DatePicker, Input, Popover, Form } from 'antd' |
| | | import { Select, DatePicker, Input, Popover, Form } from 'antd' |
| | | import { CopyOutlined, EditOutlined, CloseOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | const { Search } = Input |
| | | const CheckCard = asyncComponent(() => import('@/templates/modalconfig/checkCard')) |
| | | const appType = sessionStorage.getItem('appType') |
| | | |
| | | const Card = ({ id, card, showField, moveCard, copyCard, findCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | let _defaultValue = '' // 下拉搜索、时间范围类型,初始值需要预处理 |
| | | |
| | | if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { |
| | | if (card.initval) { |
| | | let _option = card.options.filter(option => option.Value === card.initval)[0] |
| | | if (_option) { |
| | | _defaultValue = _option.Text || '' |
| | | } else { |
| | | _defaultValue = '' |
| | | } |
| | | } else if (card.setAll === 'true') { |
| | | _defaultValue = 'All' |
| | | let _option = card.options.filter(option => option.Value === card.initval)[0] |
| | | if (_option) { |
| | | _defaultValue = _option.Text || '' |
| | | } else { |
| | | _defaultValue = '' |
| | | } |
| | | } else if (card.type === 'daterange') { |
| | | _defaultValue = [null, null] |
| | |
| | | } |
| | | } else if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') { |
| | | formItem = (<Select value={_defaultValue}></Select>) |
| | | } else if (card.type === 'date' && appType === 'mob') { |
| | | formItem = (<div className="mob-list-item">{card.initval ? moment().subtract(card.initval, 'days').format('YYYY-MM-DD') : '请选择'}<Icon type="right" /></div>) |
| | | } else if (card.type === 'datemonth' && appType === 'mob') { |
| | | formItem = (<div className="mob-list-item">{card.initval ? moment().subtract(card.initval, 'month').format('YYYY-MM') : '请选择'}<Icon type="right" /></div>) |
| | | } else if (card.type === 'date') { |
| | | formItem = (<Input style={{marginTop: '4px'}} placeholder={card.labelShow === 'false' ? card.label : ''} value={card.initval} />) |
| | | } else if (card.type === 'dateweek') { |
| | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="edit" type="edit" onClick={() => editCard(id)} /> |
| | | <Icon className="copy" title="copy" type="copy" onClick={() => copyCard(id)} /> |
| | | <Icon className="close" title="delete" type="close" onClick={() => delCard(id)} /> |
| | | <EditOutlined className="edit" onClick={() => editCard(id)} /> |
| | | <CopyOutlined className="copy" onClick={() => copyCard(id)} /> |
| | | <CloseOutlined className="close" onClick={() => delCard(id)} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className={'page-card ' + card.labelShow + ' ' + card.type} style={{ opacity: opacity}}> |