From 547e5fe219ee7bee309ecd67db74bc8df66b5433 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 八月 2023 11:47:45 +0800 Subject: [PATCH] 2023-08-23 --- src/views/billprint/index.jsx | 580 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 426 insertions(+), 154 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index a7be0ab..7779306 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -5,9 +5,7 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import options, { styles } from '@/store/options.js' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' +import { styles } from '@/store/options.js' import UtilsDM from '@/utils/utils-datamanage.js' import NotFount from '@/components/404' import asyncComponent from '@/utils/asyncComponent' @@ -34,16 +32,18 @@ class BillPrint extends Component { state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, loadingview: true, printing: false, pages: null, BID: '', data: '', tempId: '', + pageId: '', config: null, urlParam: null, visible: false, + rePos: false, + loading: false, auto: true } @@ -65,7 +65,8 @@ this.setState({ BID: param.id || '', tempId: param.tempId, - urlParam: param + urlParam: param, + pageId: param.pageId || '' }, () => { setTimeout(() => { this.getMenuParam() @@ -88,22 +89,36 @@ componentDidMount() { const _this = this - Object.defineProperty(window, 'debug', { - configurable: true, - enumerable: true, - set(value) { - if (value + '' === 'false') { - window.debugger = false - window.GLOB.breakpoint = false - sessionStorage.removeItem('breakpoint') - } else { - window.debugger = true - window.GLOB.breakpoint = value + '' - sessionStorage.setItem('breakpoint', value) + if (window.GLOB.sysType !== 'cloud') { + Object.defineProperty(window, 'debugger', { + configurable: true, + enumerable: true, + set(value) { + if (value + '' === 'false') { + window.GLOB.debugger = false + } else { + window.GLOB.debugger = true + } } - _this.debugChange() - } - }) + }) + + Object.defineProperty(window, 'debug', { + configurable: true, + enumerable: true, + set(value) { + if (value + '' === 'false') { + window.GLOB.debugger = false + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + } else { + window.GLOB.debugger = true + window.GLOB.breakpoint = value + '' + sessionStorage.setItem('breakpoint', value) + } + _this.debugChange() + } + }) + } document.onkeydown = (event) => { let e = event || window.event @@ -123,7 +138,6 @@ let _shortcut = `${preKey}+${keyCode}` if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { - window.debugger = false window.GLOB.breakpoint = false sessionStorage.removeItem('breakpoint') @@ -231,7 +245,7 @@ this.setState({ viewlost: true, loadingview: false, - lostmsg: this.state.dict['main.view.unenabled'] + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭鍚敤锛岃鑱旂郴绠$悊鍛樸��' }) return } @@ -284,11 +298,6 @@ let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } - let regs = [ { reg: /@userName@/ig, value: `'${userName}'` }, { reg: /@fullName@/ig, value: `'${fullName}'` } @@ -313,9 +322,23 @@ window.GLOB.CacheData.set(tempId, {$BID: BID}) + let initInters = [] + + this.formatInterSetting(config.interfaces, regs, initInters, params, BID) + config.components = config.components.map(component => { - if (component.action) component.action = [] - if (component.search) component.search = [] + if (component.action) { + component.action = component.action.filter(cell => { + cell = this.resetButton(component, cell) + cell.$toolbtn = true + + return !cell.hidden + }) + } + if (component.search) { + component.search = [] + component.$searches = [] + } component.data = [] // 鍒濆鍖栨暟鎹负绌� if (component.subtype === 'tablecard') { // 鍏煎 @@ -342,10 +365,15 @@ } } else if (item.type === 'custom') { item.elements = item.elements.filter(cell => { - if (cell.eleType === 'button') return false + if (cell.eleType === 'button') { + cell = this.resetButton(component, cell) + + return !cell.hidden + } cell = this.resetElement(cell) - return cell + + return true }) if (item.elements.length === 0) { return false @@ -369,18 +397,26 @@ } card.elements = card.elements.filter(cell => { - if (cell.eleType === 'button') return false - + if (cell.eleType === 'button') { + cell = this.resetButton(component, cell) + + return !cell.hidden + } + 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 - + if (cell.eleType === 'button') { + cell = this.resetButton(component, cell) + + return !cell.hidden + } + cell = this.resetElement(cell) return true @@ -388,8 +424,12 @@ }) } else if (component.type === 'balcony') { component.elements = component.elements.filter(cell => { - if (cell.eleType === 'button') return false - + if (cell.eleType === 'button') { + cell = this.resetButton(component, cell) + + return !cell.hidden + } + cell = this.resetElement(cell) return true @@ -398,19 +438,31 @@ if (component.wrap && component.wrap.datatype === 'static') { component.format = '' + } else if (component.wrap && component.wrap.datatype === 'public') { + component.componentId = component.wrap.publicId + component.format = '' } if (!component.setting) return component // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 if (!component.format) return component // 娌℃湁鍔ㄦ�佹暟鎹� 鏁版嵁鏍煎紡 array 鎴� object + + component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' + if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' return component } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -429,21 +481,23 @@ } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*') - component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') - _customScript = _customScript.replace(/\$@/ig, '/*') - _customScript = _customScript.replace(/@\$/ig, '*/') + component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { - component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '') - _customScript = _customScript.replace(/@\$|\$@/ig, '') + component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� // floor 缁勪欢鐨勫眰绾� // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ @@ -451,9 +505,8 @@ component.dataName = 'mk' + component.uuid.slice(-18) let param = this.getDefaultParam(component) _pars.push(param) - } else { - let arr_field = component.columns.map(col => col.field).join(',') - let param = UtilsDM.getQueryDataParams(component.setting, arr_field, [], component.setting.order || '', 1, 1000, BID) + } else if (component.subtype !== 'dualdatacard') { + let param = UtilsDM.getQueryDataParams(component.setting, [], component.setting.order || '', 1, 1000, BID) param.componentId = component.uuid @@ -487,8 +540,10 @@ auto: config.printPage === 'auto', config }, () => { - if (params.length === 0) { + if (params.length === 0 && initInters.length === 0) { this.setState({loadingview: false, pages: [config.components]}) + } else if (initInters.length > 0) { + this.loadinit(initInters, params) } else { this.loadmaindata(params) } @@ -501,6 +556,28 @@ }) } }) + } + + resetButton = (item, cell) => { + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' + cell.syncComponentId = '' + cell.$menuId = item.uuid + + cell.hidden = cell.hidden === 'true' + if (!['pop', 'prompt', 'exec', 'innerpage', 'form'].includes(cell.OpenType)) { + cell.hidden = true + } + + if (cell.controlField) { + if (/,/ig.test(cell.controlVal)) { + cell.controlVals = cell.controlVal.split(',') + } else { + cell.controlVals = [(cell.controlVal || '')] + } + } + + return cell } resetElement = (cell) => { @@ -520,6 +597,92 @@ return cell } + formatInterSetting = (inters, regs, initInters, params, BID) => { + if (!inters) return [] + + let delay = 15 + inters.forEach(inter => { + if (inter.status !== 'true') return + + inter.setting.delay = delay + delay += 15 + + inter.setting.supModule = '' + inter.setting.arr_field = inter.columns.map(col => col.field).join(',') + + if (inter.setting.interType !== 'system') { + let param = UtilsDM.getQueryDataParams(inter.setting, [], inter.setting.order || '', 1, 1000, BID) + + param.componentId = inter.uuid + + if (inter.setting.loadlevel === 'init') { + initInters.push(param) + } else { + param.public = true + params.push(param) + } + return + } + + let _customScript = '' + let _tailScript = '' + inter.scripts.forEach(script => { + if (script.status === 'false') return + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } + }) + delete inter.scripts + + inter.setting.$name = '鍏叡鏁版嵁婧�-' + inter.setting.name + inter.setting.execute = inter.setting.execute !== 'false' + inter.setting.laypage = true + + if (!inter.setting.execute) { + inter.setting.dataresource = '' + } + if (/\s/.test(inter.setting.dataresource)) { + inter.setting.dataresource = '(' + inter.setting.dataresource + ') tb' + } + + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + } else { + inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + } + + regs.forEach(cell => { + inter.setting.dataresource = inter.setting.dataresource.replace(cell.reg, cell.value) + _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) + }) + + inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + + let param = UtilsDM.getQueryDataParams(inter.setting, [], inter.setting.order || '', 1, 1000, BID) + + param.componentId = inter.uuid + + if (inter.setting.loadlevel === 'init') { + initInters.push(param) + } else { + param.public = true + params.push(param) + } + }) + } + reload = () => { const { tempId } = this.state @@ -533,11 +696,6 @@ setTimeout(() => { this.getMenuParam() }, 50) - // Api.getAppVersion(tempId).then(() => { - // this.getMenuParam() - // }, () => { - // this.getMenuParam() - // }) }) } @@ -547,18 +705,17 @@ getDefaultParam = (component) => { const { columns, setting, dataName, format } = component - let arr_field = columns.map(col => col.field) let _dataresource = setting.dataresource let _customScript = setting.customScript if (setting.order && _dataresource) { - _dataresource = `select top 1000 ${arr_field.join(',')} from (select ${arr_field.join(',')} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows ` + _dataresource = `select top 1000 ${setting.arr_field} from (select ${setting.arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows ` } else if (_dataresource) { - _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ` + _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ` } // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { + if (window.GLOB.debugger === true) { _customScript && console.info(`${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`) _dataresource && console.info(_dataresource) } @@ -592,11 +749,6 @@ let city = sessionStorage.getItem('city') || '' let district = sessionStorage.getItem('district') || '' let address = sessionStorage.getItem('address') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } let LText = params.map((item, index) => { let _sql = item.sql @@ -619,7 +771,9 @@ func: 'sPC_Get_structured_data', LText: LText.join(' union all '), LText_field: LText_field.join(' union all '), - BID: BID || '' + BID: BID || '', + username: userName, + fullName: fullName } param.LText = Utils.formatOptions(param.LText) @@ -630,6 +784,40 @@ return param } + loadinit = (initInters, params) => { + let deffers = initInters.map(item => { + let componentId = item.componentId + delete item.componentId + return new Promise(resolve => { + Api.genericInterface(item).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + resolve() + } else { + let _data = { $$empty: true } + if (res.data && res.data[0]) { + _data = res.data[0] + } + window.GLOB.CacheData.set(componentId, _data) + } + resolve() + }) + }) + }) + + Promise.all(deffers).then(() => { + if (params.length === 0) { + this.setState({loadingview: false, pages: [this.state.config.components]}) + } else { + this.loadmaindata(params) + } + }) + } + /** * @description 涓昏〃鏁版嵁鍔犺浇 */ @@ -638,7 +826,9 @@ let deffers = params.map(item => { let componentId = item.componentId + let ispublic = item.public delete item.componentId + delete item.public return new Promise(resolve => { Api.genericInterface(item).then(res => { if (!res.status) { @@ -650,6 +840,14 @@ resolve(false) } else { res.componentId = componentId + + if (ispublic) { + let _data = { $$empty: true } + if (res.data && res.data[0]) { + _data = res.data[0] + } + window.GLOB.CacheData.set(componentId, _data) + } resolve(res) } }) @@ -660,17 +858,30 @@ let _results = results.filter(Boolean) let comps = components.map(item => { + item.wrap = item.wrap || {} + item.data = null + if (!item.format) return item + if ((item.subtype === 'datacard' && item.wrap.layout !== 'flex') || item.type === 'table') { + item.$page = true + } + _results.forEach(res => { - if (res.componentId === item.uuid && res.data) { - item.data = res.data + if ((res.componentId === item.uuid || res.componentId === item.componentId) && res.data) { item.dataArray = fromJS(res.data).toJS() } else if (res.componentId === 'union' && res[item.dataName]) { - item.data = res[item.dataName] - item.dataArray = fromJS(res[item.dataName]).toJS() + let data = res[item.dataName] + if (!Array.isArray(data)) { + data = [data] + } + item.dataArray = fromJS(data).toJS() } }) + + if (item.$page && !item.dataArray) { + item.$page = false + } return item }) @@ -684,94 +895,104 @@ this.setState({loadingview: false, pages}) } + let setData = (item) => { + if (item.setting && item.setting.sync === 'true' && item.data) { + item.dataName = Utils.getuuid() + window.GLOB.SyncData.set(item.dataName, item.data) + } + } + while (!over) { let page = [] let count = 0 let _pageover = false - let pagesover = false - comps.forEach((_item, index) => { - let item = fromJS(_item).toJS() + comps.forEach(comp => { + let item = fromJS(comp).toJS() - if (index + 1 >= length && !_pageover) { - pagesover = true + if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 + item.data = item.dataArray || null + setData(item) + page.push(item) + comp.added = true } - if (item.wrap && item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 - page.push(item) - } else if (_pageover) { - return - } else if (item.subtype === 'datacard' || item.type === 'table') { - if (_item.dataArray && _item.dataArray.length > 0) { - if (item.subtype === 'datacard' && item.wrap.layout === 'flex') { - if (!item.added && item.wrap.printHeight) { - count += item.wrap.printHeight - if (count >= limit) { - _pageover = true - } - if (count <= limit) { - _item.added = true - page.push(item) - } - } else if (!item.added) { - _item.added = true - page.push(item) - } - } else { - item.data = [] - - while (count + 1 <= limit && _item.dataArray.length > 0) { - item.data.push(_item.dataArray.shift()) - count++ - } - - if (count >= limit) { - _pageover = true - } else if (_item.dataArray.length > 0) { - _pageover = true + if (_pageover) return - } + if (item.$page && comp.dataArray.length > 0) { + item.data = [] - page.push(item) - } - _item.added = true - } else if (!item.added) { - _item.added = true - page.push(item) - } - } else if (!item.added && item.wrap && item.wrap.printHeight) { - if (item.wrap.empty === 'hidden' && (!item.data || item.data.length === 0)) { - _item.added = true - return + while (count + 1 <= limit && comp.dataArray.length > 0) { + item.data.push(comp.dataArray.shift()) + count++ } - count += item.wrap.printHeight - if (count >= limit) { + if (count >= limit || comp.dataArray.length > 0) { _pageover = true } - if (count <= limit) { - _item.added = true - page.push(item) + + if (comp.dataArray.length === 0) { + comp.added = true } - } else if (!item.added) { - _item.added = true + + setData(item) page.push(item) - } - - if (index + 1 >= length && !_pageover) { - pagesover = true + } else if (!comp.added) { + if (item.wrap.printHeight) { + count += item.wrap.printHeight + if (count >= limit) { + _pageover = true + return + } + } + + item.data = item.dataArray || null + + setData(item) + page.push(item) + comp.added = true } }) pages.push(page) pageIndex++ - if (pageIndex >= 2000 || pagesover) { + if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) { over = true } } - this.setState({loadingview: false, pages}) + let total = pages.length + let date = moment().format('YYYY-MM-DD') + let datetime = moment().format('YYYY-MM-DD HH:mm:ss') + let rePos = false + + pages.forEach((page, index) => { + page.forEach(item => { + if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 + if (item.type === 'balcony') { + if (item.style.position === 'absolute') { + rePos = true + } + item.elements.forEach(cell => { + if (cell.eleType === 'text' && cell.datatype === 'static') { + cell.value = cell.value.replace(/@total@/ig, total).replace(/@pageIndex@/ig, index + 1).replace(/@date@/ig, date).replace(/@datetime@/ig, datetime) + } + }) + } else if (item.subtype === 'propcard') { + item.subcards.forEach(card => { + card.elements.forEach(cell => { + if (cell.eleType === 'text' && cell.datatype === 'static') { + cell.value = cell.value.replace(/@total@/ig, total).replace(/@pageIndex@/ig, index + 1).replace(/@date@/ig, date).replace(/@datetime@/ig, datetime) + } + }) + }) + } + } + }) + }) + + this.setState({loadingview: false, pages, rePos}) }) } @@ -790,9 +1011,54 @@ } print = () => { - const { config, printing } = this.state + const { config, printing, BID, tempId, pageId } = this.state if (printing) return + + this.setState({printing: true}) + + if (config.callback === 'true') { + this.setState({loading: true}) + + Api.genericInterface({ + func: 's_print_proc', + username: sessionStorage.getItem('User_Name') || '', + fullname: sessionStorage.getItem('Full_Name') || '', + BID: BID || '', + print_type: config.callNo || '', + MenuNo: config.MenuNo || '', + Menuid: tempId || '' + }).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message || '鎵ц澶辫触锛�', + duration: 5 + }) + + this.setState({printing: false, loading: false}) + return + } + + let refresh = !/@no_target_menu@/i.test(res.message) + + this.setState({loading: false}) + + if (pageId && refresh) { + localStorage.setItem('menuUpdate', new Date().getTime() + ',' + pageId + ',menu') + } + + setTimeout(() => { + this.execPrint() + }, 300) + }) + } else { + this.execPrint() + } + } + + execPrint = () => { + const { config } = this.state let qrcodes = document.getElementsByClassName('qrcode-box') @@ -823,8 +1089,6 @@ } let jubuData = document.getElementById('bill-print').innerHTML - - this.setState({printing: true}) try { let iframe = document.createElement('IFRAME') @@ -876,90 +1140,98 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvBarAndLine config={item} initdata={item.data} mainSearch={[]} /> + <AntvBarAndLine config={item}/> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvPie config={item} initdata={item.data} mainSearch={[]} /> + <AntvPie config={item} /> </Col> ) } else if (item.type === 'scatter') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvScatter config={item} initdata={item.data} mainSearch={[]}/> + <AntvScatter config={item}/> </Col> ) } else if (item.type === 'dashboard') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvDashboard config={item} initdata={item.data} mainSearch={[]}/> + <AntvDashboard config={item}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} style={style} key={item.uuid}> - <DataCard config={item} initdata={item.data} mainSearch={[]} /> + <DataCard config={item} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} style={style} key={item.uuid}> - <PropCard config={item} initdata={item.data} mainSearch={[]} /> + <PropCard config={item} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'dualdatacard') { return ( <Col span={item.width} style={style} key={item.uuid}> - <DoubleDataCard config={item} mainSearch={[]}/> + <DoubleDataCard config={item}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'tablecard') { return ( <Col span={item.width} style={style} key={item.uuid}> - <TableCard config={item} initdata={item.data} mainSearch={[]}/> + <TableCard config={item}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'normaltable') { return ( <Col span={item.width} style={style} key={item.uuid}> - <NormalTable config={item} initdata={item.data} mainSearch={[]}/> + <NormalTable config={item}/> </Col> ) } else if (item.type === 'code') { return ( <Col span={item.width} style={style} key={item.uuid}> - <SandBox config={item} initdata={item.data} mainSearch={[]}/> + <SandBox config={item}/> </Col> ) } else if (item.type === 'balcony') { - return ( - <Col span={item.width} style={style} key={item.uuid}> - <Balcony config={item} initdata={item.data}/> - </Col> - ) + if (item.wrap.printType === 'headerOrfooter' && item.style.position === 'absolute') { + return ( + <Balcony key={item.uuid} config={item}/> + ) + } else { + return ( + <Col span={item.width} style={style} key={item.uuid}> + <Balcony config={item}/> + </Col> + ) + } } else if (item.type === 'timeline') { return ( <Col span={item.width} style={style} key={item.uuid}> - <TimeLine config={item} initdata={item.data} mainSearch={[]}/> + <TimeLine config={item}/> </Col> ) } else if (item.type === 'editor') { return ( <Col span={item.width} style={style} key={item.uuid}> - <BraftEditor config={item} initdata={item.data} mainSearch={[]}/> + <BraftEditor config={item}/> </Col> ) } else if (item.type === 'antvG6') { return ( <Col span={item.width} style={style} key={item.uuid}> - <AntvG6 config={item} initdata={item.data} mainSearch={[]}/> + <AntvG6 config={item}/> </Col> ) } else if (item.type === 'antvX6') { @@ -975,13 +1247,13 @@ } render() { - const { loadingview, viewlost, config, pages, auto } = this.state + const { loadingview, viewlost, config, pages, auto, rePos, loading } = this.state return ( <div className="bill-print-wrap" > - {loadingview && <Spin size="large" />} + {loadingview || loading ? <Spin size="large" /> : null} {pages ? <div id="bill-print"> - {pages.map((components, index) => (<div className={'print-page' + (auto ? ' auto' : '')} key={index} style={{...config.style, overflow: 'hidden', boxSizing: 'border-box'}}><Row className="component-wrap">{this.getComponents(components)}</Row></div>))} + {pages.map((components, index) => (<div className={'print-page' + (auto ? ' auto' : '') + (rePos ? ' reset-position' : '')} key={index} style={{...config.style, overflow: 'hidden', boxSizing: 'border-box'}}><Row className="component-wrap">{this.getComponents(components)}</Row></div>))} </div> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} {config && window.GLOB.breakpoint ? <DebugTable /> : null} -- Gitblit v1.8.0