| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form, Rate, Icon } from 'antd' |
| | | import { QuestionCircleOutlined, UploadOutlined, EditOutlined, CopyOutlined, CloseOutlined } from '@ant-design/icons' |
| | | import { Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox, Form, Rate } from 'antd' |
| | | import { QuestionCircleOutlined, UploadOutlined, EditOutlined, CopyOutlined, CloseOutlined, StarFilled } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker } = DatePicker |
| | |
| | | } else if (card.type === 'linkMain') { |
| | | formItem = (<Input style={{marginTop: '4px'}} />) |
| | | } else if (card.type === 'rate') { |
| | | formItem = (<Rate value={card.initval || 0} count={card.rateCount || 5} character={card.character ? <Icon type={card.character}/> : <Icon type="star" theme="filled"/>} allowHalf={card.allowHalf === 'true'} />) |
| | | formItem = (<Rate value={card.initval || 0} count={card.rateCount || 5} character={card.character ? <MkIcon type={card.character}/> : <StarFilled />} allowHalf={card.allowHalf === 'true'} />) |
| | | } else if (card.type === 'switch') { |
| | | formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval}/>) |
| | | } else if (card.type === 'radio') { |
| | |
| | | } |
| | | |
| | | let _label = card.label |
| | | let colon = !!card.label |
| | | if (card.tooltip) { |
| | | _label = <span><QuestionCircleOutlined className="mk-form-tip" />{card.label}</span> |
| | | } |
| | | if (card.type === 'brafteditor' && card.hidelabel === 'true') { |
| | | _label = null |
| | | colon = false |
| | | } else if (card.type === 'hint') { |
| | | _label = _label || ' ' |
| | | } |
| | | |
| | | return ( |
| | |
| | | <div ref={node => drag(drop(node))} onDoubleClick={edit}> |
| | | {card.type === 'split' ? formItem : <Form.Item |
| | | className={className} |
| | | colon={!!_label} |
| | | colon={colon} |
| | | label={_label} |
| | | required={card.required === 'true'} |
| | | extra={card.extra || null} |
| | |
| | | wrapperCol={card.labelwidth ? {style: {width: (100 - card.labelwidth) + '%'}} : null} |
| | | > |
| | | {formItem} |
| | | {showField ? <div className="field-name">{card.field}{card.hidden === 'true' ? '(隐藏)' : ''}</div> : ''} |
| | | {showField ? <div className="field-name" style={card.writein === 'false' ? {color: 'orange'} : {}}> |
| | | {card.field}{card.hidden === 'true' ? '(隐藏)' : ''}{card.readonly === 'true' ? '(只读)' : ''} |
| | | </div> : ''} |
| | | </Form.Item>} |
| | | </div> |
| | | </div> |