From 92664ef80a97a63fde223b14097ccda3ae6ff183 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 24 四月 2025 14:31:57 +0800
Subject: [PATCH] Merge branch 'positec' into dms

---
 src/tabviews/custom/popview/index.jsx |   82 +++++++++++++++++++++++++++++++++--------
 1 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index 1b097d4..57a2d3f 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -156,7 +156,7 @@
     let params = []
     let BID = urlparam.$BID || ''
 
-    config.components = this.formatSetting(config.components, params, balMap, tbMap)
+    config.components = this.formatSetting(config.components, params, balMap, tbMap, BID)
 
     this.setState({
       BID: BID,
@@ -414,9 +414,16 @@
 
         if (item.hasExtend) {
           item.setting.hasExtend = true
+          item.setting.sync = 'false'
           item.setting.tableMode = 'compatible'
           item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss')
           item.colsCtrls = null
+        }
+
+        if (item.wrap.tree === 'true') {
+          item.setting.sync = 'false'
+          item.$cache = false
+          item.setting.$tree = true
         }
 
         if (item.subtype === 'editable') {
@@ -432,6 +439,9 @@
           }
         }
       } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
+        if (item.wrap.datatype === 'public') {
+          balMap.set(item.wrap.publicId + 'public', true)
+        }
         item.subcards && item.subcards.forEach(card => {
           if (card.style.boxShadow) {
             delete card.style.hShadow
@@ -527,6 +537,13 @@
 
           group.subButton = this.resetButton(item, group.subButton, Tab)
 
+          if (group.subButton.linkmenu) {
+            if (Array.isArray(group.subButton.linkmenu) && group.subButton.linkmenu.length > 0) {
+              group.subButton.openmenu = group.subButton.linkmenu
+            }
+            delete group.subButton.linkmenu
+          }
+
           group.fields = group.fields.map(cell => {
             // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗�
             if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') {
@@ -585,12 +602,9 @@
           delete item.scripts
           item.setting.$name = item.$menuname || ''
           item.setting.execute = item.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
-          
+
           if (!item.setting.execute) {
             item.setting.dataresource = ''
-          }
-          if (/\s/.test(item.setting.dataresource)) {
-            item.setting.dataresource = '(' + item.setting.dataresource + ') tb'
           }
       
           if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
@@ -611,16 +625,25 @@
 
           item.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
           item.setting.tailScript = _tailScript     // 鍚庣疆鑷畾涔夎剼鏈�
+          item.setting.custompage = false
 
-          item.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)
+          if (/order\s+by\s+sort_id\s*$/i.test(item.setting.dataresource)) {
+            item.setting.custompage = true
+          } else if (item.setting.$tree || /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)) {
+            item.setting.custompage = true
+          }
 
+          if (/\s/.test(item.setting.dataresource)) {
+            item.setting.dataresource = '(' + item.setting.dataresource + ') tb'
+          }
+          
           if (!item.setting.execute || item.setting.custompage) {
             item.forbidLine = true
           }
 
           if (item.setting.sync === 'true') {
             // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
-            if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true') {
+            if ((!item.pageable || (item.pageable && !item.setting.laypage)) && item.setting.onload === 'true' && !_tailScript) {
 
             } else {
               item.setting.sync = 'false'
@@ -668,12 +691,13 @@
     if (cell.OpenType === 'excelOut') { // 瀵煎嚭
       cell.$menuName = item.$menuname
     } else if (cell.OpenType === 'pop' && cell.modal) {
-      cell.modal.uuid = cell.uuid + 'pop'
+      cell.modal.uuid = cell.uuid + '_pop'
     }
 
     if (cell.verify) {
+      let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')
       if (cell.verify.invalid === 'true') {
-        if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) {
+        if (isStatic) {
           cell.verify.invalid = 'false'
         } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) {
           cell.verify.invalid = 'false'
@@ -684,6 +708,10 @@
         } else if (cell.Ot === 'notRequired') {
           cell.verify.invalid = 'false'
         }
+      }
+
+      if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) {
+        cell.verify.uniques = []
       }
 
       if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) {
@@ -703,12 +731,20 @@
         }
         if (/#position-inner/.test(script)) {
           cell.$innerScript = script
+
+          if (window.backend && window.GLOB.CacheData.has('sql_' + cell.uuid) && !/\$backend/.test(script)) {
+            window.GLOB.CacheData.delete('sql_' + cell.uuid)
+          }
         }
         if (/#position-outer/.test(script)) {
           cell.$outerScript = script
         }
         if (/#position-callback/.test(script)) {
           cell.$callbackScript = script
+
+          if (window.backend && window.GLOB.CacheData.has('sql_back_' + cell.uuid) && !/\$backend/.test(script)) {
+            window.GLOB.CacheData.delete('sql_back_' + cell.uuid)
+          }
         }
       }
     }
@@ -721,6 +757,7 @@
         }
       } else if (cell.syncComponentId === 'multiComponent') {
         let ids = cell.syncComponents.map(m => {
+          if (Array.isArray(m)) return m.pop() || ''
           return m.syncComId.pop() || ''
         })
 
@@ -809,17 +846,17 @@
   }
 
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatSetting = (components, params, balMap, tbMap) => {
+  formatSetting = (components, params, balMap, tbMap, BID) => {
     let delay = 20
     return components.map(component => {
       if (component.type === 'tabs') {
         component.subtabs = component.subtabs.map(tab => {
-          tab.components = this.formatSetting(tab.components, null, balMap, tbMap)
+          tab.components = this.formatSetting(tab.components, null, balMap, tbMap, BID)
           return tab
         })
         return component
       } else if (component.type === 'group') {
-        component.components = this.formatSetting(component.components, params, balMap, tbMap)
+        component.components = this.formatSetting(component.components, params, balMap, tbMap, BID)
         return component
       }
 
@@ -886,6 +923,8 @@
 
       if (component.setting.interType !== 'system') return component
 
+      component.setting.uuid = component.uuid
+      
       // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
       if (component.setting.sync === 'true') {
         component.dataName = 'mk' + component.uuid.slice(-18)
@@ -907,12 +946,23 @@
             component.setting.sync = 'false'
             component.setting.onload = 'false'
           } else {
-            params.push(getStructDefaultParam(component, searchlist, params.length === 0))
+            let backend = false
+            if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + component.uuid)) {
+              backend = true
+            } else if (window.backend && params[0] && params[0].exps) {
+              backend = true
+            }
+
+            if (backend && !window.GLOB.CacheData.has('sql_' + component.uuid)) {
+              component.setting.sync = 'false'
+            } else {
+              params.push(getStructDefaultParam(component, searchlist, params.length === 0, BID))
+            }
           }
         }
       }
 
-      component.setting.delay = delay
+      component.setting.delay = delay + (component.setting.delay || 0)
       delay += 20
 
       return component
@@ -950,11 +1000,11 @@
         }
 
         params.forEach((item) => {
-          let _data = result[item.name] || ''
+          let _data = result[item.dataName] || ''
           if (_data && !Array.isArray(_data)) {
             _data = [_data]
           }
-          window.GLOB.SyncData.set(item.name, _data)
+          window.GLOB.SyncData.set(item.dataName, _data)
         })
 
         MKEmitter.emit('transferSyncData', Tab.uuid)

--
Gitblit v1.8.0