From cdd5b449130ea4d7223fde4f414a11a7d0c33d6d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 07 三月 2024 17:52:16 +0800
Subject: [PATCH] 2024-03-07

---
 src/tabviews/custom/components/table/edit-table/index.jsx |   45 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index bcc54c6..14776ec 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -113,10 +113,6 @@
             item.type = 'text'
           }
 
-          if (item.marks && item.marks.length === 0) {
-            item.marks = ''
-          }
-
           if (item.editable === 'true') {
             setting.hasSubmit = setting.commit !== 'change'
             item.$ctrl = setting.commit === 'change'
@@ -275,9 +271,12 @@
       this.setState({
         data: [],
         selectedData: [],
+        loading: false,
         total: 0
       })
       reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 鍒楄〃閲嶇疆
+
+      this.requestId = ''
       return
     }
 
@@ -303,8 +302,12 @@
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID)
 
-    let result = await Api.genericInterface(param)
+    this.requestId = config.uuid + new Date().getTime()
+
+    let result = await Api.genericInterface(param, '', '', this.requestId)
     if (result.status) {
+      if (result.$requestId && this.requestId !== result.$requestId) return
+      
       reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆
 
       let start = 1
@@ -388,7 +391,7 @@
   /**
    * @description 鑾峰彇鍗曡鏁版嵁
    */ 
-  async loadmainLinedata (id) {
+  async loadLinedata (id, position) {
     const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state
 
     if (config.forbidLine) {
@@ -416,11 +419,25 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
+      if (position === 'line_grid' && (!result.data || !result.data[0])) {
+        this.loadmaindata(true, 'false')
+        return
+      }
+
       if (!result.data || !result.data[0]) {
+        let data = fromJS(this.state.data).toJS()
+        let selectedData = fromJS(this.state.selectedData).toJS()
+
+        data = data.filter(item => item.$$uuid !== id)
+        selectedData = selectedData.filter(item => item.$$uuid !== id)
+
+        MKEmitter.emit('transferData' + setting.tableId, id, 'delete')
+
         this.setState({
+          data,
+          selectedData,
           loading: false
         })
-
         return
       }
 
@@ -560,7 +577,7 @@
     if (!id) {
       this.reloadtable()
     } else {
-      this.loadmainLinedata(id)
+      this.loadLinedata(id)
     }
   }
 
@@ -574,9 +591,11 @@
         BID: id,
         BData: data
       }, () => {
-        setTimeout(() => {
-          this.loadmaindata(true, 'true')
-        }, setting.delay || 0)
+        if (!setting.checkBid) {
+          setTimeout(() => {
+            this.loadmaindata(true, 'true')
+          }, setting.delay || 0)
+        }
       })
     }
   }
@@ -592,9 +611,9 @@
 
     if (config.uuid !== menuId) return
 
-    if (position === 'line') {
+    if (position === 'line' || position === 'line_grid') {
       if (lines && lines.length === 1) {
-        this.loadmainLinedata(lines[0].$$uuid)
+        this.loadLinedata(lines[0].$$uuid, position)
       } else {
         this.reloadtable(btn)
       }

--
Gitblit v1.8.0