king
2020-04-03 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa
src/templates/zshare/modalform/index.jsx
@@ -8,6 +8,21 @@
const { TextArea } = Input
const modalTypeOptions = {
  text: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'regular'],
  number: ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist'],
  select: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkSubField'],
  multiselect: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'fieldlength'],
  link: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkField'],
  fileupload: ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist', 'maxfile', 'fileType'],
  date: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'],
  datemonth: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'],
  datetime: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'],
  textarea: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'maxRows'],
  funcvar: ['label', 'field', 'type', 'blacklist'],
  linkMain: ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist']
}
class MainSearch extends Component {
  static propTpyes = {
    dict: PropTypes.object,    // 字典项
@@ -54,32 +69,12 @@
      }
    })
    
    let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'] // 默认显示项
    let _options = modalTypeOptions[type]
    if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源
      _options = [..._options, 'resourceType', 'options', 'quick']
      _options = [..._options, 'options', 'quick']
    } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源
      _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
    } else if (type === 'number') {
      _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist']
    } else if (type === 'fileupload') {
      _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist']
    } else if (type === 'textarea') {
      _options = [..._options, 'fieldlength', 'maxRows']
    } else if (type === 'text') {
      _options = [..._options, 'fieldlength', 'regular']
    }
    if (type === 'select') {
      _options = [..._options, 'setAll', 'linkSubField']
    } else if (type === 'multiselect') {
      _options = [..._options, 'fieldlength']
    } else if (type === 'link') {          // 关联类型、增加关联字段
      _options = [..._options, 'setAll', 'linkField']
    } else if (type === 'funcvar') {       // 设置为函数变量时,不需要其他信息
      _options = ['label', 'field', 'type', 'blacklist']
    } else if (type === 'linkMain') {
      _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist']
      _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
    }
    if (type !== 'funcvar' && type !== 'linkMain') {
@@ -132,34 +127,13 @@
  }
  openTypeChange = (key, value) => {
    if (key === 'type') {
      let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist']
      let _options = modalTypeOptions[value]
      if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源
        _options = [..._options, 'resourceType', 'options', 'quick']
        _options = [..._options, 'options', 'quick']
      } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源
        _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
      } else if (value === 'number') {
        _options = ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist']
      } else if (value === 'fileupload') {
        _options = ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist']
      } else if (value === 'textarea') {
        _options = [..._options, 'fieldlength', 'maxRows']
      } else if (value === 'text') {
        _options = [..._options, 'fieldlength', 'regular']
      }
      if (value === 'select') {
        _options = [..._options, 'setAll', 'linkSubField']
      } else if (value === 'multiselect') {
        _options = [..._options, 'fieldlength']
      } else if (value === 'link') {
        _options = [..._options, 'setAll', 'linkField']
      } else if (value === 'funcvar') {
        _options = ['label', 'field', 'type', 'blacklist']
      } else if (value === 'linkMain') {
        _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist']
        _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
      }
      if (value !== 'funcvar' && value !== 'linkMain') {
@@ -267,21 +241,14 @@
    const { openType } = this.state
    let value = e.target.value
    if (key === 'resourceType') {
      let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'supField']
      let _options = modalTypeOptions[openType]
      if (value === '0') {
        _options = [..._options, 'options', 'quick']
      } else if (value === '1') {
        _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database']
      }
      if (openType === 'select') {
        _options = [..._options, 'setAll', 'linkSubField']
      } else if (openType === 'link') {
        _options = [..._options, 'setAll', 'linkField']
      } else if (openType === 'multiselect') {
        _options = [..._options, 'fieldlength']
      }
      this.setState({
        resourceType: value,
        formlist: this.state.formlist.map(form => {
@@ -363,7 +330,7 @@
              </Form.Item>
            </Col>
          )
        } else if (item.key === 'fieldlength') {
        } else if (item.key === 'fieldlength' || item.key === 'maxfile') {
          fields.push(
            <Col span={12} key={index}>
              <Form.Item label={item.label}>