king
2020-11-16 3ca91a731665962918a026f521c556f4745ebf35
src/templates/formtabconfig/actionform/index.jsx
@@ -38,10 +38,7 @@
      text: this.props.dict['header.form.refresh.never']
    }, {
      value: 'grid',
      text: this.props.dict['header.form.refresh.grid']
    }, {
      value: 'view',
      text: this.props.dict['header.form.refresh.view']
      text: this.props.dict['header.form.refresh']
    }],
    currentoptions: [{ // 不返回时-不刷新、刷新
      value: 'never',
@@ -56,8 +53,6 @@
  UNSAFE_componentWillMount () {
    const { card } = this.props
    let _intertype = ''
    let _success = 'close'
    let _error = 'notclose'
    this.props.formlist.forEach(form => {
      if (form.key === 'intertype') {
@@ -65,10 +60,6 @@
        if (card.btnType !== 'confirm') {
          form.options = form.options.filter(op => op.value !== 'system')
        }
      } else if (form.key === 'afterExecSuccess') {
        _success = form.initVal
      } else if (form.key === 'afterExecError') {
        _error = form.initVal
      }
    })
@@ -80,6 +71,8 @@
          item.options = btnClasses
        } else if (item.key === 'icon') {
          item.options = btnIcons
        } else if (item.key === 'resetPageIndex') {
          item.tooltip = '页面关闭,且执行刷新时生效'
        } else if (item.key === 'sqlType') {
          item.options = this.state.insertUpdateOptions
        } else if (item.key === 'OpenType') {
@@ -97,18 +90,9 @@
          }
        } else if (item.key === 'execSuccess' && card.btnType === 'cancel') {
          item.label = '关闭后'
        } else if (item.key === 'execSuccess' && card.btnType !== 'cancel') {
          if (_success === 'close') {
            item.options = this.state.returnoptions
          } else {
            item.options = this.state.currentoptions
          }
        } else if (item.key === 'execError') {
          if (_error === 'close') {
            item.options = this.state.returnoptions
          } else {
            item.options = this.state.currentoptions
          }
          item.options[1].text = '刷新'
        } else if (item.key === 'execSuccess' || item.key === 'execError') {
          item.options[1].text = '刷新'
        } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && _intertype === 'inner') {
          item.required = true
        }
@@ -136,62 +120,24 @@
    let _options = []
    if (btnType === 'cancel') {
      _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess']
      _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess', 'resetPageIndex']
    } else if (btnType === 'confirm') {
      if (intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex']
      } else if (intertype === 'system') {
        _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
        _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError', 'resetPageIndex']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex']
      }
    } else {
      if (intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex']
      }
    }
    return _options
  }
  selectChange = (key, value) => {
    if (key === 'afterExecSuccess') {
      this.setState({
        formlist: this.state.formlist.map(item => {
          if (item.key === 'execSuccess') {
            if (value === 'close') {
              item.options = this.state.returnoptions
            } else {
              item.options = this.state.currentoptions
            }
          }
          return item
        })
      })
      this.props.form.setFieldsValue({
        execSuccess: 'never'
      })
    } else if (key === 'afterExecError') {
      this.setState({
        formlist: this.state.formlist.map(item => {
          if (item.key === 'execError') {
            if (value === 'close') {
              item.options = this.state.returnoptions
            } else {
              item.options = this.state.currentoptions
            }
          }
          return item
        })
      })
      this.props.form.setFieldsValue({
        execError: 'never'
      })
    }
  }
  onChange = (e, key) => {
@@ -339,7 +285,6 @@
                  showSearch
                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  getPopupContainer={() => document.getElementById('winter')}
                  onChange={(val) => this.selectChange(item.key, val)}
                  disabled={!!item.readonly}
                >
                  {item.options.map((option, index) =>
@@ -355,7 +300,12 @@
      } else if (item.type === 'radio') {
        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: [