king
2021-04-07 f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2
src/menu/popview/index.jsx
@@ -1,6 +1,5 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { DndProvider } from 'react-dnd'
import { is, fromJS } from 'immutable'
import moment from 'moment'
@@ -13,7 +12,6 @@
import enUS from '@/locales/en-US/mob.js'
import MKEmitter from '@/utils/events.js'
import asyncComponent from '@/utils/asyncComponent'
import { modifyCustomMenu } from '@/store/action'
import './index.scss'
@@ -38,16 +36,14 @@
  }
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    MenuType: '',
    MenuId: '',
    MenuNo: '',
    tableFields: [],
    delButtons: [],
    activeKey: 'basedata',
    menuloading: false,
    oriConfig: null,
    openEdition: '',
    config: null,
    customComponents: []
  }
@@ -153,11 +149,9 @@
      return
    }
    let _config = fromJS(config).toJS()
    delete _config.tableFields
    const _this = this
    if (!is(fromJS(oriConfig), fromJS(_config))) {
    if (!is(fromJS(oriConfig), fromJS(config))) {
      confirm({
        title: '配置已修改,放弃保存吗?',
        content: '',
@@ -214,13 +208,14 @@
          config.Template = 'CustomPage'
        }
        config.open_edition = result.open_edition || ''
        this.setState({
          oriConfig: config,
          config: fromJS(config).toJS(),
          openEdition: result.open_edition || '',
          config: fromJS(config).toJS()
        })
        this.props.modifyCustomMenu(config)
        window.GLOB.customMenu = config
      } else {
        notification.warning({
          top: 92,
@@ -332,7 +327,7 @@
  submitConfig = () => {
    const { btn } = this.props
    const { openEdition, delButtons } = this.state
    const { delButtons } = this.state
    let config = fromJS(this.state.config).toJS()
    if ((config.cacheUseful === 'true' && !config.cacheTime) || !config.MenuNo || !config.MenuName) {
@@ -355,31 +350,25 @@
        config.enabled = false
      }
      let _config = fromJS(config).toJS()
      delete _config.tableFields
      let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label
      let param = {
        func: 'sPC_ButtonParam_AddUpt',
        ParentID: btn.config.uuid,
        MenuID: _config.uuid,
        MenuNo: _config.MenuNo || '',
        MenuID: config.uuid,
        MenuNo: config.MenuNo || '',
        Template: 'CustomPage',
        MenuName: _name,
        PageParam: JSON.stringify({Template: 'CustomPage'}),
        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
      }
      if (openEdition) { // 版本管理
        param.open_edition = openEdition
        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))),
        open_edition: config.open_edition
      }
      let btnParam = {             // 添加菜单按钮
        func: 'sPC_Button_AddUpt',
        Type: 60,                  // 添加菜单下的按钮type为40,按钮下的按钮type为60
        ParentID: _config.uuid,
        MenuNo: _config.MenuNo,
        ParentID: config.uuid,
        MenuNo: config.MenuNo,
        Template: 'CustomPage',
        PageParam: '',
        LongParam: '',
@@ -427,9 +416,10 @@
        if (!res) return
        if (res.status) {
          config.open_edition = res.open_edition || ''
          this.setState({
            oriConfig: fromJS(_config).toJS(),
            openEdition: res.open_edition || ''
            oriConfig: fromJS(config).toJS()
          })
          if (btnParam.LText) {
@@ -534,23 +524,16 @@
      config: config
    })
    this.props.modifyCustomMenu(config)
    window.GLOB.customMenu = config
  }
  /**
   * @description 更新常用表信息,快捷添加后更新配置信息
   */
  updatetable = (config, fields) => {
    const { tableFields } = this.state
  updatetable = (config) => {
    this.setState({ config })
    config.tableFields = fields ? fields : tableFields
    this.setState({
      tableFields: fields ? fields : tableFields,
      config
    })
    this.props.modifyCustomMenu(config)
    window.GLOB.customMenu = config
  }
  insert = (item) => {
@@ -559,7 +542,7 @@
    config.components.push(item)
    this.setState({config})
    this.props.modifyCustomMenu(config)
    window.GLOB.customMenu = config
  }
  render () {
@@ -614,14 +597,4 @@
  }
}
const mapStateToProps = () => {
  return {}
}
const mapDispatchToProps = (dispatch) => {
  return {
    modifyCustomMenu: (customMenu) => dispatch(modifyCustomMenu(customMenu))
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(MenuDesign)
export default MenuDesign