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/formtabconfig/index.jsx |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index cf0047c..88d4cc8 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -66,7 +66,8 @@
     profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
     editgroup: null,         // 褰撳墠缂栬緫缁�
     groupVisible: false,     // 缂栬緫缁勬ā鎬佹
-    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
+    optionLibs: null,        // 鑷畾涔変笅鎷夐�夐」搴�
+    activeKey: '0'           // 榛樿灞曞紑鍩烘湰淇℃伅
   }
 
   /**
@@ -125,6 +126,7 @@
 
     this.setState({
       config: _config,
+      activeKey: btnTab.activeKey || '0',
       optionLibs: optionLibs,
       columns: columns,
       originMenu: JSON.parse(JSON.stringify(_config)),
@@ -845,10 +847,10 @@
    */
   tableCreatFunc = () => {
     const { menu } = this.props
-    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,
@@ -872,13 +874,14 @@
         Api.getLocalConfig(param)
       }
 
-      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 鍒涘缓瀛樺偍杩囩▼sql
+      let _config = {...config, setting: setting}
+      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _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
           })
         }
       })
@@ -1576,7 +1579,7 @@
    */
   setSubConfig = (btn) => {
     const {menu, btnTab} = this.props
-    const { config, originMenu } = this.state
+    const { config, originMenu, activeKey } = this.state
 
     if (config.isAdd) {
       notification.warning({
@@ -1598,6 +1601,9 @@
           this.setState({
             loading: true
           })
+
+          // 淇濆瓨褰撳墠鎵撳紑椤电
+          btnTab.activeKey = activeKey
 
           let param = {
             editMenu: menu,
@@ -1857,7 +1863,7 @@
   }
 
   render () {
-    const { config, modaltype } = this.state
+    const { config, modaltype, activeKey } = this.state
     let _length = config.groups.length
 
     let configTabs = []
@@ -1870,9 +1876,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={this.state.dict['header.menu.basedata']} key="0" id="common-basedata">
+              <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata">
                 {/* 鑿滃崟淇℃伅 */}
                 <MenuForm
                   dict={this.state.dict}

--
Gitblit v1.8.0