king
2022-03-01 3bb266595fbfa9af6b97405737496ed61c6b7c55
src/templates/sharecomponent/searchcomponent/searchform/index.jsx
@@ -385,6 +385,36 @@
    }
  }
  handleEmpty = () => {
    let field = this.props.form.getFieldValue('valueField')
    if (!field) {
      notification.warning({
        top: 92,
        message: '请填写值·字段。',
        duration: 5
      })
      return
    }
    let text = this.props.form.getFieldValue('valueText')
    if (!text) {
      notification.warning({
        top: 92,
        message: '请填写文本·字段。',
        duration: 5
      })
      return
    }
    let resource = this.props.form.getFieldValue('dataSource') || ''
    resource = `select '' as ${field},'全部' as ${text} union all \n${resource}`
    this.props.form.setFieldsValue({dataSource: resource})
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const { dict } = this.props
@@ -398,6 +428,7 @@
      let rules = []
      let className = ''
      let content = null
      let extra = null
      let initVal = item.initVal || ''
      if (item.type === 'text') { // 文本搜索
@@ -462,12 +493,16 @@
            )
          })}
        </Radio.Group>
      } else if (item.type === 'textarea') {
      } else if (item.type === 'codemirror') {
        rules = [
          { required: item.required, message: dict['form.required.input'] + item.label + '!' }
        ]
        span = 24
        className = 'text-area'
        if (this.record.type === 'select' || this.record.type === 'link') {
          extra = <span className="add-row-empty" onClick={this.handleEmpty}>全部</span>
        }
        content = <CodeMirror />
      } else if (item.type === 'options') {
@@ -477,7 +512,7 @@
        let type = this.record.type
        
        if (type !== 'checkcard') {
          content = <EditTable type={type} transfield={{}} linkSubFields={[]} onChange={this.changeOptions}/>
          content = <EditTable type={type} module="search" transfield={{}} linkSubFields={[]} onChange={this.changeOptions}/>
        } else {
          if (this.record.linkField) {
            type = 'link'
@@ -514,7 +549,7 @@
      fields.push(
        <Col span={span} key={index}>
          <Form.Item className={className} label={item.tooltip ?
          <Form.Item className={className} extra={extra} label={item.tooltip ?
            <Tooltip placement="topLeft" title={item.tooltip}>
              <QuestionCircleOutlined className="mk-form-tip" />
              {item.label}