king
2022-08-08 176c6e1da22e96a1110fa91f8fc8eb8ad2881e08
src/templates/sharecomponent/actioncomponent/actionform/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader } from 'antd'
import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Typography } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { formRule } from '@/utils/option.js'
@@ -12,6 +12,7 @@
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const { TextArea } = Input
const { Paragraph } = Typography
const actionTypeOptions = {
  pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'],
  prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'],
@@ -148,18 +149,34 @@
      reOptions.intertype = this.state.interTypeOptions
      if (intertype === 'custom') {
        shows.push('procMode', 'interface', 'callbackType', 'cbTable', 'proInterface', 'method', 'cross')
        shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross')
        if (this.record.procMode === 'system') {
          shows.push('sql', 'sqlType')
        } else {
        } else if (this.record.procMode === 'inner') {
          reRequired.innerFunc = true
          shows.push('innerFunc')
        }
        if (this.record.callbackType === 'func') {
          shows.push('callbackFunc')
        } else if (this.record.callbackType !== 'none') {
          shows.push('cbTable')
        }
        reReadonly.interface = false
        reRequired.interface = true
      } else if (intertype === 'outer') {
        shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc', 'output')
        reRequired.innerFunc = false
        shows.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType', 'output')
        // reRequired.innerFunc = false
        if (this.record.procMode === 'system') {
          shows.push('sql', 'sqlType')
        } else if (this.record.procMode === 'inner') {
          reRequired.innerFunc = true
          shows.push('innerFunc')
        }
        if (this.record.callbackType === 'func') {
          shows.push('callbackFunc')
        } else if (this.record.callbackType !== 'none') {
          shows.push('cbTable')
        }
        if (this.record.sysInterface === 'false') {
          reReadonly.interface = false
@@ -197,6 +214,7 @@
      if (this.record.intertype === 'outer') {
        shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
        reRequired.innerFunc = false
        reRequired.callbackFunc = false
        if (this.record.sysInterface === 'false') {
          reReadonly.interface = false
@@ -259,6 +277,7 @@
        if (this.record.intertype === 'outer') {
          shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc')
          reRequired.innerFunc = false
          reRequired.callbackFunc = false
          if (this.record.sysInterface === 'false') {
            reReadonly.interface = false
@@ -275,6 +294,11 @@
        shows.push('refreshTab')
      } else if (_funcType === 'megvii') {
        shows.push('subFunc', 'progress')
      } else if (_funcType === 'filezip') {
        reOptions.Ot = requireOptions
        reRequired.innerFunc = false
        shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey')
      }
    }
@@ -336,7 +360,6 @@
      if (value === 'pop' || value === 'prompt' || value === 'exec') {
        _fieldval.intertype = 'system'
        _fieldval.sqlType = ''
      } else if (value === 'excelIn') {
        _fieldval.intertype = 'system'
        _fieldval.Ot = 'notRequired'
@@ -346,15 +369,15 @@
        this.record.Ot = 'notRequired'
        this.record.label = this.props.dict['model.form.excelIn']
        this.record.class = 'dgreen'
      } else if (value === 'excelOut') {
        _fieldval.intertype = 'system'
        _fieldval.label = this.props.dict['model.form.excelOut']
        _fieldval.class = 'dgreen'
        _fieldval.execSuccess = 'never'
        this.record.Ot = 'notRequired'
        this.record.label = this.props.dict['model.form.excelOut']
        this.record.class = 'dgreen'
        this.record.execSuccess = 'never'
  
      } else if (value === 'popview') {
        _fieldval.display = 'modal'
@@ -419,12 +442,14 @@
        _fieldval.class = 'purple'
      } else if (value === 'audit') {
        _fieldval.label = '审核'
        _fieldval.Ot = 'requiredSgl'
        _fieldval.Ot = 'required'
        _fieldval.class = 'primary'
      } else if (value === 'LogicDelete' || value === 'delete') {
        _fieldval.label = '删除'
        _fieldval.Ot = 'requiredSgl'
        _fieldval.Ot = 'required'
        _fieldval.class = 'danger'
      } else if (value === 'custom') {
        _fieldval.Ot = 'required'
      }
      if (this.record.position === 'grid') {
@@ -512,7 +537,7 @@
        ]
  
        if (item.key === 'innerFunc') {
          let str = '^(' + item.fields.join('|') + ')'
          let str = item.fields && item.fields.length ? '^(' + item.fields.join('|') + ')' : '^'
          let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
          rules.push(
            { pattern: _patten, message: formRule.func.innerMessage },
@@ -524,7 +549,7 @@
            { max: formRule.func.max, message: formRule.func.maxMessage }
          )
        } else if (item.key === 'output') {
          if (this.record.intertype === 'system') {
          if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) {
            rules = [{
              pattern: /^@[0-9a-zA-Z_]+@?$/,
              message: '变量以@符开头,可使用字母、数字以及_'
@@ -617,6 +642,16 @@
        </Col>
      )
    })
    if (window.debugger && this.props.card.uuid) {
      fields.push(
        <Col span={12} key="uuid">
          <Form.Item label="按钮ID">
            <Paragraph copyable>{this.props.card.uuid}</Paragraph>
          </Form.Item>
        </Col>
      )
    }
    return fields
  }