From e9640ccdc9fe57f91919e3f51462c780e44fadb0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 十二月 2020 13:14:20 +0800 Subject: [PATCH] 2020-12-23 --- src/tabviews/custom/index.jsx | 46 +++++++++++++++++++++++++++++----------------- 1 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 04b727a..89ed828 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -234,21 +234,7 @@ }) } if (item.type === 'table' && item.subtype === 'normaltable') { - item.cols = item.cols.map(col => { - if (!col.blacklist || col.blacklist.length === 0) return col - if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { - col.Hide = 'true' - } - - if (col.Hide !== 'true' && col.linkmenu && col.linkmenu.length > 0) { - let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' - } else { - col.linkThdMenu = '' - } - - return col - }) + item.cols = this.getCols(item.cols, roleId, permMenus) } // 鏉冮檺杩囨护 @@ -301,13 +287,14 @@ }) }) } else if (item.type === 'table' && item.subtype === 'normaltable') { - item.cols.forEach(col => { - if (col.type !== 'action') return + item.cols = item.cols.filter(col => { + if (col.type !== 'action') return true col.elements = col.elements.filter(cell => { cell.logLabel = item.name + '-' + cell.label cell.Ot = 'requiredSgl' return permAction[cell.uuid] }) + return col.elements.length !== 0 }) } } else { @@ -338,6 +325,31 @@ }) } + getCols = (cols, roleId, permMenus) => { + return cols.filter(col => { + if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + return false + } else if (col.Hide === 'true') { + return false + } + if (col.type === 'colspan') { + col.subcols = this.getCols(col.subcols || [], roleId, permMenus) + if (col.subcols.length === 0) { + return false + } + } + + if (col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.slice(-1)[0] + col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' + } + + return true + }) + } + // 鏍煎紡鍖栭粯璁よ缃� formatSetting = (components, params, mainSearch, inherit) => { return components.map(component => { -- Gitblit v1.8.0