From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 四月 2025 12:18:03 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/carousel/data-card/index.jsx |   81 +++++++++++++++-------------------------
 1 files changed, 30 insertions(+), 51 deletions(-)

diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx
index 06dc320..8fabea1 100644
--- a/src/tabviews/custom/components/carousel/data-card/index.jsx
+++ b/src/tabviews/custom/components/carousel/data-card/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Spin, Empty, notification, Carousel, Modal, Checkbox, Button } from 'antd'
+import { Spin, Empty, Carousel, Modal, Checkbox, Button } from 'antd'
 import { LeftOutlined, RightOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
@@ -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'
@@ -74,6 +74,8 @@
   
         window.GLOB.SyncData.delete(_config.dataName)
       }
+    } else if (_config.setting.supModule && !BID) {
+      _config.setting.onload = 'false'
     }
 
     if (_card.setting.click) {
@@ -82,8 +84,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 +96,7 @@
       BID: BID || '',
       BData: BData || '',
       config: _config,
-      card: _card,
-      arr_field: _config.columns.map(col => col.field).join(',')
+      card: _card
     })
   }
 
@@ -142,21 +143,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 + ''
@@ -166,13 +167,15 @@
     
             this.setState({data: _data})
           })
+        } else {
+          this.openModal()
         }
       } 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 + ''
@@ -186,7 +189,7 @@
 
         if (config.setting.onload === 'true') {
           setTimeout(() => {
-            this.loadData()
+            this.loadData('init')
           }, config.setting.delay || 0)
         } else if (this.loaded) {
           this.openModal()
@@ -211,7 +214,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) => {
@@ -281,8 +284,8 @@
 
     if (config.uuid !== menuId) return
 
-    if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠�
-      MKEmitter.emit('reloadData', config.setting.supModule, BID)
+    if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
+      MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
     } else {
       this.loadData()
     }
@@ -303,7 +306,7 @@
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   queryModuleParam = (menuId, callback) => {
-    const { arr_field, config } = this.state
+    const { config } = this.state
 
     if (config.uuid !== menuId) return
 
@@ -313,15 +316,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({
@@ -349,13 +350,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) => {
@@ -380,37 +381,15 @@
           this.timer && this.timer.stop()
         }
       }
-      if (result.message) {
-        if (result.ErrCode === 'Y') {
-          Modal.success({
-            title: result.message
-          })
-        } else if (result.ErrCode === 'S') {
-          notification.success({
-            top: 92,
-            message: result.message,
-            duration: 2
-          })
-        }
-      }
+      
+      UtilsDM.querySuccess(result)
     } else {
       this.setState({
         loading: false
       })
       this.timer && this.timer.stop()
       
-      if (!result.message) return
-      if (result.ErrCode === 'N') {
-        Modal.error({
-          title: result.message,
-        })
-      } else if (result.ErrCode !== '-2') {
-        notification.error({
-          top: 92,
-          message: result.message,
-          duration: 10
-        })
-      }
+      UtilsDM.queryFail(result)
     }
   }
 

--
Gitblit v1.8.0