king
2020-10-23 407c0f1765c7d085218a91ad8842784977383d05
src/templates/formtabconfig/actionform/index.jsx
@@ -22,7 +22,7 @@
    interType: null, // 接口类型:内部、外部
    insertUpdateOptions: [{
      value: '',
      text: this.props.dict['header.form.empty']
      text: this.props.dict['model.empty']
    }, {
      value: 'insert',
      text: this.props.dict['header.form.action.insert']
@@ -56,13 +56,15 @@
  UNSAFE_componentWillMount () {
    const { card } = this.props
    let _intertype = ''
    let _options = null
    let _success = 'close'
    let _error = 'notclose'
    this.props.formlist.forEach(form => {
      if (form.key === 'intertype') {
        _intertype = form.initVal
        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') {
@@ -70,21 +72,7 @@
      }
    })
    if (card.btnType === 'cancel') {
      _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess']
    } else if (card.btnType === 'confirm') {
      if (_intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
      }
    } else {
      if (_intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      }
    }
    let _options = this.getOptions(card.btnType, _intertype)
    this.setState({
      formlist: this.props.formlist.map(item => {
@@ -98,10 +86,10 @@
          item.options = [
            {
              value: 'prompt',
              text: this.props.dict['header.form.prompt']
              text: this.props.dict['model.form.prompt']
            }, {
              value: 'exec',
              text: this.props.dict['header.form.exec']
              text: this.props.dict['model.form.exec']
            }
          ]
          if (card.btnType === 'cancel') {
@@ -142,6 +130,30 @@
        console.warn('表单focus失败!')
      }
    }
  }
  getOptions = (btnType, intertype) => {
    let _options = []
    if (btnType === 'cancel') {
      _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess']
    } else if (btnType === 'confirm') {
      if (intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      } else if (intertype === 'system') {
        _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      }
    } else {
      if (intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
      }
    }
    return _options
  }
  selectChange = (key, value) => {
@@ -188,21 +200,7 @@
    let value = e.target.value
    if (key === 'intertype') {
      let _options = null
      if (card.btnType === 'confirm') {
        if (value === 'outer') {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        } else {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError']
        }
      } else {
        if (value === 'outer') {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        } else {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError']
        }
      }
      let _options = this.getOptions(card.btnType, value)
      this.setState({
        interType: value,
@@ -213,9 +211,9 @@
            item.readonly = false
          } else if (item.key === 'sysInterface') {
            item.initVal = 'false'
          } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'inner') {
          } else if (item.key === 'innerFunc' && value === 'inner') {
            item.required = true
          } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'outer') {
          } else if (item.key === 'innerFunc' && value === 'outer') {
            item.required = false
          }
@@ -408,14 +406,14 @@
          if (values.innerFunc === '' && values.sql === '') {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.actionhelp.tablename'],
              duration: 10
              message: '使用系统函数时,请填写表名,使用自定义函数时,可忽略。',
              duration: 5
            })
          } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.actionhelp.sqlType'],
              duration: 10
              message: '使用系统函数时,请选择操作类型,使用自定义函数时,可忽略。',
              duration: 5
            })
          } else {
            resolve(values)