king
2024-03-21 a9b02f6862522b54d0824152017bf2acfec2af7b
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -10,11 +10,12 @@
const { TextArea } = Input
const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror'))
const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const cardTypeOptions = {
  sequence: ['eleType', 'width'],
  sequence: ['eleType', 'width', 'prefix', 'postfix'],
  text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable', 'alignItems', 'sortField'],
  number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle', 'alignItems'],
  picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'],
@@ -164,7 +165,10 @@
      } else {
        _options.push('value')
      }
      if (this.record.eleType === 'video' && this.record.posterType) {
      if (this.record.eleType === 'picture' && this.record.noValue === 'show') {
        _options.push('lostTip')
      } else if (this.record.eleType === 'video' && this.record.posterType) {
        if (this.record.posterType === 'dynamic') {
          _options.push('posterField')
        } else {
@@ -341,7 +345,7 @@
          return item
        })
      })
    } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType'].includes(key)) {
    } else if (['datatype', 'showInfo', 'showType', 'fixStyle', 'posterType', 'eval', 'linkType', 'tipType', 'noValue'].includes(key)) {
      let _options = this.getOptions()
      this.setState({
@@ -396,52 +400,26 @@
          </Col>
        )
      } else if (item.type === 'textarea') {
        if (item.key === 'formula') {
          fields.push(
            <Col span={24} className="textarea" key={index}>
              <Form.Item label={item.tooltip ?
                <Tooltip placement="topLeft" title={item.tooltip}>
                  <QuestionCircleOutlined className="mk-form-tip" />
                  {item.label}
                </Tooltip> : item.label
              }>
                {getFieldDecorator(item.key, {
                  initialValue: item.initVal || '',
                  rules: [
                    {
                      required: item.readonly ? false : !!item.required,
                      message: '请输入' + item.label + '!'
                    }
                  ]
                })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
              </Form.Item>
              <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click">
                <span className="formula-icon">字段集</span>
              </Popover>
            </Col>
          )
        } else {
          fields.push(
            <Col span={24} className="textarea" key={index}>
              <Form.Item label={item.tooltip ?
                <Tooltip placement="topLeft" title={item.tooltip}>
                  <QuestionCircleOutlined className="mk-form-tip" />
                  {item.label}
                </Tooltip> : item.label
              }>
                {getFieldDecorator(item.key, {
                  initialValue: item.initVal || '',
                  rules: [
                    {
                      required: item.readonly ? false : !!item.required,
                      message: '请输入' + item.label + '!'
                    }
                  ]
                })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
              </Form.Item>
            </Col>
          )
        }
        fields.push(
          <Col span={24} className="textarea" key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" title={item.tooltip}>
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [
                  {
                    required: item.readonly ? false : !!item.required,
                    message: '请输入' + item.label + '!'
                  }
                ]
              })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'number') {
        fields.push(
          <Col span={12} key={index}>
@@ -561,10 +539,11 @@
          </Col>
        )
      } else if (item.type === 'file') {
        let type = this.state.eleType
        let type = this.record.eleType
        if (item.key === 'posterUrl') {
          type = 'picture'
        }
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
@@ -610,6 +589,32 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'codemirror') {
        fields.push(
          <Col span={24} key={index} className="textarea">
            <Form.Item label={
              <Tooltip placement="topLeft" overlayStyle={{width: 500, maxWidth: 500}} title={item.tooltip}>
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip>
            }>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [
                  {
                    required: !!item.required,
                    message: '请输入' + item.label + '!'
                  }
                ]
              })(
                <CodeMirror mode="text/javascript"/>
              )}
            </Form.Item>
            <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click">
              <span className="formula-icon">字段集</span>
            </Popover>
          </Col>
        )
      }
    })
    return fields