From 42fae277ae5ebe794fc070bf38482a919eb661fc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 十一月 2020 14:36:02 +0800
Subject: [PATCH] 2020-11-25

---
 src/templates/comtableconfig/index.jsx |   60 +++++++++++-------------------------------------------------
 1 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 0dee3c7..d637149 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -59,7 +59,6 @@
     thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
     activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
     chartview: null,         // 褰撳墠瑙嗗浘
-    pasteContent: null,      // 绮樿创閰嶇疆淇℃伅
     openEdition: ''          // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣�
   }
 
@@ -902,7 +901,7 @@
         MenuNo: config.MenuNo,
         ParentId: config.ParentId,
         fstMenuId: config.fstMenuId,
-        supMenuList: submenu ? submenu.options : []
+        supMenuList: submenu ? submenu.children : []
       }
 
       // 鑿滃崟淇℃伅楠岃瘉閫氳繃鍚庯紝璺宠浆瀛愰厤缃〉闈�
@@ -1107,50 +1106,24 @@
    * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑
    */
   editConfig = (res) => {
+    
+
     if (res.type === 'thaw') {
       this.setState({
         thawButtons: res.thawButtons,
         config: res.config
       })
     } else if (res.type === 'paste') {
-      this.setState({
-        pasteContent: res.content
-      }, () => {
-        this.setState({
-          pasteContent: null
-        })
-      })
-    } else if (res.type === 'replace') {
       let config = fromJS(this.state.config).toJS()
-
-      if (res.repType === 'field') {
-        let origin = res.origin.toLowerCase()
-        let value = res.value
-
-        config.search = config.search.map(item => {
-          if (item.field && item.field.toLowerCase() === origin) {
-            item.field = value
-          } else if (item.datefield && item.datefield.toLowerCase() === origin) {
-            item.datefield = value
-          }
-          return item
-        })
-        config.columns = config.columns.map(item => {
-          if (item.field && item.field.toLowerCase() === origin) {
-            item.field = value
-          } else if (item.nameField && item.nameField.toLowerCase() === origin) {
-            item.nameField = value
-          }
-          return item
-        })
+      if (res.content.copyType === 'search') {
+        config.search.push(res.content)
+      } else if (res.content.copyType === 'action') {
+        config.action.push(res.content)
+      } else if (res.content.copyType === 'columns' && res.content.columns && res.content.columns.length > 0) {
+        config.columns = config.columns.filter(col => !col.origin)
+        config.columns = [...config.columns, ...res.content.columns]
       }
-
-      notification.success({
-        top: 92,
-        message: '鏇挎崲鎴愬姛銆�',
-        duration: 2
-      })
-      this.setState({ config })
+      this.setState({config})
     }
   }
 
@@ -1347,21 +1320,16 @@
               <SettingComponent
                 config={config}
                 MenuID={this.props.menu.MenuID}
-                permFuncField={this.props.permFuncField}
                 updatesetting={this.updateconfig}
               />
               <SearchComponent
-                menu={{MenuID: this.props.menu.MenuID, MenuName: config.MenuName}}
                 config={config}
-                pasteContent={this.state.pasteContent}
-                sysRoles={this.props.sysRoles}
                 updatesearch={this.updatesearch}
               />
               <div className="chart-view" style={{position: 'relative'}}>
                 {/* 瑙嗗浘缁� 鏉冮檺 浼氬憳绛夌骇20+ */}
                 {this.props.memberLevel >= 20 ? <ChartGroupComponent
                   config={config}
-                  sysRoles={this.props.sysRoles}
                   updatechartgroup={this.updatechartgroup}
                 /> : null}
                 {config.charts.map(item => {
@@ -1376,16 +1344,12 @@
                           menu={{ MenuID: this.props.menu.MenuID, MenuName: config.MenuName, MenuNo: config.MenuNo, fstMenuList: this.props.menu.fstMenuList }}
                           config={config}
                           tabs={this.state.tabviews}
-                          pasteContent={this.state.pasteContent}
-                          usefulFields={this.props.permFuncField}
                           setSubConfig={(_btn) => this.setSubConfig(_btn, 'button')}
                           updateaction={this.updateaction}
                         />
                         <ColumnComponent
                           config={config}
                           menu={this.props.menu}
-                          sysRoles={this.props.sysRoles}
-                          pasteContent={this.state.pasteContent}
                           updatecolumn={this.updateconfig}
                         />
                       </Col>
@@ -1447,8 +1411,6 @@
 
 const mapStateToProps = (state) => {
   return {
-    sysRoles: state.sysRoles,
-    permFuncField: state.permFuncField,
     memberLevel: state.memberLevel
   }
 }

--
Gitblit v1.8.0