From 76a4300654a18d228838c3f27455dc8e7a8cd616 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 一月 2021 17:04:42 +0800 Subject: [PATCH] Merge branch 'master' into bms --- src/templates/menuconfig/editthdmenu/index.jsx | 114 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 89 insertions(+), 25 deletions(-) diff --git a/src/templates/menuconfig/editthdmenu/index.jsx b/src/templates/menuconfig/editthdmenu/index.jsx index 11d4b2b..1dc074d 100644 --- a/src/templates/menuconfig/editthdmenu/index.jsx +++ b/src/templates/menuconfig/editthdmenu/index.jsx @@ -21,6 +21,7 @@ import MenuForm from './menuform' import TransferForm from '@/templates/zshare/basetransferform' import Utils from '@/utils/utils.js' +import MenuUtils from '@/menu/utils/menuUtils.js' import DragElement from '../menuelement' import asyncLoadComponent from '@/utils/asyncLoadComponent' import './index.scss' @@ -627,9 +628,7 @@ OpenType: 'newtab' } - if (sysMenu.OriginMenuId && sysMenu.Template === 'CustomPage') { - PageParam.originMenuId = sysMenu.OriginMenuId - } else if (sysMenu.Template === 'NewPage') { + if (sysMenu.Template === 'NewPage') { PageParam.OpenType = 'NewPage' PageParam.url = res.url } @@ -660,31 +659,95 @@ confirmLoading: true }) - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - sysTemplates: sysTemplates, - confirmLoading: false, - handleMVisible: false, - sysMenu: '', - tabview: '' - }) - - this.props.reload() - } else { - this.setState({ - confirmLoading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) + if (sysMenu.Template === 'CustomPage' && sysMenu.OriginMenuId) { + this.copyMenu(param, sysMenu.OriginMenuId) + } else { + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + sysTemplates: sysTemplates, + confirmLoading: false, + handleMVisible: false, + sysMenu: '', + tabview: '' + }) + + this.props.reload() + } else { + this.setState({ + confirmLoading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) + } + }) + } }) } + copyMenu = (param, MenuId) => { + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: MenuId + }).then(result => { + if (result.status) { + let config = null + + try { + config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + config = null + } + + if (config) { + config.uuid = param.MenuID + config.MenuID = param.MenuID + config.parentId = param.ParentID + config.MenuName = param.MenuName + config.MenuNo = param.MenuNo + config.easyCode = '' + config.components = MenuUtils.resetConfig(config.components) + + param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) + } + + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + confirmLoading: false, + handleMVisible: false, + sysMenu: '', + tabview: '' + }) + + this.props.reload() + } else { + this.setState({ + confirmLoading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 5 + }) + } + }) + } else { + this.setState({ + confirmLoading: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } UNSAFE_componentWillMount () { this.getUsedTemplate() @@ -883,6 +946,7 @@ <MenuForm menu={this.state.sysMenu} dict={dict} + inputSubmit={this.memuSubmit} wrappedComponentRef={(inst) => this.menuFormRef = inst} /> </Modal> -- Gitblit v1.8.0