From 4d6b9f8a2d7b316633e43b489eae9ada949c07b5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 10 九月 2024 10:18:08 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/index.jsx |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 23526d4..88009a6 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -3,6 +3,7 @@
 import { is, fromJS } from 'immutable'
 import { notification, Spin, Row, Col, Modal } from 'antd'
 import moment from 'moment'
+import md5 from 'md5'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -219,6 +220,21 @@
 
       window.GLOB.CacheData.set(MenuID, urlparam)
 
+      if (window.backend && config.allSqls) {
+        let keys = Object.keys(urlparam)
+        config.allSqls.forEach(item => {
+          item.id = md5(window.GLOB.appkey + item.v_id)
+          if (item.type === 'datasource' || item.type === 'excelOut') {
+            item.urlkeys = keys
+            item.urlparam = urlparam
+            if (config.flow_code) {
+              item.works_flow_code = config.flow_code
+            }
+          }
+          window.GLOB.CacheData.set('sql_' + item.uuid, item)
+        })
+      }
+
       let userName = sessionStorage.getItem('User_Name') || ''
       let fullName = sessionStorage.getItem('Full_Name') || ''
 
@@ -285,7 +301,7 @@
         }
       })
 
-      config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap)
+      config.components = this.formatSetting(config.components, params, inherit, config.interfaces, balMap, tbMap, BID)
 
       if (initInters.length > 0) {
         this.stepInter = {
@@ -680,6 +696,7 @@
 
         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
@@ -698,6 +715,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
@@ -908,7 +928,7 @@
 
           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'
@@ -1126,18 +1146,18 @@
   }
 
   // 鏍煎紡鍖栭粯璁よ缃�
-  formatSetting = (components, params, inherit, interfaces, balMap, tbMap) => {
+  formatSetting = (components, params, inherit, interfaces, 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, inherit, interfaces, balMap, tbMap)
+          tab.components = this.formatSetting(tab.components, null, inherit, interfaces, balMap, tbMap, BID)
           tab = {...tab, ...inherit}
           return tab
         })
         return component
       } else if (component.type === 'group') {
-        component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap)
+        component.components = this.formatSetting(component.components, params, null, interfaces, balMap, tbMap, BID)
         return component
       }
 
@@ -1212,6 +1232,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)
@@ -1233,7 +1255,17 @@
             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))
+            }
           }
         }
       }
@@ -1287,6 +1319,8 @@
       inter.setting.arr_field = inter.columns.map(col => col.field).join(',')
 
       if (inter.setting.interType !== 'system') return inter
+
+      inter.setting.uuid = inter.uuid
 
       let _customScript = ''
       let _tailScript = ''
@@ -1349,7 +1383,7 @@
     this.setState({loading: true, loadingview: false})
 
     if (config.$cache && config.$time) {
-      Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => {
+      Api.getLCacheConfig(params[0].uuid || params[0].id, config.$time, BID).then(res => {
         if (!res.valid) {
           this.getMainData(param, params, config.MenuID)
         } else {
@@ -1385,11 +1419,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', MenuID)

--
Gitblit v1.8.0