king
2024-08-28 c10fc10d5fd307a7b334bcde6af5c1175aaa0410
src/templates/sharecomponent/searchcomponent/searchform/index.jsx
@@ -110,7 +110,7 @@
  group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query', 'labelwidth'],
  switch: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'openText', 'closeText', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'],
  check: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'checkTip', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'],
  range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query', 'labelwidth']
  range: ['label', 'type', 'field', 'initval', 'match', 'ratio', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query', 'labelwidth', 'advanced']
}
class MainSearch extends Component {
@@ -234,8 +234,11 @@
        if (this.record.selectStyle === 'custom') {
          shows.push('backgroundColor')
        }
        if (this.record.multiple === 'dropdown' && this.record.resourceType === '1') {
          shows.push('mark', 'parentField')
        if (this.record.multiple === 'dropdown') {
          shows.push('mark')
          if (this.record.resourceType === '1') {
            shows.push('parentField')
          }
        }
      }
      shows.push('linkField')
@@ -280,7 +283,7 @@
    } else if (type === 'dateweek' || type === 'daterange' || type === 'range') {
      reOptions.match = matchReg.class5
    } else if (type === 'checkcard') {
      if (this.record.multiple === 'false') {
      if (this.record.multiple === 'false' || this.record.multiple === 'dropdown') {
        reOptions.match = matchReg.class1
      } else if (this.record.multiple === 'true') {
        reOptions.match = matchReg.class3
@@ -595,16 +598,18 @@
          { required: item.required, message: '请输入' + item.label + '!' }
        ]
        span = 24
        className = 'text-area'
        if (this.record.type === 'select' || this.record.type === 'link') {
          extra = <span className="add-resource-empty" onClick={this.handleEmpty}>全部</span>
        }
        if (item.placeholder) {
          className = 'show-public-var'
          extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</>
        }
        content = <CodeMirror />
      } else if (item.type === 'options') {
        span = 24
        className = 'text-area'
        let type = this.record.type
        
@@ -651,7 +656,6 @@
        }
      } else if (item.type === 'fields') {
        span = 24
        className = 'text-area'
        rules = [
          { required: item.required, message: '请添加' + item.label + '!' }
@@ -664,7 +668,7 @@
        ]
        content = <Checkbox.Group style={{width: '105%'}} options={item.options} onChange={(values) => this.optionChange(item.key, values)}/>
      } else if (item.type === 'multiselect') { // 多选
      } else if (item.type === 'multiselect') {
        content = <Select
          showSearch
          mode="multiple"
@@ -674,8 +678,8 @@
            <Select.Option id={i} key={i} value={option.value}>{option.text}</Select.Option>
          )}
        </Select>
      } else if (item.type === 'cascader') { // 多选
        content = <Cascader options={item.options} placeholder="" />
      } else if (item.type === 'cascader') {
        content = <Cascader options={item.options} />
      } else if (item.type === 'color') {
        className = 'color-form-item'
        rules = [
@@ -688,7 +692,7 @@
      fields.push(
        <Col span={span} key={index}>
          <Form.Item className={className} extra={extra} label={item.tooltip ?
            <Tooltip placement="topLeft" title={item.tooltip}>
            <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}>
              <QuestionCircleOutlined className="mk-form-tip" />
              {item.label}
            </Tooltip> : item.label
@@ -831,35 +835,45 @@
          if (values.type === 'range') {
            let error = ''
            if (values.maxValue <= values.minValue) {
              error = '最大值必须大于最小值'
            } else if (values.step <= 0) {
              error = '步长必须大于0'
            } else {
              let s = (values.maxValue - values.minValue) / values.step
              if (s !== parseInt(s)) {
                error = '步长必须被 (max - min) 整除'
            if (sessionStorage.getItem('appType') === 'mob') {
              if (values.maxValue <= values.minValue) {
                error = '最大值必须大于最小值'
              } else if (values.step <= 0) {
                error = '步长必须大于0'
              } else {
                let s = (values.maxValue - values.minValue) / values.step
                if (s !== parseInt(s)) {
                  error = '步长必须被 (max - min) 整除'
                }
              }
            }
            if (!error && values.initval) {
              if (!error && values.initval) {
                let vals = values.initval.split(',')
                if (vals.length !== 2) {
                  error = '初始值设置错误!'
                } else if (isNaN(parseFloat(vals[0])) || isNaN(parseFloat(vals[1]))) {
                  error = '初始值设置错误!'
                } else {
                  let start = parseFloat(vals[0])
                  let end = parseFloat(vals[1])
                  let s = (values.maxValue - start) / values.step
                  let e = (values.maxValue - end) / values.step
                  if (start > end || start < values.minValue || end > values.maxValue) {
                    error = '初始值设置错误!'
                  } else if (s !== parseInt(s) || e !== parseInt(e)) {
                    error = '初始值设置错误!'
                  }
                }
              }
            } else if (values.initval) {
              let vals = values.initval.split(',')
              if (vals.length !== 2) {
                error = '初始值设置错误!'
              } else if (isNaN(parseFloat(vals[0])) || isNaN(parseFloat(vals[1]))) {
                error = '初始值设置错误!'
              } else {
                let start = parseFloat(vals[0])
                let end = parseFloat(vals[1])
                let s = (values.maxValue - start) / values.step
                let e = (values.maxValue - end) / values.step
                if (start > end || start < values.minValue || end > values.maxValue) {
                  error = '初始值设置错误!'
                } else if (s !== parseInt(s) || e !== parseInt(e)) {
                  error = '初始值设置错误!'
                }
              }
            }
            if (error) {
              notification.warning({
                top: 92,