king
2021-04-07 f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2
src/menu/components/share/actioncomponent/index.jsx
@@ -1,11 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { Modal, notification, Button } from 'antd'
import Utils from '@/utils/utils.js'
import DevUtils from '@/utils/devutils.js'
import Utils, { FuncUtils } from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import { getActionForm } from './formconfig'
@@ -13,7 +11,7 @@
import MKEmitter from '@/utils/events.js'
import ActionForm from './actionform'
import MenuUtils from '@/menu/utils/menuUtils.js'
import MenuUtils from '@/utils/utils-custom.js'
import CreateFunc from '@/templates/zshare/createfunc'
import DragElement from './dragaction'
import './index.scss'
@@ -33,7 +31,7 @@
  }
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    card: null,          // 编辑中元素
    formlist: null,      // 表单信息
    actionlist: null,    // 按钮组
@@ -143,7 +141,7 @@
   * @description 按钮编辑,获取按钮表单信息
   */
  handleAction = (card) => {
    const { menu, config } = this.props
    const { config } = this.props
    let usefulFields = sessionStorage.getItem('permFuncField')
    if (usefulFields) {
@@ -172,7 +170,7 @@
      menulist = []
    }
    
    let modules = MenuUtils.getSubModules(menu.components, config.uuid)
    let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid)
    this.setState({
      visible: true,
@@ -334,7 +332,7 @@
   * @description 创建按钮存储过程
   */
  creatFunc = () => {
    const { menu } = this.props
    const menu = window.GLOB.customMenu
    let _config = fromJS(this.props.config).toJS()
    this.actionFormRef.handleConfirm().then(res => {
@@ -353,37 +351,28 @@
      }
      if (btn.OpenType === 'pop') {
        let fields = []
        if (btn.groups.length > 0) {
          btn.groups.forEach(group => {
            fields = [...fields, ...group.sublist]
          })
        } else {
          fields = btn.fields
        }
        let _param = {
          funcName: btn.innerFunc,
          name: _config.setting.tableName || '',
          fields: fields,
          fields: btn.fields,
          menuNo: menu.MenuNo
        }
        newLText = Utils.formatOptions(DevUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
        newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else if (btn.OpenType === 'excelIn') {
        let _param = {
          funcName: btn.innerFunc,
          menuNo: menu.MenuNo
        }
        newLText = Utils.formatOptions(DevUtils.getexcelInfunc(_param, btn, menu))
        DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
        newLText = Utils.formatOptions(FuncUtils.getexcelInfunc(_param, btn, menu))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else if (btn.OpenType === 'excelOut') {
        let _param = {
          innerFunc: btn.innerFunc
        }
        newLText = Utils.formatOptions(DevUtils.getTableFunc(_param, menu, _config)) // 创建存储过程sql
        DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
        newLText = Utils.formatOptions(FuncUtils.getTableFunc(_param, menu, _config)) // 创建存储过程sql
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      } else {
        let _param = {
          funcName: btn.innerFunc,
@@ -391,8 +380,8 @@
          fields: '',
          menuNo: menu.MenuNo
        }
        newLText = Utils.formatOptions(DevUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
        newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config))
        DelText = Utils.formatOptions(FuncUtils.dropfunc(btn.innerFunc))
      }
      this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText)
@@ -405,8 +394,12 @@
  btnDoubleClick = (element) => {
    if (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false') return
    
    if (element.OpenType === 'pop' || element.OpenType === 'popview') {
    if (element.OpenType === 'pop' || element.OpenType === 'popview' || element.execMode === 'pop') {
      this.props.setSubConfig(element)
    } else if (element.OpenType === 'innerpage' && element.pageTemplate === 'page') {
      MKEmitter.emit('changeEditMenu', {MenuID: element.uuid, copyMenuId: element.copyMenuId})
    } else if (element.OpenType === 'innerpage' && element.pageTemplate === 'linkpage') {
      MKEmitter.emit('changeEditMenu', {MenuID: element.linkmenu})
    } else {
      notification.warning({
        top: 92,
@@ -491,7 +484,6 @@
          visible={profVisible}
          width={'75vw'}
          maskClosable={false}
          style={{minWidth: '900px', maxWidth: '1200px'}}
          okText={dict['model.submit']}
          onOk={this.verifySubmit}
          onCancel={() => { this.setState({ profVisible: false }) }}
@@ -536,14 +528,4 @@
  }
}
const mapStateToProps = (state) => {
  return {
    menu: state.customMenu
  }
}
const mapDispatchToProps = () => {
  return {}
}
export default connect(mapStateToProps, mapDispatchToProps)(ActionComponent)
export default ActionComponent