From d4c2669215ef211e52496e69a89010a9b545e04a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 06 九月 2021 19:06:28 +0800
Subject: [PATCH] 2021-09-06

---
 src/templates/modalconfig/index.jsx |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 97a26bb..ba2dcdc 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -25,6 +25,7 @@
 const { confirm } = Modal
 const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
 
+const Versions = asyncComponent(() => import('@/menu/versions'))
 const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
 const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform'))
 const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
@@ -600,9 +601,63 @@
     })
   }
 
-  render () {
-    const { config, dict } = this.state
+  refreshConfig = () => {
+    const { editAction } = this.props
+    
+    let param = {
+      func: 'sPC_Get_LongParam',
+      MenuID: editAction.uuid
+    }
 
+    Api.getSystemConfig(param).then(res => {
+      if (res.status) {
+        let _config = ''
+        if (res.LongParam) {
+          try {
+            _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+          } catch (e) {
+            console.warn('Parse Failure')
+            _config = ''
+          }
+        }
+
+        if (!_config) {
+          notification.warning({
+            top: 92,
+            message: '鏈幏鍙栧埌閰嶇疆淇℃伅锛�',
+            duration: 5
+          })
+          return
+        }
+
+        // 鐗堟湰鍏煎
+        _config = updateForm(_config)
+
+        this.setState({
+          config: null
+        }, () => {
+          this.setState({
+            config: _config,
+            openEdition: res.open_edition || '',
+            originConfig: fromJS(_config).toJS()
+          })
+        })
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      }
+    })
+  }
+
+  render () {
+    const { editAction } = this.props
+    const { config, dict, openEdition } = this.state
+
+    if (!config) return null
+    
     return (
       <div className="modal-form-board">
         <DndProvider backend={HTML5Backend}>
@@ -637,6 +692,7 @@
           <div className="setting">
             <Card title={dict['header.menu.form.configurable']} bordered={false} extra={
               <div>
+                <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                 <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/>
                 <EditComponent dict={dict} options={['form']} config={this.state.config} refresh={this.updateEditConfig}/>
                 <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['model.save']}</Button>

--
Gitblit v1.8.0