From f128d679cacda2a6b5b730ad0368b5fe73f887f7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 14 二月 2025 15:27:02 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/timeline/normal-timeline/index.jsx |   84 +++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 54 deletions(-)

diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
index df3dd7f..9fa4831 100644
--- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
+++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Spin, notification, Timeline, Empty, Modal } from 'antd'
+import { Spin, notification, Timeline, Empty } from 'antd'
 
 import Api from '@/api'
 import MkIcon from '@/components/mk-icon'
@@ -59,7 +59,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'
@@ -77,6 +77,8 @@
   
         window.GLOB.SyncData.delete(_config.dataName)
       }
+    } else if (_config.setting.supModule && !BID) {
+      _config.setting.onload = 'false'
     }
 
     _config.search = []
@@ -99,7 +101,6 @@
       BData: BData || '',
       data: _data,
       config: _config,
-      arr_field: _config.columns.map(col => col.field).join(',')
     })
   }
 
@@ -123,7 +124,7 @@
     if (config.timer) {
       this.timer = new TimerTask()
       this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {
-        this.loadData(true)
+        this.loadData('timer')
       })
     }
 
@@ -150,21 +151,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
 
-            this.setState({data: res.map((item, index) => {
+            this.setState({data: res.data.map((item, index) => {
               item.key = index
               item.$$uuid = item[config.setting.primaryKey] || ''
               item.$Index = index + 1 + ''
@@ -175,10 +176,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
     
-            this.setState({data: res.map((item, index) => {
+            this.setState({data: res.data.map((item, index) => {
               item.key = index
               item.$$uuid = item[config.setting.primaryKey] || ''
               item.$Index = index + 1 + ''
@@ -190,7 +191,7 @@
 
         if (config.setting.onload === 'true') {
           setTimeout(() => {
-            this.loadData()
+            this.loadData('init')
           }, config.setting.delay || 0)
         }
       }
@@ -211,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) => {
@@ -253,8 +254,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()
     }
@@ -300,7 +301,7 @@
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   queryModuleParam = (menuId, callback) => {
-    const { arr_field, config } = this.state
+    const { config } = this.state
 
     if (config.uuid !== menuId) return
 
@@ -310,15 +311,13 @@
     }
 
     callback({
-      arr_field: arr_field,
       orderBy: config.setting.order || '',
-      search: searches,
-      menuName: config.name
+      search: searches
     })
   }
 
-  async loadData (hastimer) {
-    const { config, arr_field, BID, BData } = this.state
+  async loadData (type) {
+    const { config, BID, BData } = this.state
     
     if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
       this.setState({
@@ -343,20 +342,20 @@
       return
     }
 
-    if (!hastimer) {
+    if (type !== 'timer') {
       this.setState({
         loading: true
       })
     }
 
     let _orderBy = config.setting.order || ''
-    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, config.setting.pageSize, BID)
+    let param = UtilsDM.getQueryDataParams(config.setting, searches, _orderBy, 1, config.setting.pageSize, 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 +379,14 @@
         }
       }
 
-      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)
     }
   }
 
@@ -441,7 +417,7 @@
     this.setState({
       loading: true
     })
-    Api.wxNginxRequest(`express/${code}/${order}`, 'get').then(res => {
+    Api.expressRequest(`express/${code}/${order}`).then(res => {
       if (!res || typeof(res) !== 'string') {
         notification.error({
           top: 92,
@@ -562,7 +538,7 @@
     if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null
     
     return (
-      <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}>
+      <div className={'normal-timeline-box ' + (config.wrap.btnControl || '')} id={'anchor' + config.uuid} style={{...config.style}}>
         {loading ?
           <div className="loading-mask">
             {data ? <div className="ant-spin-blur"></div> : null}

--
Gitblit v1.8.0