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/comtableconfig/index.jsx |   72 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 3 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 93f8c2d..b3cc118 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -25,6 +25,8 @@
 
 const { Panel } = Collapse
 const { confirm } = Modal
+
+const Versions = asyncComponent(() => import('@/menu/versions'))
 const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent'))
 const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
 const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
@@ -871,7 +873,7 @@
           } else if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') {
             param.subConfig = _LongParam
           }
-
+          
           if (param.editTab) {
             param.editTab.open_edition = res.open_edition || ''
           } else if (param.editAction) {
@@ -1083,9 +1085,72 @@
     })
   }
 
+  refreshConfig = () => {
+    const { menu } = this.props
+    
+    let param = {
+      func: 'sPC_Get_LongParam',
+      MenuID: menu.MenuID
+    }
+
+    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.ParentId = menu.ParentId
+        _config.fstMenuId = menu.fstMenuId
+        _config.MenuName = menu.MenuName || ''
+        _config.MenuNo = menu.MenuNo || ''
+        _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : ''
+        _config.easyCode = _config.easyCode || ''
+
+        // 鐗堟湰鍏煎
+        _config = updateCommonTable(_config)
+
+        this.setState({
+          config: null
+        }, () => {
+          this.setState({
+            chartview: _config.charts[0].uuid,
+            config: _config,
+            openEdition: res.open_edition || '',
+            activeKey: menu.activeKey || '0',
+            originActions: [],
+            originMenu: fromJS(_config).toJS()
+          })
+        })
+      } else {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+      }
+    })
+  }
+
   render () {
     const { menu } = this.props
-    const { activeKey, config, chartview } = this.state
+    const { activeKey, config, chartview, openEdition } = this.state
+
+    if (!config) return null
 
     const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab') || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop')))
 
@@ -1206,6 +1271,7 @@
               </div>
             } bordered={false} extra={
               <div>
+                <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                 <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/>
                 <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/>
                 <Switch className="big" checkedChildren={this.state.dict['model.enable']} unCheckedChildren={this.state.dict['model.disable']} checked={this.state.config.enabled} onChange={this.onEnabledChange} />
@@ -1215,7 +1281,7 @@
             } style={{ width: '100%' }}>
               <SettingComponent
                 config={config}
-                MenuID={this.props.menu.MenuID}
+                MenuID={menu.MenuID}
                 updatesetting={this.updateconfig}
               />
               <SearchComponent

--
Gitblit v1.8.0