From 1da6506bf58270bacc2a4345002c6b082835580e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 十月 2021 23:17:08 +0800
Subject: [PATCH] 2021-10-21

---
 src/templates/comtableconfig/index.jsx |  103 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 80 insertions(+), 23 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index cdb8a60..037c3d6 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -25,8 +25,11 @@
 
 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 Unattended = asyncComponent(() => import('@/templates/zshare/unattended'))
 const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
 const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent'))
 const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
@@ -89,6 +92,7 @@
     _config.MenuNo = menu.MenuNo || ''
     _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : ''
     _config.easyCode = _config.easyCode || ''
+    _config.uuid = menu.MenuID || ''
 
     // 鐗堟湰鍏煎
     _config = updateCommonTable(_config)
@@ -682,7 +686,7 @@
                     })
                   })
                   _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig)))
-                } catch {
+                } catch (e) {
                   console.warn('Stringify Failure')
                   _subconfig = ''
                 }
@@ -871,7 +875,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) {
@@ -1032,14 +1036,10 @@
    * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑
    */
   editConfig = (res) => {
-    if (res.type === 'thaw') {
-      this.setState({
-        thawButtons: res.thawButtons,
-        config: res.config
-      })
-    } else if (res.type === 'paste') {
-      this.setState({config: res.config})
-    }
+    this.setState({
+      thawButtons: res.thawButtons,
+      config: res.config
+    })
   }
 
   /**
@@ -1083,9 +1083,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')))
 
@@ -1125,11 +1188,7 @@
                 <div className="search-element">
                   {Source.searchItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
                 </div>
-                <FieldsComponent
-                  config={config}
-                  type="search"
-                  updatefield={this.updateconfig}
-                />
+                <FieldsComponent config={config} type="search" />
               </Panel>
               {/* 鎸夐挳娣诲姞 */}
               <Panel header={this.state.dict['header.menu.action']} key="2">
@@ -1164,11 +1223,7 @@
                 <div className="search-element">
                   {Source.columnItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
                 </div>
-                <FieldsComponent
-                  config={config}
-                  type="columns"
-                  updatefield={this.updateconfig}
-                />
+                <FieldsComponent config={config} type="columns"/>
               </Panel>
               {/* 娣诲姞鏍囩 */}
               <Panel header={this.state.dict['header.menu.tab']} key="4">
@@ -1206,8 +1261,10 @@
               </div>
             } bordered={false} extra={
               <div>
+                <Unattended config={config} updateConfig={this.updateconfig}/>
+                <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}/>
+                <EditComponent dict={this.state.dict} type="table" options={['search', 'form', '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} />
                 <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button>
                 <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button>
@@ -1215,7 +1272,7 @@
             } style={{ width: '100%' }}>
               <SettingComponent
                 config={config}
-                MenuID={this.props.menu.MenuID}
+                MenuID={menu.MenuID}
                 updatesetting={this.updateconfig}
               />
               <SearchComponent

--
Gitblit v1.8.0