From 169f6cd29a0d3add4fe2cf35c3579b45fa83c0d4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 14 十一月 2023 00:02:45 +0800
Subject: [PATCH] 2023-11-14

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   78 +++++++++++++++++++++++---------------
 1 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index ed634a0..fcdad35 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -1345,6 +1345,7 @@
   timer = null
   focusId = ''
   blurId = ''
+  colId = ''
 
   UNSAFE_componentWillMount () {
     const { setting, fields, columns, BID, colsCtrls } = this.props
@@ -1389,7 +1390,7 @@
               if (item.resourceType === '1') {
                 let _option = Utils.getSelectQueryOptions(item)
   
-                if (/@BID@/ig.test(_option.sql)) {
+                if (/@BID@/ig.test(_option.sql) && setting.supModule) {
                   hasBid = true
                 }
         
@@ -1490,14 +1491,11 @@
       pageOptions,
       columns: _columns,
       tableId: setting.tableId,
-      orderfields
+      orderfields,
+      deForms: hasBid ? deForms : null
     }, () => {
-      if (deForms.length > 0) {
-        if (hasBid && setting.supModule && !BID) {
-          this.setState({ deForms })
-        } else {
-          this.improveActionForm(deForms, BID)
-        }
+      if (deForms.length > 0 && (!hasBid || BID)) {
+        this.improveActionForm(deForms, BID)
       }
     })
   }
@@ -1565,8 +1563,9 @@
     }, 150)
   }
 
-  colFocus = (lineId) => {
+  colFocus = (lineId, colId) => {
     this.focusId = lineId
+    this.colId = colId
   }
 
   checkLine = () => {
@@ -1708,9 +1707,11 @@
   }
 
   transferData = (data, type) => {
-    const { edData } = this.state
+    const { edData, tableId } = this.state
 
-    if (type === 'line') {
+    if (type === 'delete') {
+
+    } else if (type === 'line') {
       let value = ''
       Object.keys(data).sort().forEach(key => {
         if (/^\$/.test(key)) return
@@ -1728,14 +1729,18 @@
       })
     }
 
-    if (type !== 'line') {
-      let index = edData.findIndex(item => !item.$origin && !item.$forbid)
+    if (type === 'delete') {
+      let _edData = this.state.edData.filter(item => item.$$uuid !== data)
 
-      if (index > -1) {
-        this.setState({visible: true, midData: data})
-      } else {
-        this.updateMutil(data)
-      }
+      this.setState({edData: _edData, reseting: true}, () => {
+        this.setState({reseting: false})
+
+        if (this.focusId) {
+          setTimeout(() => {
+            MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId)
+          }, 10)
+        }
+      })
     } else if (type === 'line') {
       let _edData = this.state.edData.map(item => {
         if (item.$$uuid === data.$$uuid) {
@@ -1747,7 +1752,21 @@
 
       this.setState({edData: _edData, reseting: true}, () => {
         this.setState({reseting: false})
+
+        if (this.focusId) {
+          setTimeout(() => {
+            MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId)
+          }, 10)
+        }
       })
+    } else {
+      let index = edData.findIndex(item => !item.$origin && !item.$forbid)
+
+      if (index > -1) {
+        this.setState({visible: true, midData: data})
+      } else {
+        this.updateMutil(data)
+      }
     }
   }
 
@@ -1793,12 +1812,9 @@
   }
 
   improveActionForm = (deForms, BID) => {
-    const { setting } = this.props
-
     let deffers = []
     let mainItems = []  // 浜戠鎴栧崟鐐规暟鎹�
     let localItems = [] // 鏈湴鏁版嵁
-    let cache = setting.cache !== 'false'
     let debug = window.GLOB.debugger === true
     let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
     let _sso = _sql
@@ -1850,7 +1866,7 @@
 
       deffers.push(
         new Promise(resolve => {
-          Api.getSystemCacheConfig(param, cache).then(res => {
+          Api.getSystemCacheConfig(param, false).then(res => {
             if (!res.status) {
               notification.warning({
                 top: 92,
@@ -1885,7 +1901,7 @@
 
       deffers.push(
         new Promise(resolve => {
-          Api.getSystemCacheConfig(mainparam, cache).then(res => {
+          Api.getSystemCacheConfig(mainparam, false).then(res => {
             if (!res.status) {
               notification.warning({
                 top: 92,
@@ -2304,9 +2320,9 @@
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
-          this.execSuccess(res)
+          this.execSuccess(res, record)
         } else {
-          this.execError(res)
+          this.execError(res, record)
         }
       }, (error) => {
         if (error && error.ErrCode === 'LoginError') return
@@ -2323,9 +2339,9 @@
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
-          this.execSuccess(res)
+          this.execSuccess(res, record)
         } else {
-          this.execError(res)
+          this.execError(res, record)
         }
       }, (error) => {
         if (error && error.ErrCode === 'LoginError') return
@@ -2335,7 +2351,7 @@
     }
   }
 
-  execSuccess = (res) => {
+  execSuccess = (res, record) => {
     const { submit } = this.props
     const { edData } = this.state
 
@@ -2385,13 +2401,13 @@
     }
 
     if (submit.execSuccess !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit)
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit, '', record ? [record] : null)
     }
 
     submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId)
   }
 
-  execError = (res) => {
+  execError = (res, record) => {
     const { submit } = this.props
 
     if (res.ErrCode === 'E') {
@@ -2420,7 +2436,7 @@
     })
 
     if (submit.execError !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit)
+      MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null)
     }
   }
 

--
Gitblit v1.8.0