king
2020-01-03 862b6cf69dc925a6138a7ebf79b782a5d7791202
src/templates/comtableconfig/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 Utils from '@/utils/utils.js'
import './index.scss'
@@ -18,7 +18,6 @@
  state = {
    formlist: null,  // 表单信息
    openType: null,  // 打开方式
    errorType: 'E',  // 报错类型
    interType: null, // 接口类型:内部、外部
    position: null,  // 按钮位置
    reqOptionSgl: [{
@@ -72,7 +71,6 @@
    let _opentype = ''
    let _intertype = ''
    let _position = ''
    let _errorType = ''
    let _tabType = ''
    let _linkTab = ''
    let _options = null
@@ -84,8 +82,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') {
@@ -112,16 +108,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
@@ -192,9 +187,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']
        }
      }
      this.setState({
@@ -271,10 +266,6 @@
          })
        })
      })
    } else if (key === 'errorTip') {
      this.setState({
        errorType: value
      })
    } else if (key === 'tabType') {
      let _tabs = this.props.tabs.filter(tab => tab.type === value)
@@ -315,9 +306,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 => {
@@ -325,37 +313,6 @@
          return item
        })
      })
    }
  }
  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('执行失败!')
    }
  }
@@ -417,7 +374,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" />
@@ -447,7 +404,6 @@
                </Select>
              )}
            </Form.Item>
            {item.key === 'errorTip' ? <Button onClick={this.showError}>查看</Button> : null}
          </Col>
        )
      } else if (item.type === 'radio') {