king
2020-03-04 54f2a3e1e54a6d8289ccb8d5de158f23150d7a5e
src/templates/ushare/modalform/index.jsx
@@ -20,6 +20,7 @@
  state = {
    openType: null,
    resourceType: null,
    supField: '',
    formlist: null,
    linkSubFields: null
  }
@@ -30,6 +31,7 @@
    let type = ''
    let resourceType = ''
    let supField = ''
    let linkSubFields = []
    formlist.forEach(cell => {
@@ -47,6 +49,8 @@
            return false
          }
        })
      } else if (cell.key === 'supField') {
        supField = cell.initVal
      }
    })
    
@@ -78,8 +82,17 @@
      _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength']
    }
    if (type !== 'funcvar' && type !== 'linkMain') {
      if (supField) {
        _options.push('supField', 'supvalue')
      } else {
        _options.push('supField')
      }
    }
    this.setState({
      openType: type,
      supField: supField,
      resourceType: resourceType,
      linkSubFields: linkSubFields,
      formlist: formlist.map(form => {
@@ -148,6 +161,14 @@
      } else if (value === 'linkMain') {
        _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength']
      }
      if (value !== 'funcvar' && value !== 'linkMain') {
        if (this.state.supField) {
          _options.push('supField', 'supvalue')
        } else {
          _options.push('supField')
        }
      }
      
      this.setState({
        openType: value,
@@ -199,6 +220,19 @@
        formlist: this.state.formlist.map(form => {
          if (form.key === 'options') {
            form.initVal = option.options
          }
          return form
        })
      })
    } else if (key === 'supField') {
      this.setState({
        supField: value,
        formlist: this.state.formlist.map(form => {
          if (form.key === 'supvalue' && value) {
            form.show = true
          } else if (form.key === 'supvalue' && !value) {
            form.show = false
          }
          return form
@@ -381,7 +415,12 @@
      } else if (item.type === 'select') { // 下拉搜索
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" title={item.tooltip}>
                <Icon type="question-circle" />
                {item.label}
              </Tooltip> : item.label
            }>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [