From 08cce3334a2dc81d690b518136b0aaea64e48b0b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 14 六月 2023 09:55:50 +0800 Subject: [PATCH] 2023-06-14 --- src/views/billprint/index.jsx | 89 ++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 85 insertions(+), 4 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index b616463..de28f47 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -26,6 +26,7 @@ const NormalTable = asyncComponent(() => import('@/tabviews/custom/components/table/normal-table')) const SandBox = asyncComponent(() => import('@/tabviews/custom/components/code/sand-box')) const TimeLine = asyncComponent(() => import('@/tabviews/custom/components/timeline/normal-timeline')) +const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) const Balcony = asyncComponent(() => import('@/tabviews/custom/components/card/balcony')) const AntvG6 = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-G6')) const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) @@ -60,7 +61,6 @@ let param = JSON.parse(window.decodeURIComponent(window.atob(params.param))) sessionStorage.setItem('dataM', param.dataM || '') - sessionStorage.setItem('localDataM', param.dataM || '') this.setState({ BID: param.id || '', tempId: param.tempId, @@ -333,18 +333,66 @@ if (component.type === 'table') { let getColumns = (cols) => { - return cols.map(item => { + return cols.filter(item => { if (item.type === 'colspan') { item.subcols = getColumns(item.subcols) + if (item.subcols.length === 0) { + return false + } + } else if (item.type === 'custom') { + item.elements = item.elements.filter(cell => { + if (cell.eleType === 'button') return false + + cell = this.resetElement(cell) + return cell + }) + if (item.elements.length === 0) { + return false + } } else { item.IsSort = 'false' } - return item + return true }) } component.cols = getColumns(component.cols) component.statFields = [] + } else if (['card', 'carousel', 'timeline'].includes(component.type)) { + component.subcards && component.subcards.forEach(card => { + 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') return false + + cell = this.resetElement(cell) + + return true + }) + + if (!card.backElements || card.backElements.length === 0) return + + card.backElements = card.backElements.filter(cell => { + if (cell.eleType === 'button') return false + + cell = this.resetElement(cell) + + return true + }) + }) + } else if (component.type === 'balcony') { + component.elements = component.elements.filter(cell => { + if (cell.eleType === 'button') return false + + cell = this.resetElement(cell) + + return true + }) } if (component.wrap && component.wrap.datatype === 'static') { @@ -454,14 +502,41 @@ }) } + resetElement = (cell) => { + cell.style = cell.style || {} + if (['text', 'number', 'formula'].includes(cell.eleType)) { + cell.innerHeight = cell.innerHeight || 'auto' + cell.alignItems = cell.height > 1 ? cell.alignItems : '' + + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } + } + + return cell + } + reload = () => { + const { tempId } = this.state + this.setState({ loadingview: true, pages: null, data: '', config: null }, () => { - this.getMenuParam() + Api.deleteMenuStorage(tempId) + setTimeout(() => { + this.getMenuParam() + }, 50) + // Api.getAppVersion(tempId).then(() => { + // this.getMenuParam() + // }, () => { + // this.getMenuParam() + // }) }) } @@ -874,6 +949,12 @@ <TimeLine config={item} initdata={item.data} mainSearch={[]}/> </Col> ) + } else if (item.type === 'editor') { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <BraftEditor config={item} initdata={item.data} mainSearch={[]}/> + </Col> + ) } else if (item.type === 'antvG6') { return ( <Col span={item.width} style={style} key={item.uuid}> -- Gitblit v1.8.0