From 7bd04b1c21a59e8d79325f247bdb1726507b51fb Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 13 八月 2024 18:51:20 +0800
Subject: [PATCH] 2024-08-13

---
 src/tabviews/custom/components/table/edit-table/index.jsx |   55 ++++++++++++++++++++++++++-----------------------------
 1 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index 30e10ab..c3cdecd 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -225,7 +225,7 @@
     }, () => {
       if (_config.setting.onload === 'true') {
         setTimeout(() => {
-          this.loadmaindata()
+          this.loadData()
         }, _config.setting.delay || 0)
       }
     })
@@ -421,10 +421,8 @@
 
   /**
    * @description 涓昏〃鏁版嵁鍔犺浇
-   * @param { Boolean } reset  琛ㄦ牸鏄惁閲嶇疆
-   * @param { String }  repage 琛ㄦ牸鏄惁閲嶇疆椤电爜
    */
-  async loadmaindata (reset, repage) {
+  async loadData (reset, repage) {
     const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
     if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
@@ -530,11 +528,6 @@
    */ 
   async loadLinedata (id, position) {
     const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
-
-    if (config.forbidLine) {
-      this.reloadtable()
-      return
-    }
     
     let searches = fromJS(search).toJS()
     if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢
@@ -557,7 +550,7 @@
     let result = await Api.genericInterface(param)
     if (result.status) {
       if (position === 'line_grid' && (!result.data || !result.data[0])) {
-        this.loadmaindata(true, 'false')
+        this.reloadIndex()
         return
       }
 
@@ -652,7 +645,7 @@
       pageIndex: 1,
       search: searches
     }, () => {
-      this.loadmaindata(true, 'true')
+      this.loadData(true, 'true')
     })
   }
 
@@ -673,23 +666,19 @@
       pageSize: pagination.pageSize,
       orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
     }, () => {
-      this.loadmaindata()
+      this.loadData()
     })
   }
 
   /**
    * @description 琛ㄦ牸鍒锋柊
    */
-  reloadtable = (btn) => {
-    if (!btn || btn.resetPageIndex !== 'false') {
-      this.setState({
-        pageIndex: 1
-      }, () => {
-        this.loadmaindata(true, 'true')
-      })
-    } else {
-      this.loadmaindata(true, 'false')
-    }
+  reloadIndex = () => {
+    this.setState({
+      pageIndex: 1
+    }, () => {
+      this.loadData(true, 'true')
+    })
   }
 
   /**
@@ -723,7 +712,9 @@
     if (config.uuid !== menuId) return
 
     if (!id) {
-      this.reloadtable()
+      this.reloadIndex()
+    } else if (config.forbidLine) {
+      this.loadData(true, 'false')
     } else {
       this.loadLinedata(id)
     }
@@ -745,7 +736,7 @@
       }, () => {
         if (!setting.checkBid) {
           setTimeout(() => {
-            this.loadmaindata(true, 'true')
+            this.loadData(true, 'true')
           }, setting.delay || 0)
         }
       })
@@ -764,15 +755,21 @@
     if (config.uuid !== menuId) return
 
     if (position === 'line' || position === 'line_grid') {
-      if (lines && lines.length === 1 && !config.forbidLine) {
-        this.loadLinedata(lines[0].$$uuid, position)
+      if (lines && lines.length === 1) {
+        if (config.forbidLine) {
+          this.loadData(true, 'false')
+        } else {
+          this.loadLinedata(lines[0].$$uuid, position)
+        }
       } else {
-        this.reloadtable(btn)
+        this.loadData(true, 'false')
       }
     } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) {
       MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID)
+    } else if (btn.resetPageIndex !== 'false') {
+      this.reloadIndex()
     } else {
-      this.reloadtable(btn)
+      this.loadData(true, 'false')
     }
   }
 
@@ -805,7 +802,7 @@
 
     if (config.$searchId !== searchId) return
     
-    this.reloadtable()
+    this.reloadIndex()
   }
 
   shouldComponentUpdate (nextProps, nextState) {

--
Gitblit v1.8.0