From b09b821ef36fd1ea979e9a5daa98e95732ac81d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 16 七月 2025 18:16:00 +0800
Subject: [PATCH] 2025-07-16

---
 src/templates/treepageconfig/index.jsx |  977 ++++++++++++++++++++++++--------------------------------
 1 files changed, 422 insertions(+), 555 deletions(-)

diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx
index 61dd4a9..84da278 100644
--- a/src/templates/treepageconfig/index.jsx
+++ b/src/templates/treepageconfig/index.jsx
@@ -1,44 +1,37 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { connect } from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { DndProvider } from 'react-dnd'
 import HTML5Backend from 'react-dnd-html5-backend'
-import { Button, Card, Modal, Collapse, notification, Spin, Icon, Switch, Tooltip, Row, Col, Tree } from 'antd'
-import moment from 'moment'
+import { Button, Card, Collapse, notification, Spin, Tooltip, Row, Col, Tree } from 'antd'
+import { QuestionCircleOutlined, RedoOutlined, SearchOutlined, FileOutlined, FolderOpenOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
-import { getMainMenuForm } from '@/templates/zshare/formconfig'
 
 import asyncComponent from '@/utils/asyncComponent'
-
-import MenuForm from '@/templates/zshare/menuform'
-import EditComponent from '@/templates/zshare/editcomponent'
+import MenuForm from '@/templates/comtableconfig/menuform'
 import SourceElement from '@/templates/zshare/dragsource'
 import Source from './source'
 import './index.scss'
 
 const { Panel } = Collapse
-const { confirm } = Modal
+// const { confirm } = Modal
 const { TreeNode } = Tree
+
+const UpdateTable = asyncComponent(() => import('./updatetable'))
 const TreeSettingComponent = asyncComponent(() => import('@/templates/sharecomponent/treesettingcomponent'))
 const TabsComponent = asyncComponent(() => import('@/templates/sharecomponent/tabscomponent'))
 
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
-    optionLibs: PropTypes.any,
     reloadmenu: PropTypes.func,
     handleView: PropTypes.func
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     config: null,            // 椤甸潰閰嶇疆
-    menuformlist: null,      // 鍩烘湰淇℃伅琛ㄥ崟瀛楁
     formlist: null,          // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁
     menuloading: false,      // 鑿滃崟淇濆瓨涓�
     menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨
@@ -48,10 +41,8 @@
     originMenu: null,        // 鍘熷鑿滃崟
     delTabs: [],             // 鍒犻櫎鏍囩鍒楄〃
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
-    optionLibs: null,        // 鑷畾涔変笅鎷夐�夐」搴�
     activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
-    pasteContent: null,      // 绮樿创閰嶇疆淇℃伅
-    openEdition: ''          // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣�
+    openEdition: '',         // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣�
   }
 
   /**
@@ -60,7 +51,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { menu, optionLibs } = this.props
+    const { menu } = this.props
 
     let _LongParam = menu.LongParam
     let _config = ''
@@ -72,8 +63,15 @@
       _config = _LongParam
     }
 
+    // 椤甸潰閰嶇疆涓繚鐣欒彍鍗曚俊鎭紝鍙敤浜庢暟鎹紶閫�
+    _config.ParentId = menu.ParentId
+    _config.fstMenuId = menu.fstMenuId
+    _config.MenuName = menu.MenuName || ''
+    _config.MenuNo = menu.MenuNo || ''
+    _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : ''
+    _config.MenuID = menu.MenuID || ''
+
     // 閰嶇疆榛樿鍊硷紝鍏煎
-    _config.Template = 'TreePage'
     _config.easyCode = _config.easyCode || ''
     
     if (_config.type === 'user') {
@@ -91,13 +89,16 @@
       })
     }
 
+    // 鏁版嵁婧�
+    if (_config.setting.interType === 'inner' && !_config.setting.innerFunc) {
+      _config.setting.interType = 'system'
+    }
+
     this.setState({
       config: _config,
       openEdition: menu.open_edition || '',
       activeKey: menu.activeKey || '0',
-      optionLibs: optionLibs,
-      originMenu: fromJS(menu).toJS(),
-      menuformlist: getMainMenuForm(menu, _config)
+      originMenu: fromJS(_config).toJS()
     })
   }
 
@@ -106,6 +107,54 @@
    */
   componentDidMount () {
     this.reloadTab(false)
+    document.onkeydown = (event) => {
+      let e = event || window.event
+      let keyCode = e.keyCode || e.which || e.charCode
+      let preKey = ''
+
+      if (e.ctrlKey) {
+        preKey = 'ctrl'
+      }
+      if (e.shiftKey) {
+        preKey = 'shift'
+      } else if (e.altKey) {
+        preKey = 'alt'
+      }
+      
+      if (!preKey || !keyCode) return
+      
+      let _shortcut = `${preKey}+${keyCode}`
+
+      if (_shortcut === 'ctrl+83') {
+        let modals = document.querySelectorAll('.mk-pop-modal')
+        let msg = null
+        for (let i = 0; i < modals.length; i++) {
+          if (msg) {
+            break
+          }
+
+          let node = modals[i].querySelector('.mk-com-name')
+
+          if (node) {
+            msg = node.innerText
+          }
+        }
+        if (msg) {
+          notification.warning({
+            top: 92,
+            message: '璇蜂繚瀛�' + msg,
+            duration: 5
+          })
+          return false
+        }
+
+        let node = document.getElementById('save-config')
+        if (node && node.click) {
+          node.click()
+        }
+        return false
+      }
+    }
   }
 
   /**
@@ -115,6 +164,7 @@
     this.setState = () => {
       return
     }
+    document.onkeydown = () => {}
   }
 
   /**
@@ -125,7 +175,7 @@
       loading: type,
       tabviews: []
     })
-    Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
+    Api.getCloudConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
       if (res.status) {
         this.setState({
           loading: false,
@@ -160,521 +210,366 @@
     })
   }
 
-  getFuncNames = (data, funcNames, tableNames) => {
-    data.forEach(item => {
-      if (item.subfuncs) {
-        this.getFuncNames(item.subfuncs, funcNames, tableNames)
-      } else {
-        if (item.tableName) {
-          tableNames.push(item.tableName)
-        }
-        if (item.innerFunc) {
-          funcNames.push({func: item.innerFunc, label: item.label || ''})
-        }
-
-        if (item.callbackFunc) {
-          funcNames.push({func: item.callbackFunc, label: item.label || ''})
-        }
-      }
-    })
-
-    return {
-      func: funcNames,
-      table: tableNames
-    }
-  }
-
   /**
    * @description 涓夌骇鑿滃崟淇濆瓨
    */
-  submitConfig = () => {
-    const { menu } = this.props
-    const { originMenu, delTabs, openEdition } = this.state
+  // submitConfig = () => {
+  //   const { menu } = this.props
+  //   const { delTabs, openEdition } = this.state
 
-    let config = fromJS(this.state.config).toJS()
+  //   let _config = fromJS(this.state.config).toJS()
 
-    this.menuformRef.handleConfirm().then(res => {
-      if (config.isAdd) {
-        config.tabgroups[0].sublist = config.tabgroups[0].sublist.filter(item => !item.origin)
-      }
+  //   // 鍩烘湰淇℃伅楠岃瘉
+  //   if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) {
+  //     notification.warning({
+  //       top: 92,
+  //       message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒',
+  //       duration: 5
+  //     })
+  //     this.setState({activeKey: '0'})
+  //     return
+  //   }
 
-      if (config.type === 'user') { // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id
-        config.tabgroups.forEach(group => {
-          group.sublist = group.sublist.map(tab => {
-            if (!tab.linkTab) {
-              tab.linkTab = Utils.getuuid()
-            }
-            return tab
-          })
-        })
-      }
+  //   // 鏂板缓楠岃瘉
+  //   if (_config.isAdd) {
+  //     _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin)
+  //   }
 
-      let _LongParam = ''
-      let _config = {...config, easyCode: res.easyCode}
-      let _pageParam = {...menu.PageParam, OpenType: res.opentype}
+  //   // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id
+  //   if (_config.type === 'user') {
+  //     _config.tabgroups.forEach(group => {
+  //       group.sublist = group.sublist.map(tab => {
+  //         if (!tab.linkTab) {
+  //           tab.linkTab = Utils.getuuid()
+  //         }
+  //         return tab
+  //       })
+  //     })
+  //   }
 
-      // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
-      let vresult = this.verifyconfig(_config)
-      if (vresult !== true) {
-        _config.enabled = false
-      }
+  //   // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
+  //   let vresult = this.verifyconfig(_config)
+  //   if (vresult !== true) {
+  //     _config.enabled = false
+  //   }
 
-      _config.funcs = [] // 椤甸潰鍙婂瓙椤甸潰瀛樺偍杩囩▼闆�
+  //   if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬�
+  //     this.setState({
+  //       menucloseloading: true
+  //     })
+  //   } else {
+  //     this.setState({
+  //       menuloading: true
+  //     })
+  //   }
 
-      _config.funcs.push({
-        type: 'view',
-        subtype: 'view',
-        uuid: menu.MenuID,
-        intertype: _config.setting.interType || 'inner',
-        interface: _config.setting.interface || '',
-        tableName: _config.setting.tableName || '',
-        innerFunc: _config.setting.innerFunc || '',
-        outerFunc: _config.setting.outerFunc || ''
-      })
+  //   // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
+  //   delete _config.type
+  //   delete _config.isAdd
 
-      _config.tabgroups.forEach(group => {
-        group.sublist.forEach(tab => {
-          _config.funcs.push({
-            type: 'tab',
-            subtype: 'tab',
-            uuid: tab.uuid,
-            label: tab.label,
-            linkTab: tab.linkTab
-          })
-        })
-      })
+  //   let _LongParam = ''
 
-      if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬�
-        this.setState({
-          menucloseloading: true
-        })
-      } else {
-        this.setState({
-          menuloading: true
-        })
-      }
+  //   try {
+  //     _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
+  //   } catch (e) {
+  //     notification.warning({
+  //       top: 92,
+  //       message: '缂栬瘧閿欒',
+  //       duration: 5
+  //     })
+  //     this.setState({
+  //       menucloseloading: false,
+  //       menuloading: false
+  //     })
+  //     return
+  //   }
 
-      new Promise(resolve => {
-        let deffers = []
-        _config.funcs.forEach(item => {
-          if (item.type === 'tab') {
-            let deffer = new Promise(resolve => {
-              Api.getSystemConfig({
-                func: 'sPC_Get_LongParam',
-                MenuID: item.linkTab
-              }).then(result => {
-                if (result.status && result.LongParam) {
-                  let _LongParam = ''
-        
-                  if (result.LongParam) {
-                    try {
-                      _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
-                    } catch (e) {
-                      console.warn('Parse Failure')
-                      _LongParam = ''
-                    }
-                  }
-      
-                  if (_LongParam) {
-                    item.menuNo = _LongParam.tabNo || ''
-                    item.subfuncs = _LongParam.funcs || []
-                  }
-                }
-                resolve()
-              })
-            })
-
-            deffers.push(deffer)
-          }
-        })
-
-        if (deffers.length === 0) {
-          resolve()
-        } else {
-          Promise.all(deffers).then(() => {
-            resolve()
-          })
-        }
-      }).then(() => {
-        // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
-        delete _config.type
-        delete _config.isAdd
-  
-        try {
-          _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
-        } catch (e) {
-          notification.warning({
-            top: 92,
-            message: '缂栬瘧閿欒',
-            duration: 5
-          })
-          this.setState({
-            menucloseloading: false,
-            menuloading: false
-          })
-          return
-        }
-  
-        let _sort = 0
-        let btntabs = []
-        
-        let tabParam = { // 娣诲姞鑿滃崟tab椤�
-          func: 'sPC_sMenusTab_AddUpt',
-          MenuID: menu.MenuID
-        }
-
-        let _LText = []
-
-        btntabs.forEach(item => {
-          _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`)
-        })
-        _config.tabgroups.forEach(group => {
-          group.sublist.forEach(item => {
-            _sort++
-            _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`)
-          })
-        })
-
-        _LText = _LText.join(' union all ')
-
-        tabParam.LText = Utils.formatOptions(_LText)
-        tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-        tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
-  
-        let _vals = this.getFuncNames(_config.funcs, [], [])
-        let _tables = Array.from(new Set(_vals.table))
-
-        let param = {
-          func: 'sPC_TrdMenu_AddUpt',
-          FstID: res.fstMenuId,
-          SndID: res.parentId,
-          ParentID: res.parentId,
-          MenuID: menu.MenuID,
-          MenuNo: res.MenuNo,
-          EasyCode: res.easyCode,
-          Template: menu.PageParam.Template || '',
-          MenuName: res.MenuName,
-          PageParam: JSON.stringify(_pageParam),
-          LongParam: _LongParam,
-          LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`),
-          LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
-        }
-
-        if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴�
-          param.Sort = menu.menuSort
-        }
-
-        param.LText = param.LText.join(' union all ')
-        param.LText = Utils.formatOptions(param.LText)
-        param.LTexttb = param.LTexttb.join(' union all ')
-        param.LTexttb = Utils.formatOptions(param.LTexttb)
-        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
-
-        if (openEdition) { // 鐗堟湰绠$悊
-          param.open_edition = openEdition
-        }
-
-        // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
-        // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
-        new Promise(resolve => {
-          if (delTabs.length > 0) {
-            let deffers = delTabs.map(item => {
-              let _param = {
-                func: 'sPC_MainMenu_Del',
-                MenuID: item.uuid
-              }
-
-              return new Promise(resolve => {
-                Api.getSystemConfig(_param).then(response => {
-                  resolve(response)
-                })
-              })
-            })
-            Promise.all(deffers).then(result => {
-              let error = null
-              result.forEach(response => {
-                if (!response.status) {
-                  error = response
-                }
-              })
+  //   // let _sort = 0
+  //   // let btntabs = []
     
-              if (error) {
-                this.setState({
-                  menuloading: false,
-                  menucloseloading: false
-                })
-                notification.warning({
-                  top: 92,
-                  message: error.message,
-                  duration: 5
-                })
-                resolve(false)
-              } else {
-                this.setState({
-                  delTabs: []
-                })
-                resolve(true)
-              }
-            })
-          } else if (delTabs.length === 0) {
-            resolve(true)
-          }
-        }).then(resp => {
-          if (resp === false) return
-          let localParam = fromJS(param).toJS()
+  //   // let tabParam = { // 娣诲姞鑿滃崟tab椤�
+  //   //   func: 'sPC_sMenusTab_AddUpt',
+  //   //   MenuID: menu.MenuID
+  //   // }
 
-          Api.getSystemConfig(param).then(response => {
-            if (response.status) {
-              let _FMenu = originMenu.fstMenuList.filter(fstM => fstM.MenuID === res.fstMenuId)[0]
-              let _supMenuList = []
-              if (_FMenu) {
-                _supMenuList = _FMenu.options
-              }
+  //   // let _LText = []
 
-              this.setState({
-                config: _config,
-                openEdition: response.open_edition || '',
-                originMenu: {
-                  ...originMenu,
-                  LongParam: _config,
-                  PageParam: _pageParam,
-                  MenuName: res.MenuName,
-                  MenuNo: res.MenuNo,
-                  ParentID: res.parentId,
-                  fstMenuId: res.fstMenuId,
-                  supMenuList: _supMenuList
-                }
-              })
+  //   // btntabs.forEach(item => {
+  //   //   _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`)
+  //   // })
+  //   // _config.tabgroups.forEach(group => {
+  //   //   group.sublist.forEach(item => {
+  //   //     _sort++
+  //   //     _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`)
+  //   //   })
+  //   // })
 
-              this.props.reloadmenu()
-              
-              // 瀛樺湪鏍囩椤垫椂
-              if (tabParam.LText) {
-                Api.getSystemConfig(tabParam).then(result => {
-                  if (result.status) {
-                    notification.success({
-                      top: 92,
-                      message: '淇濆瓨鎴愬姛',
-                      duration: 2
-                    })
-                    if (this.state.closeVisible) {
-                      this.props.handleView()
-                    } else {
-                      this.setState({
-                        menuloading: false,
-                        menucloseloading: false
-                      })
-                    }
-                  } else {
-                    notification.warning({
-                      top: 92,
-                      message: result.message,
-                      duration: 5
-                    })
-                    this.setState({
-                      menuloading: false,
-                      menucloseloading: false
-                    })
-                  }
-                })
-              } else {
-                notification.success({
-                  top: 92,
-                  message: '淇濆瓨鎴愬姛',
-                  duration: 2
-                })
-                if (this.state.closeVisible) {
-                  this.props.handleView()
-                } else {
-                  this.setState({
-                    menuloading: false,
-                    menucloseloading: false
-                  })
-                }
-              }
+  //   // _LText = _LText.join(' union all ')
 
-              localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
-              delete localParam.LongParam
-              delete localParam.PageParam
-              delete localParam.Template
-              delete localParam.Sort
-              delete localParam.EasyCode
-              delete localParam.open_edition
+  //   // tabParam.LText = Utils.formatOptions(_LText)
+  //   // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+  //   // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
 
-              Api.getLocalConfig(localParam)
-            } else {
-              this.setState({
-                menuloading: false,
-                menucloseloading: false
-              })
-              notification.warning({
-                top: 92,
-                message: response.message,
-                duration: 5
-              })
-            }
-          })
-        })
-      })
-    }, () => {
-      notification.warning({
-        top: 92,
-        message: this.state.dict['header.menu.basemsg'],
-        duration: 5
-      })
-    })
-  }
+  //   let _funcs = []
+  //   let _tables = []
+
+  //   if (_config.setting.tableName) {
+  //     _tables.push(_config.setting.tableName)
+  //   }
+  //   if (_config.setting.innerFunc) {
+  //     _funcs.push({func: _config.setting.innerFunc, label: _config.MenuName || ''})
+  //   }
+  //   if (_config.setting.outerFunc) {
+  //     _funcs.push({func: _config.setting.outerFunc, label: _config.MenuName || ''})
+  //   }
+
+  //   let param = {
+  //     func: 'sPC_TrdMenu_AddUpt',
+  //     FstID: _config.fstMenuId,
+  //     SndID: _config.ParentId,
+  //     ParentID: _config.ParentId,
+  //     MenuID: menu.MenuID,
+  //     MenuNo: _config.MenuNo,
+  //     EasyCode: _config.easyCode,
+  //     Template: _config.Template,
+  //     MenuName: _config.MenuName,
+  //     PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}),
+  //     LongParam: _LongParam,
+  //     LText: _funcs.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`),
+  //     LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
+  //   }
+
+  //   if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴�
+  //     param.Sort = menu.menuSort
+  //   }
+
+  //   param.LText = param.LText.join(' union all ')
+  //   param.LText = Utils.formatOptions(param.LText)
+  //   param.LTexttb = param.LTexttb.join(' union all ')
+  //   param.LTexttb = Utils.formatOptions(param.LTexttb)
+  //   param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+  //   param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+  //   if (openEdition) { // 鐗堟湰绠$悊
+  //     param.open_edition = openEdition
+  //   }
+
+  //   // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
+  //   // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
+  //   new Promise(resolve => {
+  //     if (delTabs.length > 0) {
+  //       let deffers = delTabs.map(item => {
+  //         let _param = {
+  //           func: 'sPC_MainMenu_Del',
+  //           MenuID: item.uuid
+  //         }
+
+  //         return new Promise(resolve => {
+  //           Api.getCloudConfig(_param).then(response => {
+  //             resolve(response)
+  //           })
+  //         })
+  //       })
+  //       Promise.all(deffers).then(result => {
+  //         let error = null
+  //         result.forEach(response => {
+  //           if (!response.status) {
+  //             error = response
+  //           }
+  //         })
+
+  //         if (error) {
+  //           this.setState({
+  //             menuloading: false,
+  //             menucloseloading: false
+  //           })
+  //           notification.warning({
+  //             top: 92,
+  //             message: error.message,
+  //             duration: 5
+  //           })
+  //           resolve(false)
+  //         } else {
+  //           this.setState({
+  //             delTabs: []
+  //           })
+  //           resolve(true)
+  //         }
+  //       })
+  //     } else if (delTabs.length === 0) {
+  //       resolve(true)
+  //     }
+  //   }).then(resp => {
+  //     if (resp === false) return
+
+  //     Api.getCloudConfig(param).then(response => {
+  //       if (response.status) {
+  //         this.setState({
+  //           config: _config,
+  //           openEdition: response.open_edition || '',
+  //           originMenu: fromJS(_config).toJS(),
+  //           menuloading: false,
+  //           menucloseloading: false
+  //         })
+
+  //         notification.success({
+  //           top: 92,
+  //           message: '淇濆瓨鎴愬姛',
+  //           duration: 2
+  //         })
+
+  //         this.props.reloadmenu()
+
+  //         if (this.state.closeVisible) {
+  //           this.props.handleView()
+  //         }
+  //       } else {
+  //         this.setState({
+  //           menuloading: false,
+  //           menucloseloading: false
+  //         })
+  //         notification.warning({
+  //           top: 92,
+  //           message: response.message,
+  //           duration: 5
+  //         })
+  //       }
+  //     })
+  //   })
+  // }
 
   /**
    * @description 鐐瑰嚮杩斿洖鏃讹紝鍒ゆ柇閰嶇疆淇濆瓨鐘舵��
    */
   cancelConfig = () => {
-    const { menu } = this.props
-    const { config, originMenu } = this.state
+    // const { config, originMenu } = this.state
+    // let that = this
 
-    let _this = this
-
-    if (config.isAdd) {
-      confirm({
-        content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�',
-        okText: this.state.dict['model.confirm'],
-        cancelText: this.state.dict['header.cancel'],
-        onOk() {
-          _this.props.handleView()
-        },
-        onCancel() {}
-      })
-    } else {
-      this.menuformRef.handleConfirm().then(res => {
-        let _config = {...config, easyCode: res.easyCode}
-        let _pageParam = {...menu.PageParam, OpenType: res.opentype}
-        let _originMenu = {
-          ...originMenu,
-          LongParam: _config,
-          PageParam: _pageParam,
-          MenuName: res.MenuName,
-          MenuNo: res.MenuNo,
-          ParentID: res.parentId,
-          fstMenuId: res.fstMenuId
-        }
-
-        if (!is(fromJS(originMenu), fromJS(_originMenu))) {
-          this.setState({
-            closeVisible: true
-          })
-        } else {
-          this.props.handleView()
-        }
-      }, () => {
-        this.setState({
-          closeVisible: true
-        })
-      })
-    }
+    // if (config.isAdd) {
+    //   confirm({
+    //     content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�',
+    //     onOk() {
+    //       that.props.handleView()
+    //     },
+    //     onCancel() {}
+    //   })
+    // } else {
+    //   if (!is(fromJS(originMenu), fromJS(config))) {
+    //     this.setState({
+    //       closeVisible: true
+    //     })
+    //   } else {
+    //     this.props.handleView()
+    //   }
+    // }
+    this.props.handleView()
   }
 
   /**
    * @description 璁剧疆鍙厤缃寜閽�
    */
-  setSubConfig = (item, type) => {
+  setSubConfig = (item) => {
     const { menu } = this.props
-    const { config, originMenu, optionLibs, activeKey, openEdition } = this.state
+    const { config, originMenu, activeKey, openEdition } = this.state
 
-    if (!originMenu.MenuID) { // menuID涓嶅瓨鍦ㄦ椂锛屼负鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛�
+    if (config.isAdd) { // menuID涓嶅瓨鍦ㄦ椂锛屼负鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛�
       notification.warning({
         top: 92,
-        message: this.state.dict['header.menu.config.notsave'],
+        message: '鑿滃崟灏氭湭淇濆瓨锛岃鍏堜繚瀛樿彍鍗曢厤缃紒',
         duration: 5
       })
     } else {
-      this.menuformRef.handleConfirm().then(res => {
-        let _config = {...config, easyCode: res.easyCode}
-        let _pageParam = {...menu.PageParam, OpenType: res.opentype}
-        let _originMenu = {
-          ...originMenu,
-          LongParam: _config,
-          PageParam: _pageParam,
-          MenuName: res.MenuName,
-          MenuNo: res.MenuNo,
-          ParentID: res.parentId,
-          fstMenuId: res.fstMenuId
-        }
-
-        if (!is(fromJS(originMenu), fromJS(_originMenu))) { // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨
-          notification.warning({
-            top: 92,
-            message: this.state.dict['header.menu.config.update'],
-            duration: 5
-          })
-          return
-        }
-
-        _originMenu.activeKey = activeKey       // 淇濆瓨褰撳墠鎵撳紑椤电
-        _originMenu.open_edition = openEdition  // 鏇存柊鐗堟湰鍙�
-
-        let param = {
-          optionLibs: optionLibs,
-          editMenu: _originMenu,
-          editTab: item,
-          tabConfig: null,
-          editSubTab: null,
-          subTabConfig: null,
-          btnTab: null,
-          btnTabConfig: null,
-          editAction: null,
-          subConfig: '',
-          tabview: item.type
-        }
-
-        this.setState({
-          loading: true
-        })
-
-        Api.getSystemConfig({
-          func: 'sPC_Get_LongParam',
-          MenuID: item.linkTab
-        }).then(res => {
-          if (res.status) {
-            this.setState({
-              loading: false
-            })
-            let _LongParam = ''
-            if (res.LongParam) {
-              try {
-                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
-              } catch (e) {
-                console.warn('Parse Failure')
-                _LongParam = ''
-              }
-            }
-
-            if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') {
-              param.subConfig = _LongParam
-            }
-
-            if (param.editTab) {
-              param.editTab.open_edition = res.open_edition || ''
-            }
-
-            this.props.handleView(param)
-          } else {
-            this.setState({
-              loading: false
-            })
-            notification.warning({
-              top: 92,
-              message: res.message,
-              duration: 5
-            })
-          }
-        })
-      }, () => {
+      // 鍩烘湰淇℃伅楠岃瘉
+      if (!config.fstMenuId || !config.ParentId || !config.MenuName || !config.MenuNo) {
         notification.warning({
           top: 92,
-          message: this.state.dict['header.menu.config.update'],
+          message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒',
           duration: 5
         })
+        this.setState({activeKey: '0'})
+        return
+      }
+
+      // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨
+      if (!is(fromJS(originMenu), fromJS(config))) {
+        notification.warning({
+          top: 92,
+          message: '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒',
+          duration: 5
+        })
+        return
+      }
+
+      let submenu = menu.fstMenuList.filter(item => item.MenuID === config.fstMenuId)[0]
+
+      let _Menu = {
+        ...menu,
+        LongParam: config,
+        PageParam: {...menu.PageParam, Template: config.Template, OpenType: config.OpenType},
+        MenuName: config.MenuName,
+        MenuNo: config.MenuNo,
+        ParentId: config.ParentId,
+        fstMenuId: config.fstMenuId,
+        supMenuList: submenu ? submenu.children : []
+      }
+
+      _Menu.activeKey = activeKey       // 淇濆瓨褰撳墠鎵撳紑椤电
+      _Menu.open_edition = openEdition  // 鏇存柊鐗堟湰鍙�
+
+      let param = {
+        editMenu: _Menu,
+        editTab: item,
+        tabConfig: null,
+        editSubTab: null,
+        subTabConfig: null,
+        btnTab: null,
+        btnTabConfig: null,
+        editAction: null,
+        subConfig: '',
+        tabview: item.type
+      }
+
+      this.setState({
+        loading: true
+      })
+
+      Api.getCloudConfig({
+        func: 'sPC_Get_LongParam',
+        MenuID: item.linkTab
+      }).then(res => {
+        if (res.status) {
+          this.setState({
+            loading: false
+          })
+          let _LongParam = ''
+          if (res.LongParam) {
+            try {
+              _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
+            } catch (e) {
+              console.warn('Parse Failure')
+              _LongParam = ''
+            }
+          }
+
+          if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') {
+            param.subConfig = _LongParam
+          }
+
+          if (param.editTab) {
+            param.editTab.open_edition = res.open_edition || ''
+          }
+
+          this.props.handleView(param)
+        } else {
+          this.setState({
+            loading: false
+          })
+          notification.warning({
+            top: 92,
+            message: res.message,
+            duration: 5
+          })
+        }
       })
     }
   }
@@ -731,21 +626,6 @@
   }
 
   /**
-   * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑
-   */
-  editConfig = (res) => {
-    if (res.type === 'paste') {
-      this.setState({
-        pasteContent: res.content
-      }, () => {
-        this.setState({
-          pasteContent: null
-        })
-      })
-    }
-  }
-
-  /**
    * @description 鏇存柊鏍囩閰嶇疆淇℃伅
    */
   updatetabs = (config, delcards) => {
@@ -767,6 +647,7 @@
   }
 
   render () {
+    const { menu } = this.props
     const { activeKey, config } = this.state
 
     let configTabs = []
@@ -779,18 +660,18 @@
         <DndProvider backend={HTML5Backend}>
           {/* 宸ュ叿鏍� */}
           <div className="tools">
-            <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
+            <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
               {/* 鍩烘湰淇℃伅 */}
-              <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="main-basedata">
+              <Panel forceRender={true} header="鍩烘湰淇℃伅" key="0" id="main-basedata">
                 {/* 鑿滃崟淇℃伅 */}
                 <MenuForm
-                  dict={this.state.dict}
-                  formlist={this.state.menuformlist}
-                  wrappedComponentRef={(inst) => this.menuformRef = inst}
+                  menu={menu}
+                  config={config}
+                  updatemenu={this.updateconfig}
                 />
               </Panel>
               {/* 娣诲姞鏍囩 */}
-              <Panel header={this.state.dict['header.menu.tab']} key="4">
+              <Panel header="鏍囩椤�" key="4">
                 <div className="search-element">
                   {Source.tabItems.map((item, index) => {
                     return (<SourceElement key={index} content={item}/>)
@@ -799,9 +680,9 @@
                 {configTabs.length > 0 ?
                   <p className="config-btn-title">
                     <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫爣绛鹃厤缃俊鎭��">
-                      <Icon type="question-circle" />
+                      <QuestionCircleOutlined className="mk-form-tip" />
                     </Tooltip>
-                    {this.state.dict['header.menu.tab.configurable']}
+                    鏍囩閰嶇疆
                   </p> : null
                 }
                 {configTabs.map((item, index) => {
@@ -811,7 +692,7 @@
                         className="config-button"
                         icon={item.icon}
                         style={{marginBottom: '10px'}}
-                        onClick={() => this.setSubConfig(item, 'tab')}
+                        onClick={() => this.setSubConfig(item)}
                       >{item.label}</Button>
                     </div>
                   )
@@ -822,15 +703,15 @@
           <div className="setting">
             <Card title={
               <div>
-                {this.state.dict['header.menu.page.configurable']} 
-                <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab(true)} />
+                椤甸潰閰嶇疆 
+                <RedoOutlined style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab(true)} />
               </div>
             } bordered={false} extra={
               <div>
-                <EditComponent dict={this.state.dict} type="TreePage" config={this.state.config} MenuID={this.props.menu.MenuID} refresh={this.editConfig}/>
-                <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
-                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>
-                <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
+                <UpdateTable config={config}/>
+                {/* <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */}
+                {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */}
+                <Button onClick={this.cancelConfig}>鍏抽棴</Button>
               </div>
             } style={{ width: '100%' }}>
               <Row gutter={16}>
@@ -838,8 +719,6 @@
                   <TreeSettingComponent
                     config={config}
                     MenuID={this.props.menu.MenuID}
-                    menuformRef={this.menuformRef}
-                    permFuncField={this.props.permFuncField}
                     updatesetting={this.updateconfig}
                   />
                   <Card
@@ -847,7 +726,7 @@
                     title={
                       <span className="tree-title">
                         <span className="title">{config.setting.title}</span>
-                        {config.setting.searchable !== 'false' ? <span className="ant-input-search ant-input-affix-wrapper"><span className="ant-input-suffix"><Icon type="search" /></span></span> : null}
+                        {config.setting.searchable !== 'false' ? <span className="ant-input-search ant-input-affix-wrapper"><span className="ant-input-suffix"><SearchOutlined /></span></span> : null}
                       </span>
                     }
                     bordered={false}
@@ -859,13 +738,13 @@
                         showIcon={config.setting.showIcon === 'true'}
                         showLine={config.setting.showLine === 'true'}
                       >
-                        <TreeNode icon={<Icon type="folder-open" />} title="parent 0" key="0-0">
-                          <TreeNode icon={<Icon type="file" />} title="leaf 0-0" key="0-0-0" isLeaf />
-                          <TreeNode icon={<Icon type="file" />} title="leaf 0-1" key="0-0-1" isLeaf />
+                        <TreeNode icon={<FolderOpenOutlined />} title="parent 0" key="0-0">
+                          <TreeNode icon={<FileOutlined />} title="leaf 0-0" key="0-0-0" isLeaf />
+                          <TreeNode icon={<FileOutlined />} title="leaf 0-1" key="0-0-1" isLeaf />
                         </TreeNode>
-                        <TreeNode icon={<Icon type="folder-open" />} title="parent 1" key="0-1">
-                          <TreeNode icon={<Icon type="file" />} title="leaf 1-0" key="0-1-0" isLeaf />
-                          <TreeNode icon={<Icon type="file" />} title="leaf 1-1" key="0-1-1" isLeaf />
+                        <TreeNode icon={<FolderOpenOutlined />} title="parent 1" key="0-1">
+                          <TreeNode icon={<FileOutlined />} title="leaf 1-0" key="0-1-0" isLeaf />
+                          <TreeNode icon={<FileOutlined />} title="leaf 1-1" key="0-1-1" isLeaf />
                         </TreeNode>
                       </Tree>
                     </div>
@@ -876,7 +755,7 @@
                   <TabsComponent
                     config={config}
                     tabs={this.state.tabviews}
-                    setSubConfig={(item) => this.setSubConfig(item, 'tab')}
+                    setSubConfig={(item) => this.setSubConfig(item)}
                     updatetabs={this.updatetabs}
                   />
                 </Col>
@@ -885,37 +764,25 @@
           </div>
         </DndProvider>
         {/* 杩斿洖鏃舵湭淇濆瓨鎻愮ず */}
-        <Modal
+        {/* <Modal
           bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}}
           closable={false}
           maskClosable={false}
           visible={this.state.closeVisible}
           onCancel={() => { this.setState({closeVisible: false}) }}
           footer={[
-            <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
-            <Button key="notsave" className="mk-btn mk-yellow" onClick={this.notsave}>{this.state.dict['header.notsave']}</Button>,
-            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button>
+            <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>淇濆瓨</Button>,
+            <Button key="notsave" className="mk-btn mk-yellow" onClick={this.notsave}>涓嶄繚瀛�</Button>,
+            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>鍙栨秷</Button>
           ]}
           destroyOnClose
         >
-          {this.state.dict['header.menu.config.placeholder']}
-        </Modal>
+          閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛�
+        </Modal> */}
         {this.state.loading && <Spin size="large" />}
       </div>
     )
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    sysRoles: state.sysRoles,
-    permFuncField: state.permFuncField,
-    memberLevel: state.memberLevel
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(ComTableConfig)
+export default ComTableConfig

--
Gitblit v1.8.0