king
2022-03-01 3bb266595fbfa9af6b97405737496ed61c6b7c55
src/templates/zshare/modalform/index.jsx
@@ -414,6 +414,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
@@ -427,6 +457,7 @@
      let rules = []
      let className = ''
      let content = null
      let extra = null
      let initVal = item.initVal || ''
      if (item.type === 'text') {
@@ -513,6 +544,10 @@
        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 === 'textarea') {
        span = 24
@@ -536,7 +571,7 @@
          if (type === 'radio' && this.record.linkField) {
            type = 'link'
          }
          content = <EditTable type={type} transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
          content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
        } else {
          if (this.record.multiple === 'true') {
            linkSubFields = []
@@ -565,7 +600,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}