From ce70be666bcd78a7e16e739040488cf7e7256cc2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 31 五月 2021 15:49:43 +0800
Subject: [PATCH] 2021-05-31

---
 src/views/billprint/index.jsx |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx
index 6adefcc..048ff2e 100644
--- a/src/views/billprint/index.jsx
+++ b/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 // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
     

--
Gitblit v1.8.0