From dce3eca3dc273be7a5bd66094b840bb6c4f763c0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 21 十一月 2021 14:09:44 +0800
Subject: [PATCH] 2021-11-21

---
 src/templates/sharecomponent/columncomponent/index.jsx |    8 ++++++++
 src/templates/sharecomponent/actioncomponent/index.jsx |    8 ++++++++
 src/templates/calendarconfig/index.jsx                 |    5 +++++
 src/templates/comtableconfig/index.jsx                 |    8 ++++++--
 src/templates/subtableconfig/index.jsx                 |    7 +++++--
 src/templates/sharecomponent/searchcomponent/index.jsx |    6 ++++++
 6 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx
index ce34dfd..e63eef9 100644
--- a/src/templates/calendarconfig/index.jsx
+++ b/src/templates/calendarconfig/index.jsx
@@ -10,6 +10,7 @@
 import Api from '@/api'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
+import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -352,6 +353,8 @@
       // }
       resolve()
     }).then(() => {
+      let reload = _config.isAdd
+
       // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
       delete _config.type
       delete _config.isAdd
@@ -430,6 +433,8 @@
             config: _config,
             openEdition: response.open_edition || '',
             originMenu: fromJS(_config).toJS()
+          }, () => {
+            reload && MKEmitter.emit('revert')
           })
 
           this.props.reloadmenu()
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 11d6a3f..9481ddd 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -10,6 +10,7 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
+import MKEmitter from '@/utils/events.js'
 import { updateCommonTable } from '@/utils/utils-update.js'
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
@@ -307,11 +308,12 @@
       })
     }
 
+    let _LongParam = ''
+    let reload = _config.isAdd
+
     // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
     delete _config.type
     delete _config.isAdd
-
-    let _LongParam = ''
 
     try {
       _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
@@ -531,6 +533,8 @@
             config: _config,
             openEdition: response.open_edition || '',
             originMenu: fromJS(_config).toJS()
+          }, () => {
+            reload && MKEmitter.emit('revert')
           })
 
           localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx
index abfa8a0..f1b2953 100644
--- a/src/templates/sharecomponent/actioncomponent/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/index.jsx
@@ -58,7 +58,14 @@
 
   componentDidMount () {
     this.getBillPrintTemp()
+    MKEmitter.addListener('revert', this.revert)
     MKEmitter.addListener('pasteButton', this.pasteButton)
+  }
+
+  revert = () => {
+    this.setState({
+      actionlist: fromJS(this.props.config.action).toJS()
+    })
   }
 
   pasteButton = (MenuId, btn) => {
@@ -847,6 +854,7 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('revert', this.revert)
     MKEmitter.removeListener('pasteButton', this.pasteButton)
   }
 
diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx
index 357dfd8..ac3da97 100644
--- a/src/templates/sharecomponent/columncomponent/index.jsx
+++ b/src/templates/sharecomponent/columncomponent/index.jsx
@@ -469,11 +469,18 @@
     })
   }
 
+  revert = () => {
+    this.setState({
+      columnlist: fromJS(this.props.config.columns).toJS()
+    })
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
   }
 
   componentDidMount () {
+    MKEmitter.addListener('revert', this.revert)
     MKEmitter.addListener('plusColumns', this.plusColumns)
   }
 
@@ -484,6 +491,7 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('revert', this.revert)
     MKEmitter.removeListener('plusColumns', this.plusColumns)
   }
 
diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx
index 5179021..18643d9 100644
--- a/src/templates/sharecomponent/searchcomponent/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/index.jsx
@@ -62,6 +62,11 @@
 
   componentDidMount () {
     MKEmitter.addListener('plusSearch', this.plusSearch)
+    MKEmitter.addListener('revert', this.revert)
+  }
+
+  revert = () => {
+    this.setState({searchlist: fromJS(this.props.config.search).toJS()})
   }
 
   plusSearch = (MenuId, item, type) => {
@@ -312,6 +317,7 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('revert', this.revert)
     MKEmitter.removeListener('plusSearch', this.plusSearch)
   }
 
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index beed453..b4a6ebc 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -12,6 +12,7 @@
 import zhCN from '@/locales/zh-CN/model.js'
 import enUS from '@/locales/en-US/model.js'
 import Utils from '@/utils/utils.js'
+import MKEmitter from '@/utils/events.js'
 import { updateSubTable } from '@/utils/utils-update.js'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -292,11 +293,12 @@
       })
     }
 
+    let _LongParam = ''
+    let reload = _config.isAdd
+
     // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
     delete _config.type
     delete _config.isAdd
-
-    let _LongParam = ''
 
     try {
       _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
@@ -473,6 +475,7 @@
             config: _config,
             originConfig: fromJS(_config).toJS()
           }, () => {
+            reload && MKEmitter.emit('revert')
             this.setState({
               menuloading: false,
               menucloseloading: false

--
Gitblit v1.8.0