From cd5079f2dbe12eb03fcef2e1898e4f013848d895 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 28 九月 2023 12:34:30 +0800
Subject: [PATCH] 2023-09-28

---
 src/tabviews/custom/popview/index.jsx |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index 5fc621c..d9fb7ac 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -123,6 +123,11 @@
       })
     }
 
+    if (Tab.$process && window.GLOB.UserCacheMap.has(Tab.$flowId)) {
+      let flow = window.GLOB.UserCacheMap.get(Tab.$flowId)
+      regs.push({ reg: /@works_flow_code@/ig, value: `'${flow.flow_code || ''}'` })
+    }
+
     config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid)
     
     // 鑾峰彇涓绘悳绱㈡潯浠�
@@ -153,7 +158,7 @@
 
     config.components = this.formatSetting(config.components, params, regs, balMap)
 
-    if ([...balMap.keys()].length > 0) {
+    if (balMap.size > 0) {
       config.components = this.filterBalcony(config.components, balMap)
     }
 
@@ -172,6 +177,11 @@
       item.$pageId = Tab.uuid
       item.$searchId = searchId
       item.$syncId = syncId
+
+      if (Tab.$process) {
+        item.$process = true
+        item.$flowId = Tab.$flowId
+      }
       
       if (item.style && item.style.boxShadow) {
         delete item.style.hShadow
@@ -344,7 +354,6 @@
       }
 
       if (item.type === 'table') {
-        let statFields = []
         let getCols = (cols) => {
           return cols.filter(col => {
             if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
@@ -356,9 +365,6 @@
             }
             
             if (col.type === 'number') {
-              if (col.sum === 'true' && !statFields.includes(col.field)) {
-                statFields.push(col)
-              }
               if (typeof(col.decimal) === 'number') {
                 col.round = Math.pow(10, col.decimal)
                 if (col.format === 'percent') {
@@ -394,7 +400,7 @@
       
             if (col.linkmenu && col.linkmenu.length > 0) {
               let menu_id = col.linkmenu.pop()
-              col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || ''
+              col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || ''
             } else {
               col.linkThdMenu = ''
             }
@@ -404,7 +410,6 @@
         }
         
         item.cols = getCols(item.cols)
-        item.statFields = statFields
 
         if (item.subtype === 'editable') {
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
@@ -591,6 +596,11 @@
     cell.$MenuID = Tab.$MenuID
     cell.$tabId = Tab.uuid
 
+    if (Tab.$process) {
+      cell.$process = true
+      cell.$flowId = Tab.$flowId
+    }
+
     if (cell.btnstyle) { // 鍏煎
       cell.style = cell.style || {}
       cell.style = {...cell.style, ...cell.btnstyle}
@@ -649,6 +659,11 @@
 
   resetElement = (cell) => {
     cell.style = cell.style || {}
+
+    if (cell.style.display === 'inline-block') {
+      cell.style.verticalAlign = 'top'
+    }
+
     if (['text', 'number', 'formula'].includes(cell.eleType)) {
       if (!cell.height) {
         cell.innerHeight = 'auto'
@@ -748,9 +763,15 @@
       }
 
       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}
           `
         }
@@ -770,20 +791,26 @@
       if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
         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, '').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     // 鍚庣疆鑷畾涔夎剼鏈�
 
-      if (component.setting.laypage) {
-        component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript)
+      component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript)
+
+      if (!component.setting.execute || component.setting.custompage) {
+        component.forbidLine = true
       }
 
       if (component.setting.sync === 'true') {

--
Gitblit v1.8.0