king
2020-01-03 862b6cf69dc925a6138a7ebf79b782a5d7791202
src/templates/subtableconfig/actionform/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Button, Modal, message } from 'antd'
import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd'
import { btnIcons, btnClasses } from '@/utils/option.js'
import './index.scss'
@@ -17,7 +17,6 @@
  state = {
    formlist: null,
    openType: null,
    errorType: 'E',
    interType: null,
    position: null,
    reqOptionSgl: [{
@@ -64,7 +63,6 @@
    let _opentype = ''
    let _intertype = ''
    let _position = ''
    let _errorType = ''
    let _tabType = ''
    let _linkTab = ''
    let _options = null
@@ -76,8 +74,6 @@
        _intertype = form.initVal
      } else if (form.key === 'position') {
        _position = form.initVal
      } else if (form.key === 'errorTip') {
        _errorType = form.initVal
      } else if (form.key === 'tabType') {
        _tabType = form.initVal
      } else if (form.key === 'linkTab') {
@@ -98,16 +94,15 @@
      }
    } else {
      if (_intertype === 'outer') {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'method']
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method']
      } else {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType']
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
      }
    }
    this.setState({
      openType: _opentype,
      interType: _intertype,
      position: _position,
      errorType: _errorType,
      formlist: this.props.formlist.map(item => {
        if (item.key === 'class') {
          item.options = btnClasses
@@ -167,9 +162,9 @@
        }
      } else {
        if (this.state.interType === 'inner') {
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'sql', 'sqlType']
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
        } else {
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'errorTip', 'errorTime', 'interface', 'outerFunc', 'callbackFunc', 'method']
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method']
        }
      }
      
@@ -242,10 +237,6 @@
          })
        })
      })
    } else if (key === 'errorTip') {
      this.setState({
        errorType: value
      })
    } else if (key === 'tabType') {
      let _tabs = this.props.tabs.filter(tab => tab.type === value)
@@ -286,9 +277,6 @@
      } else {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method']
      }
      if (['pop', 'prompt', 'exec'].includes(this.state.openType)) {
        _options.push('errorTip', 'errorTime')
      }
      this.setState({
        interType: value,
        formlist: this.state.formlist.map(item => {
@@ -299,36 +287,36 @@
    }
  }
  showError = () => {
    const { errorType } = this.state
  // showError = () => {
  //   const { errorType } = this.state
    if (errorType === 'S') {
      notification.success({
        top: 92,
        message: '执行成功!',
        duration: 2
      })
    } else if (errorType === 'F') {
      notification.error({
        className: 'notification-custom-error',
        top: 92,
        message: '执行失败!',
        duration: 15
      })
    } else if (errorType === 'N') {
      notification.error({
        top: 92,
        message: '执行失败!',
        duration: 15
      })
    } else if (errorType === 'E') {
      Modal.error({
        title: '执行失败!'
      })
    } else if (errorType === 'NM') {
      message.error('执行失败!')
    }
  }
  //   if (errorType === 'S') {
  //     notification.success({
  //       top: 92,
  //       message: '执行成功!',
  //       duration: 2
  //     })
  //   } else if (errorType === 'F') {
  //     notification.error({
  //       className: 'notification-custom-error',
  //       top: 92,
  //       message: '执行失败!',
  //       duration: 15
  //     })
  //   } else if (errorType === 'N') {
  //     notification.error({
  //       top: 92,
  //       message: '执行失败!',
  //       duration: 15
  //     })
  //   } else if (errorType === 'E') {
  //     Modal.error({
  //       title: '执行失败!'
  //     })
  //   } else if (errorType === 'NM') {
  //     message.error('执行失败!')
  //   }
  // }
  getFields() {
    const { getFieldDecorator } = this.props.form
@@ -387,7 +375,7 @@
        )
      } else if (item.type === 'select') { // 下拉搜索
        fields.push(
          <Col span={12} key={index} className={item.key === 'errorTip' ? 'with-button' : ''}>
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
@@ -417,7 +405,6 @@
                </Select>
              )}
            </Form.Item>
            {item.key === 'errorTip' ? <Button onClick={this.showError}>查看</Button> : null}
          </Col>
        )
      } else if (item.type === 'radio') {