From f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 07 四月 2021 23:25:29 +0800 Subject: [PATCH] 2021-04-07 --- src/menu/popview/index.jsx | 71 +++++++++++------------------------ 1 files changed, 22 insertions(+), 49 deletions(-) diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index 18d2fb6..59da6e1 100644 --- a/src/menu/popview/index.jsx +++ b/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锛屾寜閽笅鐨勬寜閽畉ype涓�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) \ No newline at end of file +export default MenuDesign \ No newline at end of file -- Gitblit v1.8.0