king
2022-11-21 f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89
src/templates/zshare/modalform/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip, Checkbox } from 'antd'
import { Form, Row, Col, Input, Select, Radio, notification, InputNumber, Tooltip, Checkbox, AutoComplete } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { formRule } from '@/utils/option.js'
@@ -565,6 +565,12 @@
    this.props.form.setFieldsValue({dataSource: resource})
  }
  complete = (key, option) => {
    let label = option.props.label
    this.props.form.setFieldsValue({label: label})
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const { transfield } = this.state
@@ -613,7 +619,20 @@
          })
        }
        content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
        if (item.key === 'field' && item.options && item.options.length > 0) {
          content = <AutoComplete
            dataSource={item.options.map((cell) => <AutoComplete.Option label={cell.label} value={cell.field} key={cell.uuid}>
              {cell.field}
            </AutoComplete.Option>)}
            filterOption={(input, option) => option.props.children.indexOf(input) > -1}
            onSelect={this.complete}
            placeholder=""
          >
            <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
          </AutoComplete>
        } else {
          content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
        }
      } else if (item.type === 'number') {
        rules = [
          { required: item.required, message: '请输入' + item.label + '!' }