From e9c48bd7356462ba9257540b130a47a65ad1861d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 八月 2021 17:17:11 +0800 Subject: [PATCH] 2021-08-26 --- src/tabviews/custom/index.jsx | 126 +++++++++++++++++++++++++++++++++-------- 1 files changed, 100 insertions(+), 26 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 8cf4cc6..b23c7a5 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -24,6 +24,7 @@ const DataCard = asyncComponent(() => import('./components/card/data-card')) const PropCard = asyncComponent(() => import('./components/card/prop-card')) const NormalForm = asyncComponent(() => import('./components/form/normal-form')) +const TabForm = asyncComponent(() => import('./components/form/tab-form')) const CarouselDataCard = asyncComponent(() => import('./components/carousel/data-card')) const CarouselPropCard = asyncComponent(() => import('./components/carousel/prop-card')) const TableCard = asyncComponent(() => import('./components/card/table-card')) @@ -130,7 +131,8 @@ // 鏉冮檺杩囨护 let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID - config.components = this.filterComponent(config.components, roleId, permAction, permMenus) + let balMap = new Map() + config.components = this.filterComponent(config.components, roleId, permAction, permMenus, balMap) // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] @@ -190,7 +192,11 @@ }) } - config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs) + config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs, balMap) + + if ([...balMap.keys()].length > 0) { + config.components = this.filterBalcony(config.components, balMap) + } this.setState({ BID: BID, @@ -280,6 +286,8 @@ }) return } + + item.MenuName = config.MenuName || '' inters.push(item) }) @@ -437,8 +445,18 @@ }) } - filterComponent = (components, roleId, permAction, permMenus) => { + filterComponent = (components, roleId, permAction, permMenus, balMap) => { return components.filter(item => { + + if (item.style && item.style.boxShadow) { + delete item.style.hShadow + delete item.style.vShadow + delete item.style.shadowBlur + delete item.style.shadowColor + } + + item.$menuname = this.props.MenuName + '-' + (item.name || '') + if (item.type === 'tabs') { if ( item.setting.blacklist && item.setting.blacklist.length > 0 && @@ -458,7 +476,7 @@ }) item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus) + tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus, balMap) return tab }) @@ -481,7 +499,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, permMenus) + item.components = this.filterComponent(item.components, roleId, permAction, permMenus, balMap) } else if (['pie', 'bar', 'line', 'dashboard', 'scatter'].includes(item.type)) { if ( item.plot.blacklist && item.plot.blacklist.length > 0 && @@ -548,7 +566,7 @@ let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 寮圭獥鏍囩鎸夐挳Id if (item.action && item.action.length > 0) { item.action = item.action.filter(cell => { - cell.logLabel = item.name + '-' + cell.label + cell.logLabel = item.$menuname + '-' + cell.label cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -572,15 +590,17 @@ item.subcards && item.subcards.forEach(card => { let _hasheight = card.style.height && card.style.height !== 'auto' - if (card.style.shadow) { // 鍗$墖闃村奖 - card.style.boxShadow = '0 0 4px ' + card.style.shadow - delete card.style.shadow + if (card.style.boxShadow) { + delete card.style.hShadow + delete card.style.vShadow + delete card.style.shadowBlur + delete card.style.shadowColor } card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -602,8 +622,8 @@ }) card.backElements = card.backElements.filter(cell => { if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -624,9 +644,13 @@ }) }) } else if (item.type === 'balcony') { + if (item.wrap.linkType === 'sync') { + item.wrap.syncModuleId = item.wrap.syncModule.pop() + balMap.set(item.wrap.syncModuleId, true) + } item.elements = item.elements.filter(cell => { if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label + cell.logLabel = item.$menuname + '-' + cell.label cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -647,8 +671,8 @@ let _hasheight = card.style.height && card.style.height !== 'auto' card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -673,8 +697,8 @@ 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' + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' cell.ContainerId = this.state.ContainerId cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid @@ -715,6 +739,44 @@ }) } + filterBalcony = (components, balMap) => { + return components.filter(item => { + if (item.type === 'tabs') { + item.subtabs = item.subtabs.map(tab => { + tab.components = this.filterBalcony(tab.components, balMap) + return tab + }) + } else if (item.type === 'group') { + item.components = this.filterBalcony(item.components, balMap) + } + + if (item.type === 'balcony' && item.wrap.linkType === 'sync') { + let conf = balMap.get(item.wrap.syncModuleId) + + if (!conf || conf === true) { + return false + } + + item.syncConfig = { + uuid: conf.uuid, + wrap: conf.wrap, + setting: conf.setting, + columns: conf.columns + } + + if (item.wrap.checkAll === 'show') { + if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') { + item.wrap.checkAll = 'hidden' + } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') { + item.wrap.checkAll = 'hidden' + } + } + } + + return true + }) + } + getPrinter = (item, parentId) => { let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid) @@ -734,17 +796,17 @@ } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, mainSearch, inherit, regs) => { + formatSetting = (components, params, mainSearch, inherit, regs, balMap) => { return components.map(component => { if (component.type === 'tabs') { component.subtabs = component.subtabs.map(tab => { - tab.components = this.formatSetting(tab.components, [], [], inherit, regs) + tab.components = this.formatSetting(tab.components, [], [], inherit, regs, balMap) tab = {...tab, ...inherit} return tab }) return component } else if (component.type === 'group') { - component.components = this.formatSetting(component.components, [], [], inherit, regs) + component.components = this.formatSetting(component.components, [], [], inherit, regs, balMap) component = {...component, ...inherit} return component } @@ -777,7 +839,7 @@ } }) delete component.scripts - component.setting.$name = component.name || '' + component.setting.$name = component.$menuname || '' component.setting.execute = component.setting.execute !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 component.setting.laypage = component.setting.laypage === 'true' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 @@ -830,6 +892,11 @@ } } else if (component.floor === 1) { component.setting.sync = 'false' + } + + if (balMap.has(component.uuid)) { + component.setting.$hasSyncModule = true + balMap.set(component.uuid, component) } return component @@ -917,7 +984,8 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - shortcuts: null + shortcuts: null, + data: '' }, () => { this.loadconfig() }) @@ -965,10 +1033,16 @@ <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> </Col> ) - } else if (item.type === 'form') { + } else if (item.type === 'form' && item.subtype === 'stepform') { return ( <Col span={item.width} key={item.uuid}> <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> + </Col> + ) + } else if (item.type === 'form' && item.subtype === 'tabform') { + return ( + <Col span={item.width} key={item.uuid}> + <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'search') { @@ -980,7 +1054,7 @@ } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} mainSearch={mainSearch} /> + <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { @@ -998,7 +1072,7 @@ } else if (item.type === 'balcony') { return ( <Col span={item.width} key={item.uuid}> - <Balcony menu={config} config={item} data={data} BID={_bid} menuType={menuType} /> + <Balcony config={item} data={data} BID={_bid} menuType={menuType} /> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'datacard') { -- Gitblit v1.8.0