From 5232d34f026f72eb90a5ba6fff33d30cf9d961aa Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 25 十二月 2020 19:11:07 +0800 Subject: [PATCH] 2020-12-25 --- src/menu/popview/index.jsx | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index eb19d48..f940083 100644 --- a/src/menu/popview/index.jsx +++ b/src/menu/popview/index.jsx @@ -11,6 +11,7 @@ import Utils from '@/utils/utils.js' import zhCN from '@/locales/zh-CN/mob.js' import enUS from '@/locales/en-US/mob.js' +import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import { modifyCustomMenu } from '@/store/action' @@ -58,6 +59,10 @@ }) } + componentDidMount () { + MKEmitter.addListener('delButtons', this.delButtons) + } + shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -69,6 +74,11 @@ this.setState = () => { return } + MKEmitter.removeListener('delButtons', this.delButtons) + } + + delButtons = (items) => { + this.setState({delButtons: [...this.state.delButtons, ...items]}) } closeView = () => { @@ -98,7 +108,8 @@ } getMenuParam = () => { - const { MenuId, MenuType } = this.state + const { btn } = this.props + const { MenuId } = this.state let param = { func: 'sPC_Get_LongParam', @@ -123,18 +134,19 @@ MenuID: MenuId, Template: 'CustomPage', enabled: false, + MenuName: btn.config.MenuName + '-' + btn.label, + MenuNo: '', tables: [], components: [], + viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px' }, - MenuType: MenuType } } else { config.uuid = MenuId config.MenuID = MenuId - config.MenuType = config.MenuType || MenuType } this.setState({ @@ -225,11 +237,10 @@ } submitConfig = () => { - // const { btn } = this.props const { openEdition, delButtons } = this.state let config = fromJS(this.state.config).toJS() - if (config.cacheUseful === 'true' && !config.cacheTime) { + if ((config.cacheUseful === 'true' && !config.cacheTime) || !config.MenuNo || !config.MenuName) { notification.warning({ top: 92, message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', @@ -250,9 +261,9 @@ let param = { func: 'sPC_Tab_AddUpt', MenuID: _config.uuid, - MenuNo: _config.tabNo, + MenuNo: _config.MenuNo, Template: 'CustomPage', - MenuName: _config.tabName, + MenuName: _config.MenuName, Remark: '', Sort: 0, PageParam: JSON.stringify({Template: 'CustomPage'}), @@ -265,7 +276,7 @@ let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 func: 'sPC_Button_AddUpt', - Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + Type: 60, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 ParentID: _config.uuid, MenuNo: _config.MenuNo, Template: 'CustomPage', -- Gitblit v1.8.0