king
2022-01-21 46f79b491173d284a4900d19e7aecf7509481438
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -1,7 +1,7 @@
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'
@@ -11,7 +11,7 @@
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'],
@@ -79,9 +79,9 @@
          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'
@@ -98,7 +98,7 @@
  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') {
@@ -108,13 +108,9 @@
      }
      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') {
@@ -177,9 +173,9 @@
          }
        } 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'
@@ -200,6 +196,8 @@
          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: ''})
        }
@@ -385,7 +383,7 @@
                >
                  {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>
@@ -409,7 +407,7 @@
                  message: this.props.dict['form.required.select'] + item.label + '!'
                }]
              })(
                <MkIcon />
                <MkEditIcon />
              )}
            </Form.Item>
          </Col>