From a24beb36feaa46f39cbb26ce5277e84f91241ce8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 26 三月 2020 01:30:05 +0800
Subject: [PATCH] 2020-03-26

---
 src/templates/subtableconfig/index.jsx |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index dc7a230..232fcc2 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -82,7 +82,8 @@
     optionLibs: null,        // 鑷畾涔変笅鎷夐�夐」搴�
     thawBtnVisible: false,   // 瑙e喕鎸夐挳寮圭獥
     thawbtnlist: null,       // 瑙e喕鎸夐挳鍒楄〃
-    thawButtons: []          // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
+    thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
+    activeKey: '0'           // 榛樿灞曞紑鍩烘湰淇℃伅
   }
 
   /**
@@ -138,10 +139,13 @@
       })
     }
 
+    let _activeKey =  editSubTab ? editSubTab.activeKey : editTab.activeKey
+
     this.setState({
       originActions: _oriActions,
       optionLibs: optionLibs,
       config: _config,
+      activeKey: _activeKey || '0',
       originConfig: _config,
       selectedTables: _config.tables || [],
       menuformlist: [
@@ -813,10 +817,10 @@
    * @description 鍒涘缓琛ㄦ牸瀛樺偍杩囩▼
    */
   tableCreatFunc = () => {
-    let config = JSON.parse(JSON.stringify(this.state.config))
+    const { config } = this.state
 
-    this.settingRef.handleConfirm().then(res => {
-      const setting = res
+    this.settingRef.handleConfirm().then(setting => {
+
       if (!(setting.interType === 'inner') || !setting.innerFunc) {
         notification.warning({
           top: 92,
@@ -840,13 +844,14 @@
         Api.getLocalConfig(param)
       }
 
-      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo}, config)) // 鍒涘缓瀛樺偍杩囩▼sql
+      let _config = {...config, setting: setting}
+      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 鍒涘缓瀛樺偍杩囩▼sql
       let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc))          // 鍒犻櫎瀛樺偍杩囩▼sql
       
       this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText).then(result => {
         if (result === 'success') {
           this.setState({
-            config: {...config, setting: setting}
+            config: _config
           })
         }
       })
@@ -1773,7 +1778,7 @@
    */
   setSubConfig = (btn) => {
     const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props
-    const { config, originConfig } = this.state
+    const { config, originConfig, activeKey } = this.state
 
     if (originConfig.isAdd) {
       notification.warning({
@@ -1805,6 +1810,12 @@
           } else if (btn.OpenType === 'popview') {
             _view = btn.tabType        // 鏂板脊绐楁爣绛炬ā鏉�
             _subtab = btn
+          }
+
+          if (editSubTab) {
+            editSubTab.activeKey = activeKey
+          } else {
+            editTab.activeKey = activeKey
           }
 
           let param = {
@@ -2028,7 +2039,7 @@
   }
 
   render () {
-    const { modaltype } = this.state
+    const { modaltype, activeKey } = this.state
     const configAction = this.state.config.action.filter(_action =>
       !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab')
     )
@@ -2038,9 +2049,9 @@
         <DndProvider backend={HTML5Backend}>
           {/* 宸ュ叿鏍� */}
           <div className="tools">
-            <Collapse accordion defaultActiveKey="0" bordered={false}>
+            <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
               {/* 鍩烘湰淇℃伅 */}
-              <Panel header={'鏍囩鍩烘湰淇℃伅'} key="0" id="common-basedata">
+              <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="common-basedata">
                 {/* 鑿滃崟淇℃伅 */}
                 <MenuForm
                   dict={this.state.dict}

--
Gitblit v1.8.0