From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/tabviews/custom/components/carousel/data-card/index.jsx |   43 ++++++++++++++++++++-----------------------
 1 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx
index f83040f..45a3656 100644
--- a/src/tabviews/custom/components/carousel/data-card/index.jsx
+++ b/src/tabviews/custom/components/carousel/data-card/index.jsx
@@ -56,7 +56,7 @@
         _data = window.GLOB.SyncData.get(_config.dataName) || []
   
         if (_config.$cache) {
-          Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS())
+          Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS(), BID)
         }
   
         _config.setting.sync = 'false'
@@ -82,8 +82,8 @@
 
     if (!_config.wrap.height) { // 鍏煎
       _config.wrap.height = _config.style.height || '300px'
-      delete _config.style.height
     }
+    delete _config.style.height
 
     _card.style.height = _config.wrap.height
 
@@ -94,8 +94,7 @@
       BID: BID || '',
       BData: BData || '',
       config: _config,
-      card: _card,
-      arr_field: _config.columns.map(col => col.field).join(',')
+      card: _card
     })
   }
 
@@ -142,21 +141,21 @@
   }
 
   initExec = () => {
-    const { config } = this.state
+    const { config, BID } = this.state
 
     if (config.$cache) {
       if (config.$time) {
         if (!this.loaded) {
-          Api.getLCacheConfig(config.uuid, config.$time).then(res => {
-            if (!res && config.setting.onload === 'true') {
+          Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => {
+            if (!res.valid && config.setting.onload === 'true') {
               setTimeout(() => {
-                this.loadData()
+                this.loadData('init')
               }, config.setting.delay || 0)
             }
   
-            if (!res || this.loaded) return
+            if (!res.data || this.loaded) return
 
-            let _data = res.map((item, index) => {
+            let _data = res.data.map((item, index) => {
               item.key = index
               item.$$uuid = item[config.setting.primaryKey] || ''
               item.$Index = index + 1 + ''
@@ -171,10 +170,10 @@
         }
       } else {
         if (!this.loaded) {
-          Api.getLCacheConfig(config.uuid, 0).then(res => {
-            if (!res || this.loaded) return
+          Api.getLCacheConfig(config.uuid, 0, BID).then(res => {
+            if (!res.data || this.loaded) return
     
-            let _data = res.map((item, index) => {
+            let _data = res.data.map((item, index) => {
               item.key = index
               item.$$uuid = item[config.setting.primaryKey] || ''
               item.$Index = index + 1 + ''
@@ -188,7 +187,7 @@
 
         if (config.setting.onload === 'true') {
           setTimeout(() => {
-            this.loadData()
+            this.loadData('init')
           }, config.setting.delay || 0)
         } else if (this.loaded) {
           this.openModal()
@@ -213,7 +212,7 @@
     let _data = window.GLOB.SyncData.get(config.dataName) || []
 
     if (config.$cache) {
-      Api.writeCacheConfig(config.uuid, fromJS(_data).toJS())
+      Api.writeCacheConfig(config.uuid, fromJS(_data).toJS(), BID)
     }
 
     _data = _data.map((item, index) => {
@@ -305,7 +304,7 @@
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   queryModuleParam = (menuId, callback) => {
-    const { arr_field, config } = this.state
+    const { config } = this.state
 
     if (config.uuid !== menuId) return
 
@@ -315,15 +314,13 @@
     }
 
     callback({
-      arr_field: arr_field,
       orderBy: config.setting.order || '',
-      search: searches,
-      menuName: config.name
+      search: searches
     })
   }
 
   async loadData (type) {
-    const { config, arr_field, BID, BData } = this.state
+    const { config, BID, BData } = this.state
 
     if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
       this.setState({
@@ -351,13 +348,13 @@
     }
 
     let _orderBy = config.setting.order || ''
-    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID)
+    let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, '', '', BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
       this.loaded = true
-      if (config.$cache && config.setting.onload !== 'false') {
-        Api.writeCacheConfig(config.uuid, result.data || [])
+      if (config.$cache && type === 'init') {
+        Api.writeCacheConfig(config.uuid, result.data || [], BID)
       }
 
       let data = result.data.map((item, index) => {

--
Gitblit v1.8.0