king
2021-11-18 c98e45bfac25e9110ad0383faac54a54d98ea9d5
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { btnCustomClasses, formRule } from '@/utils/option.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -37,6 +38,7 @@
    interType: null, // 接口类型:内部、外部
    funcType: null,  // 功能类型
    procMode: null,  // 参数方式
    control: '',
    pageTemplate: null,
    appType: sessionStorage.getItem('appType'),
    Ot: null,
@@ -98,11 +100,13 @@
    let _procMode = card.procMode || 'system'
    let _Ot = card.Ot || 'requiredSgl'
    let _pageTemplate = card.pageTemplate || ''
    let control = card.control || ''
    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot)
    let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, control)
    this.setState({
      Ot: _Ot,
      control: control,
      openType: _opentype,
      interType: _intertype,
      procMode: _procMode,
@@ -156,7 +160,7 @@
    })
  }
  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => {
  getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot, _control) => {
    let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 选项列表
    if (_opentype === 'innerpage') {         // 新页面,可选模板(自定义时,可填入外部链接)
@@ -181,7 +185,7 @@
      }
    } else if (_opentype === 'funcbutton') {
      if (_funcType === 'print') {
        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex', 'controlField', 'controlVal')
        _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex')
        if (_intertype === 'outer') {
          _options.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
        } else if (_intertype === 'inner') {
@@ -214,8 +218,11 @@
      }
    }
    if (_Ot !== 'notRequired' && _opentype !== 'excelOut' && _opentype !== 'funcbutton') {
      _options.push('controlField', 'controlVal')
    if (_Ot !== 'notRequired' && _opentype !== 'excelOut') {
      _options.push('control')
      if (_control) {
        _options.push('controlField', 'controlVal')
      }
    }
    if (_Ot === 'requiredSgl' && ['pop', 'prompt', 'exec'].includes(_opentype)) {
      _options.push('swipe')
@@ -245,10 +252,10 @@
   */
  optionChange = (key, value) => {
    const { card, type } = this.props
    const { openType, procMode, Ot, pageTemplate } = this.state
    const { openType, procMode, Ot, pageTemplate, control } = this.state
    if (key === 'OpenType') {
      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot)
      let _options = this.getOptions(value, 'system', this.state.funcType, '', 'system', Ot, control)
      let _fieldval = {}
      let _formlist = this.state.formlist.map(item => {
@@ -257,12 +264,16 @@
        if (item.key === 'intertype') {
          let iscustom = ['pop', 'prompt', 'exec'].includes(value)
          item.options = this.state.interTypeOptions.filter(op => (iscustom || op.value !== 'custom'))
        } else if (item.key === 'control') {
          item.initVal = control
        }
        if (item.hidden) return item
        if (item.key === 'intertype') {
          _fieldval.intertype = 'system'
        } else if (item.key === 'popClose' && value === 'popview') {
          _fieldval.popClose = 'grid'
        } else if (item.key === 'Ot') {
          if (type === 'card') {
            item.options = this.state.requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value))
@@ -315,7 +326,7 @@
        this.props.form.setFieldsValue(_fieldval)
      })
    } else if (key === 'funcType') {
      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot)
      let _options = this.getOptions(openType, this.state.interType, value, pageTemplate, procMode, Ot, control)
      let _fieldval = {}
      if (value === 'print') {
@@ -398,7 +409,7 @@
      })
    } else if (key === 'pageTemplate') {
      let _fieldval = {}
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot)
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot, control)
      this.setState({
        pageTemplate: value,
@@ -422,7 +433,7 @@
        this.props.form.setFieldsValue(_fieldval)
      })
    } else if (key === 'intertype') {
      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot)
      let _options = this.getOptions(openType, value, this.state.funcType, pageTemplate, procMode, Ot, control)
      this.setState({
        interType: value,
@@ -444,7 +455,7 @@
        })
      })
    } else if (key === 'procMode') {
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot)
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, value, Ot, control)
      this.setState({
        procMode: value,
@@ -458,10 +469,20 @@
        })
      })
    } else if (key === 'Ot') {
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value)
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, value, control)
      this.setState({
        Ot: value,
        formlist: this.state.formlist.map(item => {
          item.hidden = !_options.includes(item.key)
          return item
        })
      })
    } else if (key === 'control') {
      let _options = this.getOptions(openType, this.state.interType, this.state.funcType, pageTemplate, procMode, Ot, value)
      this.setState({
        control: value,
        formlist: this.state.formlist.map(item => {
          item.hidden = !_options.includes(item.key)
          return item
@@ -532,7 +553,7 @@
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -562,7 +583,7 @@
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -583,7 +604,7 @@
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -618,7 +639,7 @@
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -665,7 +686,7 @@
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>