From 004176924ce35c96600f5c18e85478944de8bec6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 14 一月 2023 16:46:50 +0800
Subject: [PATCH] 2023-01-14

---
 src/tabviews/custom/components/tree/antd-tree/index.jsx |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx
index a5ec5fe..a8f6605 100644
--- a/src/tabviews/custom/components/tree/antd-tree/index.jsx
+++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -107,7 +107,7 @@
   }
 
   componentDidMount () {
-    const { config } = this.state
+    const { config, sync } = this.state
 
     MKEmitter.addListener('reloadData', this.reloadData)
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
@@ -116,6 +116,16 @@
       this.timer = new TimerTask()
       this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {
         this.loadData(true)
+      })
+    }
+
+    if (config.$cache && (config.setting.sync !== 'true' || sync)) {
+      Api.getLCacheConfig(config.uuid).then(res => {
+        if (!res) return
+
+        this.setState({data: res}, () => {
+          this.handleData()
+        })
       })
     }
   }
@@ -186,6 +196,10 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
+      if (config.$cache) {
+        Api.writeCacheConfig(config.uuid, result.data || '')
+      }
+
       this.setState({
         data: result.data,
         loading: false

--
Gitblit v1.8.0