king
2023-08-27 d340a56429b12c3c893762730638631e147e047c
src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -1,16 +1,16 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Checkbox, Typography } from 'antd'
import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Checkbox } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { formRule } from '@/utils/option.js'
import asyncComponent from '@/utils/asyncComponent'
import KeyInterface from '@/components/keyInterface'
import MkPrintTemps from './mkPrintTemps'
import './index.scss'
const { TextArea } = Input
const { Paragraph } = Typography
const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable'))
const acTyOptions = {
@@ -166,7 +166,7 @@
      reOptions.intertype = this.state.interTypeOptions
      if (intertype === 'custom') {
        shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify')
        shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify', 'ContentType', 'outerBlacklist')
        if (this.record.procMode === 'system') {
          shows.push('sql', 'sqlType')
        } else if (this.record.procMode === 'inner') {
@@ -174,14 +174,16 @@
          shows.push('innerFunc')
        }
        if (this.record.callbackType === 'func') {
          shows.push('callbackFunc')
          shows.push('callbackFunc', 'output')
        } else if (this.record.callbackType === 'script') {
          shows.push('cbTable', 'output')
        } else if (this.record.callbackType !== 'none') {
          shows.push('cbTable')
        }
        reReadonly.interface = false
        reRequired.interface = true
      } else if (intertype === 'outer') {
        shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType', 'output')
        shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType')
        if (this.record.procMode === 'system') {
          shows.push('sql', 'sqlType')
        } else if (this.record.procMode === 'inner') {
@@ -189,7 +191,9 @@
          shows.push('innerFunc')
        }
        if (this.record.callbackType === 'func') {
          shows.push('callbackFunc')
          shows.push('callbackFunc', 'output')
        } else if (this.record.callbackType === 'script') {
          shows.push('cbTable', 'output')
        } else if (this.record.callbackType !== 'none') {
          shows.push('cbTable')
        }
@@ -210,7 +214,7 @@
          shows.push('exInterface', 'exProInterface')
        }
      } else if (intertype === 'inner') {
        shows.push('innerFunc', 'output')
        shows.push('innerFunc', 'output', 'recordUser')
        if (Ot === 'requiredOnce') { // 前置函数
          shows.push('preFunc')
        }
@@ -291,7 +295,7 @@
          shows.push('exInterface', 'exProInterface')
        }
      } else if (intertype === 'inner') {
        shows.push('innerFunc')
        shows.push('innerFunc', 'recordUser')
        reRequired.innerFunc = true
      } else {
        shows.push('sql', 'sqlType')
@@ -342,7 +346,7 @@
          shows.push('exInterface', 'exProInterface')
        }
      } else if (this.record.intertype === 'inner') {
        shows.push('innerFunc')
        shows.push('innerFunc', 'recordUser')
        reRequired.innerFunc = true
      }
      if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') {
@@ -350,7 +354,12 @@
      }
    } else if (openType === 'excelOut') {
      reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom')
      reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value))
      if (appType === 'mob') {
        reOptions.Ot = requireOptions.filter(op => ['notRequired'].includes(op.value))
      } else {
        reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredOnce'].includes(op.value))
      }
      if (this.record.intertype === 'outer') {
        shows.push('innerFunc', 'sysInterface', 'outerFunc')
@@ -372,13 +381,15 @@
          shows.push('exInterface', 'exProInterface')
        }
      } else if (this.record.intertype === 'inner') {
        shows.push('innerFunc')
        shows.push('innerFunc', 'recordUser')
        reRequired.innerFunc = true
      }
      if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') {
        shows.push('resetPageIndex')
      }
      if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') {
      if (this.record.Ot !== 'notRequired' && appType === 'mob') {
        this.record.Ot = 'notRequired'
      } else if (this.record.Ot !== 'notRequired' && this.record.Ot !== 'requiredOnce') {
        this.record.Ot = 'notRequired'
      }
    } else if (openType === 'popview') {
@@ -448,7 +459,7 @@
            shows.push('exInterface', 'exProInterface')
          }
        } else if (this.record.intertype === 'inner') {
          shows.push('innerFunc')
          shows.push('innerFunc', 'recordUser')
          reRequired.innerFunc = true
        }
        if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') {
@@ -498,7 +509,7 @@
    }
    
    if (appType === 'mob') {
      if (Ot !== 'notRequired' && openType !== 'excelOut') {
      if (openType !== 'excelOut') {
        shows.push('control')
        reOptions.control = [
          { value: '', text: '无' },
@@ -513,7 +524,7 @@
        }
      }
    } else {
      if (Ot !== 'notRequired' && openType !== 'excelOut') {
      if (openType !== 'excelOut') {
        reOptions.control = [
          { value: '', text: '无' },
          { value: 'disabled', text: '禁用' },
@@ -800,6 +811,10 @@
            { pattern: formRule.func.pattern, message: formRule.func.message },
            { max: formRule.func.max, message: formRule.func.maxMessage }
          )
        } else if (item.key === 'outerBlacklist') {
          rules.push(
            { max: 512, message: '最多512个字符' }
          )
        } else if (item.key === 'output') {
          if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) {
            rules = [{
@@ -916,6 +931,12 @@
        }
        content = <TextArea rows={2} readOnly={item.readonly}/>
      } else if (item.type === 'printTemps') {
        rules = [
          { required: item.required, message: '请选择' + item.label + '!' }
        ]
        content = <MkPrintTemps />
      } else if (item.type === 'keyinterface') {
        span = 24
        className = 'textarea'
@@ -929,7 +950,7 @@
      fields.push(
        <Col span={span} key={index}>
          <Form.Item className={className} help={item.help} label={item.tooltip ?
            <Tooltip placement="topLeft" title={item.tooltip}>
            <Tooltip placement="topLeft" overlayStyle={{maxWidth: item.tooltip.length > 25 ? 350 : 250 }} title={<span onClick={(e) => e.stopPropagation()}>{item.tooltip}</span>}>
              <QuestionCircleOutlined className="mk-form-tip" />
              {item.label}
            </Tooltip> : item.label
@@ -942,16 +963,6 @@
        </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
  }
@@ -969,11 +980,12 @@
          values.$fixed = card.$fixed || false
          if (card.OpenType === 'excelOut' && values.OpenType === 'excelIn') {
            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
              values.verify.columns = values.verify.columns.map(col => {
            values.verify = {columns: [], scripts: [], sheet: 'Sheet1', default: 'true', range: 1, uniques: []}
            if (card.verify && card.verify.columns) {
              values.verify.columns = card.verify.columns.map(col => {
                col.required = col.required || 'true'
                col.type = col.type || 'Nvarchar(50)'
                col.import = col.import || 'true'
                col.import = 'true'
          
                if (col.type === 'text' || col.type === 'image') {
                  col.type = 'Nvarchar(50)'
@@ -996,11 +1008,12 @@
                return col
              })
              values.verify.sheet = values.verify.sheet || 'Sheet1'
              values.verify.sheet = card.verify.sheet || 'Sheet1'
            }
          } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') {
            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
              values.verify.columns = values.verify.columns.map(col => {
            values.verify = {columns: [], scripts: [], dataType: 'default'}
            if (card.verify && card.verify.columns) {
              values.verify.columns = card.verify.columns.map(col => {
                col.type = col.type || 'text'
                col.output = col.output || 'true'
                col.required = col.required || 'false'
@@ -1065,6 +1078,10 @@
              })
            }
          }
          if (values.outerBlacklist) {
            values.outerBlacklist = values.outerBlacklist.replace(/\s/ig, '')
          }
          if (values.openmenu && Array.isArray(values.openmenu) && values.openmenu.length > 0) {
            let list = null