| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox } from 'antd' |
| | | import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | selectval = card.emptyText || '空' |
| | | } |
| | | } |
| | | let labelCol = 'ant-col-sm-8' |
| | | let wrapCol = 'ant-col-sm-16' |
| | | let isEntireLine = false |
| | | // let labelCol = 'ant-col-sm-8' |
| | | // let wrapCol = 'ant-col-sm-16' |
| | | // let isEntireLine = false |
| | | |
| | | if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { |
| | | isEntireLine = true |
| | | } |
| | | // if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { |
| | | // isEntireLine = true |
| | | // } |
| | | |
| | | if (isEntireLine) { |
| | | if (cols === '2') { |
| | | labelCol = 'ant-col-sm-4' |
| | | wrapCol = 'ant-col-sm-20' |
| | | } else if (cols === '3') { |
| | | labelCol = 'ant-col-cuslabel' |
| | | wrapCol = 'ant-col-cuswrap' |
| | | } else if (cols === '4') { |
| | | labelCol = 'ant-col-sm-2' |
| | | wrapCol = 'ant-col-sm-22' |
| | | } |
| | | if (card.hidelabel === 'true') { |
| | | wrapCol = 'ant-col-sm-24' |
| | | } |
| | | } |
| | | // if (isEntireLine) { |
| | | // if (cols === '2') { |
| | | // labelCol = 'ant-col-sm-4' |
| | | // wrapCol = 'ant-col-sm-20' |
| | | // } else if (cols === '3') { |
| | | // labelCol = 'ant-col-cuslabel' |
| | | // wrapCol = 'ant-col-cuswrap' |
| | | // } else if (cols === '4') { |
| | | // labelCol = 'ant-col-sm-2' |
| | | // wrapCol = 'ant-col-sm-22' |
| | | // } |
| | | // if (card.hidelabel === 'true') { |
| | | // wrapCol = 'ant-col-sm-24' |
| | | // } |
| | | // } |
| | | |
| | | let formItem = null |
| | | if (card.type === 'text') { |
| | |
| | | </Checkbox.Group>) |
| | | } else if (card.type === 'hint') { |
| | | formItem = <div style={{marginTop: '10px', color: 'rgba(0, 0, 0, 0.85)'}}>{card.message}</div> |
| | | } else if (card.type === 'split') { |
| | | formItem = <div className="split-line">{card.label}</div> |
| | | } else if (card.type === 'checkcard') { |
| | | formItem = <CheckCard width={card.width} ratio={card.ratio} display={card.display} fields={card.fields} options={card.options} /> |
| | | } |
| | |
| | | } trigger="hover"> |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {<div className="ant-row ant-form-item"> |
| | | {card.type === 'split' ? formItem : <Form.Item |
| | | className="ant-form-item" |
| | | colon={!!card.label} |
| | | label={card.tooltip ? <span><Icon type="question-circle" />{card.label}</span> : card.label} |
| | | required={card.required === 'true'} |
| | | extra={card.extra || null} |
| | | labelCol={card.labelwidth ? {style: {width: card.labelwidth + '%'}} : null} |
| | | > |
| | | {formItem} |
| | | {showField ? <div className="field-name">{card.field}</div> : ''} |
| | | </Form.Item>} |
| | | {/* <div className="ant-row ant-form-item"> |
| | | {card.hidelabel !== 'true' ? <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}> |
| | | {card.label ? <label className={card.required === 'true' ? 'required' : ''}>{card.tooltip ? |
| | | <Icon type="question-circle" /> : null} |
| | |
| | | {formItem} |
| | | {showField ? card.field : ''} |
| | | </div> |
| | | </div>} |
| | | </div> */} |
| | | </div> |
| | | </div> |
| | | </Popover> |