From 7506900639d82442b6def1a15049b5b6a88b44ba Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 27 五月 2022 20:29:33 +0800
Subject: [PATCH] 保存时间限制

---
 src/templates/comtableconfig/index.jsx |  234 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 118 insertions(+), 116 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 07773f6..e0118e9 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -475,141 +475,143 @@
       param.open_edition = openEdition
     }
 
-    // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
-    // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
-    new Promise(resolve => {
-      if (delActions.length > 0) {
-        let deffers = delActions.map(item => {
-          let _param = {
-            func: 'sPC_MainMenu_Del',
-            MenuID: item.card ? item.card.uuid : item.uuid
-          }
-
-          if (item.type === 'action') {
-            let _ParentParam = null
-
-            try {
-              _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
-            } catch (e) {
-              console.warn('Stringify Failure')
-              _ParentParam = null
+    setTimeout(() => {
+      // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
+      // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
+      new Promise(resolve => {
+        if (delActions.length > 0) {
+          let deffers = delActions.map(item => {
+            let _param = {
+              func: 'sPC_MainMenu_Del',
+              MenuID: item.card ? item.card.uuid : item.uuid
             }
 
-            if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽�
-              _param.ParentParam = _ParentParam
-            }
-          }
+            if (item.type === 'action') {
+              let _ParentParam = null
 
-          return new Promise(resolve => {
-            Api.getSystemConfig(_param).then(response => {
-              resolve(response)
+              try {
+                _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
+              } catch (e) {
+                console.warn('Stringify Failure')
+                _ParentParam = null
+              }
+
+              if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽�
+                _param.ParentParam = _ParentParam
+              }
+            }
+
+            return new Promise(resolve => {
+              Api.getSystemConfig(_param).then(response => {
+                resolve(response)
+              })
             })
           })
-        })
-        Promise.all(deffers).then(result => {
-          let error = null
-          result.forEach(response => {
-            if (!response.status) {
-              error = response
+          Promise.all(deffers).then(result => {
+            let error = null
+            result.forEach(response => {
+              if (!response.status) {
+                error = response
+              }
+            })
+
+            if (error) {
+              this.setState({
+                menuloading: false,
+                menucloseloading: false
+              })
+              notification.warning({
+                top: 92,
+                message: error.message,
+                duration: 5
+              })
+              resolve(false)
+            } else {
+              this.setState({
+                delActions: []
+              })
+              resolve(true)
             }
           })
+        } else if (delActions.length === 0) {
+          resolve(true)
+        }
+      }).then(resp => {
+        if (resp === false) return
 
-          if (error) {
+        if (thawButtons.length > 0) {
+          let defers = thawButtons.map(item => {
+            return new Promise((resolve) => {
+              Api.getSystemConfig({
+                func: 'sPC_MainMenu_ReDel',
+                MenuID: item
+              }).then(res => {
+                if (res.status) {
+                  resolve('')
+                } else {
+                  resolve(res.message)
+                }
+              })
+            })
+          })
+
+          return Promise.all(defers)
+        } else {
+          return true
+        }
+      }).then(res => {
+        if (res === true || res === false) return res
+
+        let msg = res.filter(Boolean)[0]
+        if (msg) {
+          notification.warning({
+            top: 92,
+            message: msg,
+            duration: 5
+          })
+          return false
+        } else {
+          this.setState({
+            thawButtons: []
+          })
+          return true
+        }
+      }).then(resp => {
+        if (resp === false) return
+        let localParam = fromJS(param).toJS()
+        Api.getSystemConfig(param).then(response => {
+          if (response.status) {
+            this.setState({
+              config: _config,
+              openEdition: response.open_edition || '',
+              originMenu: fromJS(_config).toJS()
+            }, () => {
+              reload && MKEmitter.emit('revert')
+            })
+
+            localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
+            delete localParam.LongParam
+            delete localParam.PageParam
+            delete localParam.Template
+            delete localParam.Sort
+            delete localParam.EasyCode
+            delete localParam.open_edition
+
+            this.submitAction(btnParam, tabParam, localParam)
+          } else {
             this.setState({
               menuloading: false,
               menucloseloading: false
             })
             notification.warning({
               top: 92,
-              message: error.message,
+              message: response.message,
               duration: 5
             })
-            resolve(false)
-          } else {
-            this.setState({
-              delActions: []
-            })
-            resolve(true)
           }
         })
-      } else if (delActions.length === 0) {
-        resolve(true)
-      }
-    }).then(resp => {
-      if (resp === false) return
-
-      if (thawButtons.length > 0) {
-        let defers = thawButtons.map(item => {
-          return new Promise((resolve) => {
-            Api.getSystemConfig({
-              func: 'sPC_MainMenu_ReDel',
-              MenuID: item
-            }).then(res => {
-              if (res.status) {
-                resolve('')
-              } else {
-                resolve(res.message)
-              }
-            })
-          })
-        })
-
-        return Promise.all(defers)
-      } else {
-        return true
-      }
-    }).then(res => {
-      if (res === true || res === false) return res
-
-      let msg = res.filter(Boolean)[0]
-      if (msg) {
-        notification.warning({
-          top: 92,
-          message: msg,
-          duration: 5
-        })
-        return false
-      } else {
-        this.setState({
-          thawButtons: []
-        })
-        return true
-      }
-    }).then(resp => {
-      if (resp === false) return
-      let localParam = fromJS(param).toJS()
-      Api.getSystemConfig(param).then(response => {
-        if (response.status) {
-          this.setState({
-            config: _config,
-            openEdition: response.open_edition || '',
-            originMenu: fromJS(_config).toJS()
-          }, () => {
-            reload && MKEmitter.emit('revert')
-          })
-
-          localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
-          delete localParam.LongParam
-          delete localParam.PageParam
-          delete localParam.Template
-          delete localParam.Sort
-          delete localParam.EasyCode
-          delete localParam.open_edition
-
-          this.submitAction(btnParam, tabParam, localParam)
-        } else {
-          this.setState({
-            menuloading: false,
-            menucloseloading: false
-          })
-          notification.warning({
-            top: 92,
-            message: response.message,
-            duration: 5
-          })
-        }
       })
-    })
+    }, +sessionStorage.getItem('mkDelay'))
   }
 
   /**

--
Gitblit v1.8.0