From 783ab4e467c95e26f7f031151507bd7ad8333a63 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 08 九月 2023 17:34:47 +0800 Subject: [PATCH] 2023-09-08 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 24 ++-- src/tabviews/custom/components/module/account/index.jsx | 24 +--- src/components/header/index.jsx | 9 + src/tabviews/custom/components/card/double-data-card/index.jsx | 22 ++-- src/tabviews/custom/components/chart/antv-G6/index.jsx | 24 ++-- src/tabviews/custom/components/card/cardItem/index.jsx | 35 ++---- src/views/mkiframe/index.jsx | 4 src/tabviews/custom/components/carousel/data-card/index.jsx | 2 src/tabviews/custom/popview/index.jsx | 2 src/tabviews/basetable/index.jsx | 2 src/tabviews/custom/components/calendar/board/index.jsx | 20 +-- src/tabviews/home/index.jsx | 2 src/tabviews/custom/components/form/simple-form/index.jsx | 2 src/tabviews/subtable/index.jsx | 2 src/tabviews/commontable/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 20 ++-- src/index.js | 2 src/tabviews/custom/components/form/tab-form/index.jsx | 2 src/tabviews/custom/components/card/table-card/index.jsx | 27 +--- src/tabviews/zshare/actionList/tabbutton/index.jsx | 17 +-- src/tabviews/custom/components/chart/antv-pie/index.jsx | 11 - src/tabviews/custom/components/chart/antv-X6/index.jsx | 17 ++- src/tabviews/custom/components/carousel/prop-card/index.jsx | 3 src/tabviews/custom/components/form/step-form/index.jsx | 2 src/tabviews/custom/index.jsx | 2 src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx | 8 - 26 files changed, 125 insertions(+), 162 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 4ad3d8a..069be85 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -60,7 +60,7 @@ if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { - localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) + localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: this.state.thdMenuList, mkActions: window.GLOB.mkActions})) } else if (e.key === 'menuUpdate') { let vals = e.newValue.split(',') let menuId = vals[1] @@ -180,7 +180,12 @@ } window.GLOB.mainMenu = mainMenu - window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}] + + thdMenuList.forEach(item => { + window.GLOB.mkThdMenus.set(item.MenuID, item) + }) + + window.GLOB.mkThdMenus.set('home_page_id', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}) MKEmitter.emit('mainMenuChange') diff --git a/src/index.js b/src/index.js index addc05c..2e62f85 100644 --- a/src/index.js +++ b/src/index.js @@ -241,7 +241,6 @@ let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') sessionStorage.setItem('lang', lang) - GLOB.mkThdMenus = [] // 涓夌骇鑿滃崟 GLOB.mkActions = {} // 鎸夐挳鏉冮檺闆� Object.defineProperty(GLOB, 'appId', { @@ -309,6 +308,7 @@ window.GLOB.CacheData = new Map() // 瀛樺偍閫変腑鏁版嵁 window.GLOB.SearchBox = new Map() // 瀛樺偍鎼滅储鏉′欢 window.GLOB.SyncData = new Map() // 瀛樺偍鍚屾鏌ヨ鏁版嵁 + window.GLOB.mkThdMenus = new Map() // 涓夌骇鑿滃崟 render(Route) }) diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index e6b4a31..b66f32f 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -416,7 +416,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index b688628..865ed68 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -349,7 +349,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/custom/components/calendar/board/index.jsx b/src/tabviews/custom/components/calendar/board/index.jsx index 77727e6..fddbe03 100644 --- a/src/tabviews/custom/components/calendar/board/index.jsx +++ b/src/tabviews/custom/components/calendar/board/index.jsx @@ -493,31 +493,29 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (config.wrap.click === 'menu') { - let menuId = config.wrap.MenuID || config.wrap.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = config.wrap.menu.slice(-1)[0] + let menu = null - if (!menu && config.wrap.MenuName && config.wrap.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (config.wrap.MenuID) { menu = { - MenuID: menuId, + MenuID: config.wrap.MenuID, MenuName: config.wrap.MenuName, - MenuNo: config.wrap.MenuNo || '', type: config.wrap.tabType } } if (!menu) return - let newtab = { - ...menu, - param: {$BID: data.$$uuid || ''} - } + menu.param = {$BID: data.$$uuid || ''} Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } } diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index d7d8a72..b601bc9 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -1,7 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' @@ -15,8 +14,6 @@ card: PropTypes.object, // 鍗$墖閰嶇疆淇℃伅 data: PropTypes.object, } - - state = {} shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.data), fromJS(nextProps.data)) @@ -55,7 +52,6 @@ let newtab = { MenuID: menu.MenuID, MenuName: menu.MenuName, - MenuNo: menu.MenuNo || '', type: menu.tabType, param: {} } @@ -72,43 +68,34 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (card.setting.click === 'menu') { - let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = card.setting.menu.slice(-1)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { - MenuID: menuId, + MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return if (key === 'children') return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else if (card.setting.click === 'link') { let src = card.setting.linkurl diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 53048cb..d803a09 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -1033,36 +1033,34 @@ if (subcard.setting.click || card.setting.position !== 'inner' || card.setting.click !== 'menu') return - let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = card.setting.menu.slice(-1)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { - MenuID: menuId, + MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = item.$$uuid || '' + menu.param.$BID = item.$$uuid || '' Object.keys(item).forEach(key => { if (/^\$/.test(key)) return if (key === 'children') return - newtab.param[key] = item[key] + menu.param[key] = item[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } onDoubleClick = (i, subClass) => { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index f131f2c..8dcb134 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -462,41 +462,32 @@ openView = (card, data) => { if (card.setting.click === 'menu' && card.setting.menu) { let menuId = card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.MenuID) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else if (card.setting.click === 'link') { let src = card.setting.linkurl diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index dcdd491..45a3656 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -82,8 +82,8 @@ if (!_config.wrap.height) { // 鍏煎 _config.wrap.height = _config.style.height || '300px' - delete _config.style.height } + delete _config.style.height _card.style.height = _config.wrap.height diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 273c51a..e600f77 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -74,8 +74,8 @@ if (!_config.wrap.height) { // 鍏煎 _config.wrap.height = _config.style.height || '300px' - delete _config.style.height } + delete _config.style.height _config.subcards.forEach(card => { card.style.height = _config.wrap.height @@ -241,6 +241,7 @@ let code = config.wrap.code || ('modal' + config.uuid) let tip = localStorage.getItem(code) + tip = null if ((data.$$uuid && tip === data.$$uuid) || (!data.$$uuid && tip)) return diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index 9fdeb1e..64536d5 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -1660,34 +1660,32 @@ if (!data) return let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } - newtab = { - ...newtab, - param: {} - } + if (!menu) return + + menu.param = {} if (plot.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else { if (data) { this.selectedId = data.$$uuid || '' diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 32267f3..3b654c5 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -1939,20 +1939,23 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } - MKEmitter.emit('modifyTabs', {...newtab, param: {$BID: sign}}, true) + if (!menu) return + + menu.param = {$BID: sign} + + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, sign, {}) } diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 7f2b2cf..46c4260 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -1875,34 +1875,32 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } + + if (!menu) return - newtab = { - ...newtab, - param: {} - } + menu.param = {} if (plot.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) } diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 3605b32..f589d40 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -1031,16 +1031,9 @@ let menu_id = plot.linkmenu.slice(-1)[0] chart.on('element:dblclick', (ev) => { - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return try { let data = ev.data.data diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 73ca3d9..8115aea 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -207,7 +207,7 @@ execSuccess = (btn, id) => { if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index cd83384..895ff53 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -268,7 +268,7 @@ if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 6286532..01a21ed 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -221,7 +221,7 @@ execSuccess = (btn, id) => { if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx index a4f2cb1..24d04ca 100644 --- a/src/tabviews/custom/components/module/account/index.jsx +++ b/src/tabviews/custom/components/module/account/index.jsx @@ -160,24 +160,18 @@ addBook = () => { const { config } = this.props - let menuId = config.wrap.MenuID - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] - - if (!menu && config.wrap.MenuNo) { - menu = { - MenuID: menuId, - MenuName: config.wrap.MenuName, - MenuNo: config.wrap.MenuNo || '', - type: config.wrap.tabType - } - } - - let newtab = { - ...menu, + let menu = { + MenuID: config.wrap.MenuID, + MenuName: config.wrap.MenuName, + type: config.wrap.tabType, param: {} } - MKEmitter.emit('modifyTabs', newtab, true) + if (window.GLOB.mkThdMenus.has(config.wrap.MenuID)) { + menu = {...window.GLOB.mkThdMenus.get(config.wrap.MenuID), param: {}} + } + + MKEmitter.emit('modifyTabs', menu, true) } render() { diff --git a/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx b/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx index 6c5c151..4c629f2 100644 --- a/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx +++ b/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx @@ -18,15 +18,13 @@ UNSAFE_componentWillMount() { let menuId = '16289973311406f3ko9nm8ehotdmu80o' - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = window.GLOB.mkThdMenus.get(menuId) if (menu) { - let newtab = { + this.setState({menu: { ...menu, param: {} - } - - this.setState({menu: newtab}) + }}) } } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 7d5f9c3..6d63982 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -642,7 +642,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 4555cbd..a3219f7 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -395,7 +395,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/home/index.jsx b/src/tabviews/home/index.jsx index d91ecef..d8b8d6c 100644 --- a/src/tabviews/home/index.jsx +++ b/src/tabviews/home/index.jsx @@ -39,7 +39,7 @@ check = (times) => { times++ - if ((window.GLOB.mkThdMenus.length > 0 && window.GLOB.mkActions.loaded) || times > 50) { + if ((window.GLOB.mkThdMenus.size > 0 && window.GLOB.mkActions.loaded) || times > 50) { this.setState({ waiting: false }) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 64cc21a..9f16abd 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -165,7 +165,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index a3785f0..9a8519f 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2200,22 +2200,22 @@ if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') { let menuId = btn.openmenu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && btn.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }} + } else if (btn.MenuID) { + menu = { MenuID: btn.MenuID, MenuName: btn.MenuName, - MenuNo: btn.MenuNo, - type: btn.tabType + type: btn.tabType, + param: { $BID: id } } - } else if (!newtab) { - return } - newtab = {...newtab, param: { $BID: id }} - - MKEmitter.emit('modifyTabs', newtab, true) + if (menu) { + MKEmitter.emit('modifyTabs', menu, true) + } } if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 184f2c8..c34cf31 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -146,14 +146,16 @@ } } else if (btn.linkmenu && btn.linkmenu.length > 0) { let menuId = btn.linkmenu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!menu && btn.MenuName && btn.MenuID) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: primaryId }} + } else if (btn.MenuID) { menu = { MenuID: btn.MenuID, MenuName: btn.MenuName, - MenuNo: btn.MenuNo, - type: btn.tabType + type: btn.tabType, + param: { $BID: primaryId } } } @@ -166,12 +168,7 @@ return } - newtab = { - ...menu, - param: { - $BID: primaryId - } - } + newtab = menu } if (btn.openTab === 'view') { diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index 3f11727..d8ca857 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -32,8 +32,10 @@ let values = event.newValue values = JSON.parse(values) - window.GLOB.mkThdMenus = values.mkThdMenus window.GLOB.mkActions = values.mkActions + values.mkThdMenus && values.mkThdMenus.forEach(item => { + window.GLOB.mkThdMenus.set(item.MenuID, item) + }) } else if (event.key === 'menuUpdate') { let vals = event.newValue.split(',') let MenuId = vals[1] -- Gitblit v1.8.0