king
2021-05-31 ce70be666bcd78a7e16e739040488cf7e7256cc2
src/views/billprint/index.jsx
@@ -156,6 +156,29 @@
        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 = []
@@ -203,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 // 整理后自定义脚本