From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 七月 2021 11:39:39 +0800 Subject: [PATCH] 2021-07-28 --- src/views/billprint/index.jsx | 40 ++++++++++++++++++++++++++++++++++------ 1 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 66e09e1..38c9f1e 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -147,16 +147,44 @@ config.width = pageParam[config.pageSize][config.pageLayout] config.style.height = Math.floor(config.width * pageParam[config.pageSize][config.pageLayout + config.pagePadding]) + if (config.printCustom === 'true' && config.printWidth && config.printHeight) { + config.width = config.printWidth + config.style.height = config.printHeight + } + let params = [] let _pars = [] config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type)) + + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + let city = sessionStorage.getItem('city') || '' + + 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}'` }, + { reg: /@login_city@/ig, value: `'${city}'` } + ] + + if (window.GLOB.externalDatabase !== null) { + regs.push({ + reg: /@db@/ig, + value: window.GLOB.externalDatabase + }) + } + config.components = config.components.map(component => { if (component.action) component.action = [] if (component.search) component.search = [] component.data = [] // 鍒濆鍖栨暟鎹负绌� - if (['propcard', 'brafteditor', 'sandbox'].includes(component.subtype) && component.wrap.datatype === 'static') { + if (component.wrap.datatype === 'static') { component.format = '' } @@ -198,11 +226,10 @@ _customScript = _customScript.replace(/@\$|\$@/ig, '') } - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - component.setting.dataresource = component.setting.dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) - _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) - } + regs.forEach(cell => { + component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) + _customScript = _customScript.replace(cell.reg, cell.value) + }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 @@ -502,6 +529,7 @@ let linkList = document.getElementsByTagName('link') // 鑾峰彇鐖剁獥鍙ink鏍囩瀵硅薄鍒楄〃 let styleList = document.getElementsByTagName('style') // 鑾峰彇鐖剁獥鍙tyle鏍囩瀵硅薄鍒楄〃 + iframe.style.marginTop = '600px' document.body.appendChild(iframe) let doc = iframe.contentWindow.document -- Gitblit v1.8.0