| | |
| | | import { Icon, Select, DatePicker, Input, InputNumber, Button, Popover, Switch, Radio, Checkbox } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import CheckCard from '../checkCard' |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker } = DatePicker |
| | | const { TextArea } = Input |
| | | |
| | | const Editor = asyncComponent(() => import('@/components/editor')) |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const CheckCard = asyncComponent(() => import('../checkCard')) |
| | | |
| | | const Card = ({ id, card, cols, moveCard, findCard, editCard, closeCard, copyCard, showField }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | let wrapCol = 'ant-col-sm-16' |
| | | let isEntireLine = false |
| | | |
| | | if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard'].includes(card.type)) { |
| | | if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { |
| | | isEntireLine = true |
| | | } |
| | | |
| | |
| | | formItem = (<DatePicker showTime value={card.initval ? moment().subtract(card.initval, 'days') : null} />) |
| | | } else if (card.type === 'textarea') { |
| | | formItem = (<TextArea value={card.initval} autoSize={{ minRows: 2, maxRows: 6 }} />) |
| | | } else if (card.type === 'brafteditor') { |
| | | formItem = (<Editor />) |
| | | } else if (card.type === 'fileupload') { |
| | | formItem = (<Button style={{marginTop: '3px'}}><Icon type="upload" /> 点击上传 </Button>) |
| | | } else if (card.type === 'funcvar') { |
| | |
| | | {cards.map(card => { |
| | | let isEntireLine = false |
| | | |
| | | if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard'].includes(card.type)) { |
| | | if (card.entireLine === 'true' || ['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type)) { |
| | | isEntireLine = true |
| | | } |
| | | |
| | |
| | | min-width: 100px; |
| | | } |
| | | } |
| | | .normal-braft-editor { |
| | | border: 1px solid #d9d9d9; |
| | | border-radius: 4px; |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper::after { |
| | | content: ''; |
| | |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: '富文本', |
| | | subType: 'brafteditor', |
| | | url: '' |
| | | }, |
| | | { |
| | | type: 'form', |
| | | label: CommonDict['header.form.funcvar'], |
| | | subType: 'funcvar', |
| | | url: '' |
| | |
| | | value: 'color', |
| | | text: Formdict['model.form.color'] |
| | | }, { |
| | | value: 'brafteditor', |
| | | text: '富文本' |
| | | }, { |
| | | value: 'funcvar', |
| | | text: Formdict['header.form.funcvar'] |
| | | }, |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidelabel', |
| | | label: '隐藏名称', |
| | | initVal: card.hidelabel || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'readonly', |
| | | label: Formdict['header.form.readonly'], |
| | | initVal: card.readonly || 'false', |
| | |
| | | textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxRows', 'encryption', 'interception', 'tooltip'], |
| | | color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | hint: ['label', 'type', 'blacklist', 'message'], |
| | | brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'tooltip'], |
| | | funcvar: [], |
| | | linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'entireLine', 'tooltip'] |
| | | } |
| | |
| | | getPopupContainer={() => document.getElementById('modal-fields-form-box')} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option key={`${i}`} value={option.value || option.field}> |
| | | <Select.Option key={`${i}`} value={option.value || option.field || ''}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.label} |
| | | </Select.Option> |
| | | )} |