king
2023-03-11 34e7681fd12b1c4e4994d3bea1a553870e10bc50
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -17,7 +17,7 @@
  sequence: ['eleType', 'width'],
  text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable'],
  number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'],
  picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'backgroundSize', 'maxWidth', 'link', 'noValue'],
  picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'],
  video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'],
  icon: ['eleType', 'datatype', 'width', 'tooltip'],
  slider: ['eleType', 'datatype', 'width', 'color', 'maxValue', 'showInfo', 'showType', 'strokeWidth', 'strokeLinecap', 'trailColor'],
@@ -48,7 +48,7 @@
  }
  UNSAFE_componentWillMount () {
    const { card, config } = this.props
    const { card, config, side } = this.props
    let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '', card.posterType || '')
    
    this.setState({
@@ -64,20 +64,38 @@
        if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') {
          item.options = []
          config.columns.forEach(col => {
            let label = `${col.field}(${col.label})`
            if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
              item.options.push({
                value: col.field,
                text: label
              })
            } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
              item.options.push({
                value: col.field,
                text: label
              })
            }
          })
          if (side === 'sub') {
            config.subColumns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          } else {
            config.columns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          }
        } else if (item.key === 'value' && card.eleType === 'slider') {
          item.type = 'number'
          item.label = '值'
@@ -140,7 +158,7 @@
      }
    } else if (eleType === 'icon') {
      if (datatype === 'dynamic') {
        _options.push('field')
        _options.push('field', 'noValue')
      } else {
        _options.push('icon')
      }
@@ -159,7 +177,7 @@
   * 3、切换标签类型,重置可选标签
   */
  selectChange = (key, value, option) => {
    const { card, config } = this.props
    const { card, config, side } = this.props
    const { datatype, eleType, showType, showInfo, fixStyle, posterType } = this.state
    if (key === 'eleType') {
@@ -170,21 +188,39 @@
        if (item.key === 'field') {
          item.options = []
          config.columns.forEach(col => {
            let label = `${col.field}(${col.label})`
            if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
              item.options.push({
                value: col.field,
                text: label
              })
            } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
              item.options.push({
                value: col.field,
                text: label
              })
            }
          })
          if (side === 'sub') {
            config.subColumns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          } else {
            config.columns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (value === 'number' || value === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && value !== 'number' && value !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          }
        } else if (item.key === 'value') {
          if (value === 'slider') {
            item.type = 'number'