| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | const { TextArea } = Input |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | const MkIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | |
| | | const cardTypeOptions = { |
| | | sequence: ['eleType', 'width'], |
| | |
| | | item.label = '值' |
| | | } else if (item.key === 'format') { |
| | | if (card.eleType === 'text') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') |
| | | item.options = item.oriOptions.filter(op => !['percent', 'thdSeparator', 'abs'].includes(op.value)) |
| | | } else if (card.eleType === 'number') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') |
| | | item.options = item.oriOptions.filter(op => !op.value || ['percent', 'thdSeparator', 'abs'].includes(op.value)) |
| | | } |
| | | } else if (item.key === 'url') { |
| | | item.required = card.eleType !== 'qrcode' |
| | |
| | | getOptions = (eleType, datatype, link, showType, showInfo) => { |
| | | let _options = fromJS(cardTypeOptions[eleType]).toJS() // 选项列表 |
| | | |
| | | if (['text', 'number', 'picture', 'link', 'slider', 'barcode', 'qrcode', 'video'].includes(eleType)) { |
| | | if (['text', 'number', 'picture', 'slider', 'barcode', 'qrcode', 'video'].includes(eleType)) { |
| | | if (datatype === 'dynamic') { |
| | | _options.push('field') |
| | | } else if (eleType === 'picture' || eleType === 'video') { |
| | |
| | | } |
| | | |
| | | if (['text', 'picture'].includes(eleType) && link) { |
| | | if (link === 'dynamic' || link === 'static' || link === 'custom') { |
| | | _options.push('linkurl', 'joint') |
| | | } else if (link === 'page') { |
| | | _options.push('copyMenuId', 'joint', 'open') |
| | | } else if (link === 'linkpage') { |
| | | _options.push('linkmenu', 'joint', 'open') |
| | | } |
| | | // if (link === 'dynamic' || link === 'static') { |
| | | _options.push('linkurl', 'joint', 'linkType') |
| | | // } |
| | | } else if (eleType === 'picture' && !link) { |
| | | _options.push('scale') |
| | | } else if (eleType === 'slider') { |
| | |
| | | } |
| | | } else if (item.key === 'format') { |
| | | if (value === 'text') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') |
| | | item.options = item.oriOptions.filter(op => !['percent', 'thdSeparator', 'abs'].includes(op.value)) |
| | | } else if (value === 'number') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') |
| | | item.options = item.oriOptions.filter(op => !op.value || ['percent', 'thdSeparator', 'abs'].includes(op.value)) |
| | | } |
| | | } else if (item.key === 'url') { |
| | | item.required = value !== 'qrcode' |
| | |
| | | this.props.form.setFieldsValue({width: 24, color: '#1890ff'}) |
| | | } else if (value === 'splitline') { |
| | | this.props.form.setFieldsValue({width: 24, color: '#e8e8e8'}) |
| | | } else if (value === 'qrcode') { |
| | | this.props.form.setFieldsValue({color: '#000000'}) |
| | | } else if (value === 'text' || value === 'number') { |
| | | this.props.form.setFieldsValue({format: ''}) |
| | | } |
| | |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text} |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | }] |
| | | })( |
| | | <MkIcon /> |
| | | <MkEditIcon /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |