From e9e8b1c7b481415714fff9a0d83099fd5a7d6ff0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 18 五月 2023 17:25:11 +0800 Subject: [PATCH] 2023-05-18 --- src/views/pcdesign/index.jsx | 100 ++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 76 insertions(+), 24 deletions(-) diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index b6b2760..76e490b 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -365,6 +365,8 @@ _btn.config.MenuID = _btn.uuid _btn.config.ParentId = card.uuid _btn.config.MenuName = _btn.label + + _btn.config.components = this.updateComponents(_btn.config.components || []) } else { _btn.config = { uuid: _btn.uuid, @@ -420,15 +422,23 @@ }) }) - config.cols && config.cols.forEach(col => { - if (col.type === 'action') { - col.elements.forEach(cell => { - if (cell.OpenType === 'popview' && popbtns[cell.uuid]) { - cell.config = popbtns[cell.uuid] + if (config.cols) { + let loopCol = (cols) => { + cols.forEach(col => { + if (col.type === 'colspan') { + loopCol(col.subcols) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.OpenType === 'popview' && popbtns[cell.uuid]) { + cell.config = popbtns[cell.uuid] + } + }) } }) } - }) + loopCol(config.cols) + } config.elements && config.elements.forEach(cell => { if (cell.eleType !== 'button') return @@ -556,6 +566,8 @@ this.setState({ needUpdate: true }) + } else { + config.components = this.updateComponents(config.components) } let navItem = null @@ -581,6 +593,27 @@ this.getAppMenus() } + updateComponents = (components) => { // 鍏煎鎬у崌绾� table + return components.map(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + tab.components = this.updateComponents(tab.components) + }) + } else if (item.type === 'group') { + item.components = this.updateComponents(item.components) + } else if (item.type === 'table') { + item.cols = item.cols.map(col => { + if (col.type === 'action') { + col.type = 'custom' + } + return col + }) + } + + return item + }) + } + collectTB = (components) => { return components.map(item => { if (item.type === 'tabs') { @@ -599,6 +632,13 @@ if (item.subtype === 'tablecard') { // 鍏煎 item.type = 'card' + } else if (item.type === 'table') { + item.cols = item.cols.map(col => { + if (col.type === 'action') { + col.type = 'custom' + } + return col + }) } delete item.tabId @@ -913,17 +953,22 @@ title: btn.label, }) }) - item.cols.forEach(col => { - if (col.type !== 'action') return - col.elements.forEach(btn => { - if (btn.hidden === 'true') return - - m.children.push({ - key: btn.uuid, - title: btn.label, - }) + let loopCol = (cols) => { + cols.forEach(col => { + if (col.type === 'colspan') { + loopCol(col.subcols) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true') return + m.children.push({ + key: cell.uuid, + title: cell.label, + }) + }) + } }) - }) + } + loopCol(item.cols) } list.push(m) @@ -1039,16 +1084,23 @@ menus.push(menuObj[btn.openmenu]) } }) - item.cols && item.cols.forEach(col => { - if (col.type !== 'action') return - col.elements.forEach(btn => { - if (btn.linkmenu && menuObj[btn.linkmenu]) { - menus.push(menuObj[btn.linkmenu]) - } else if (btn.openmenu && menuObj[btn.openmenu]) { - menus.push(menuObj[btn.openmenu]) + let loopCol = (cols) => { + cols.forEach(col => { + if (col.type === 'colspan') { + loopCol(col.subcols) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.linkmenu && menuObj[cell.linkmenu]) { + menus.push(menuObj[cell.linkmenu]) + } else if (cell.openmenu && menuObj[cell.openmenu]) { + menus.push(menuObj[cell.openmenu]) + } + }) } }) - }) + } + loopCol(item.cols) } }) } -- Gitblit v1.8.0