From a94b0a4d15b26ecf8fe99f0a1c3e60d60b97766d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 15 八月 2023 14:22:03 +0800
Subject: [PATCH] 2023-08-15

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index af23f19..9b114c1 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -215,15 +215,15 @@
       if (config.$time && !setting.laypage) {
         if (!this.loaded) {
           Api.getLCacheConfig(config.uuid, config.$time).then(res => {
-            if (!res && config.setting.onload === 'true') {
+            if (!res.valid && config.setting.onload === 'true') {
               setTimeout(() => {
-                this.loadmaindata()
+                this.loadmaindata(false, 'true', '', '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.$$key = '' + item.key + item.$$uuid
@@ -250,9 +250,9 @@
       } else {
         if (!this.loaded) {
           Api.getLCacheConfig(config.uuid, 0).then(res => {
-            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.$$key = '' + item.key + item.$$uuid
@@ -279,7 +279,7 @@
 
         if (config.setting.onload === 'true') {
           setTimeout(() => {
-            this.loadmaindata()
+            this.loadmaindata(false, 'true', '', 'init')
             this.getStatFieldsValue()
           }, config.setting.delay || 0)
         }
@@ -400,7 +400,7 @@
     let result = await Api.genericInterface(param)
     if (result.status) {
       this.loaded = true
-      if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') {
+      if (config.$cache && type === 'init') {
         Api.writeCacheConfig(config.uuid, result.data || [])
       }
 
@@ -549,8 +549,7 @@
       let data = fromJS(this.state.data).toJS()
       let selectedData = fromJS(this.state.selectedData).toJS()
 
-      if (!result.data) {
-      // if (result.data && result.data[0]) {
+      if (result.data && result.data[0]) {
         let _data = result.data[0]
         _data.$$uuid = _data[setting.primaryKey] || ''
         _data.$$BID = BID || ''

--
Gitblit v1.8.0