From 3ca91a731665962918a026f521c556f4745ebf35 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 16 十一月 2020 19:20:19 +0800 Subject: [PATCH] 2020-11-16 --- src/views/menudesign/index.jsx | 96 +++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 78 insertions(+), 18 deletions(-) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 4dceaa3..b491da0 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -23,6 +23,7 @@ const _locale = localStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS const MenuForm = asyncComponent(() => import('./menuform')) +const HomeForm = asyncComponent(() => import('./homeform')) const PrintMenuForm = asyncComponent(() => import('./printmenuform')) const Header = asyncComponent(() => import('@/menu/header')) const SourceWrap = asyncComponent(() => import('@/menu/modelsource')) @@ -187,6 +188,46 @@ }) } + getMenuMessage = () => { + const { config } = this.state + let buttons = [] + let _sort = 1 + + let traversal = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + traversal(tab.components) + }) + } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + card.backElements && card.backElements.forEach(cell => { + if (cell.eleType !== 'button') return + + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } else if (item.type === 'line' || item.type === 'bar') { + item.action && item.action.forEach(btn => { + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + } + }) + } + + traversal(config.components) + + return buttons + } + submitConfig = () => { const { config, openEdition } = this.state @@ -197,7 +238,14 @@ duration: 5 }) return - } else if (config.MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId)) { + } else if (config.MenuType === 'home' && (config.cacheUseful === 'true' && !config.cacheTime)) { + notification.warning({ + top: 92, + message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + duration: 5 + }) + return + } else if (config.MenuType === 'custom' && (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId || (config.cacheUseful === 'true' && !config.cacheTime))) { notification.warning({ top: 92, message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', @@ -216,21 +264,6 @@ delete _config.sysRoles delete _config.tableFields - let funcs = [] - if (config.MenuType !== 'billPrint') { - _config.components.forEach(component => { - if (component.setting && component.setting.innerFunc) { - funcs.push(`select '${_config.uuid}' as MenuID,'${component.setting.innerFunc}' as ProcName,'${component.setting.name}' as MenuName`) - } - if (component.action) { - component.action.forEach(item => { - if (!item.innerFunc) return - funcs.push(`select '${_config.uuid}' as MenuID,'${item.innerFunc}' as ProcName,'${item.label}' as MenuName`) - }) - } - }) - } - let param = { func: 'sPC_TrdMenu_AddUpt', FstID: _config.fstMenuId || '', @@ -243,8 +276,8 @@ MenuName: _config.MenuName || '', PageParam: JSON.stringify({Template: 'CustomPage', OpenType: 'newtab'}), LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))), - LText: funcs.join(' union all '), - LTexttb: '' // 琛ㄥ悕 + LText: '', + LTexttb: '' } param.LText = Utils.formatOptions(param.LText) @@ -253,6 +286,28 @@ if (openEdition) { // 鐗堟湰绠$悊 param.open_edition = openEdition + } + + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 + func: 'sPC_Button_AddUpt', + Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + ParentID: _config.uuid, + MenuNo: _config.MenuNo, + Template: 'CustomPage', + PageParam: '', + LongParam: '', + LText: [] + } + + if (config.MenuType !== 'billPrint') { + btnParam.LText = this.getMenuMessage() + + btnParam.LText = btnParam.LText.join(' union all ') + btnParam.LText = Utils.formatOptions(btnParam.LText) + btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + } else { + btnParam.LText = '' } this.setState({ @@ -468,6 +523,11 @@ initMenuList={this.initMenuList} updateConfig={this.updateConfig} /> : null} + {config && MenuType === 'home' ? <HomeForm + dict={dict} + config={config} + updateConfig={this.updateConfig} + /> : null} {config && MenuType === 'billPrint' ? <PrintMenuForm dict={dict} config={config} -- Gitblit v1.8.0