From a02fc6a77fa1b35c6516b2d37108d80e260c6c85 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 07 十一月 2024 22:05:08 +0800
Subject: [PATCH] 2024-11-07

---
 src/templates/comtableconfig/index.jsx |  940 ++++++++++++++++++++++++---------------------------------
 1 files changed, 397 insertions(+), 543 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 6717638..97f340e 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -3,13 +3,11 @@
 import { is, fromJS } from 'immutable'
 import { DndProvider } from 'react-dnd'
 import HTML5Backend from 'react-dnd-html5-backend'
-import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd'
-import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons'
-import moment from 'moment'
+import { Button, Card, Collapse, notification, Spin, Col } from 'antd'
+import { RedoOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import MKEmitter from '@/utils/events.js'
 import { updateCommonTable } from '@/utils/utils-update.js'
 
 import asyncComponent from '@/utils/asyncComponent'
@@ -18,21 +16,16 @@
 import ColumnComponent from '@/templates/sharecomponent/columncomponent'
 
 import MenuForm from './menuform'
-import SourceElement from '@/templates/zshare/dragsource'
 import Source from './source'
 import './index.scss'
 
 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 UpdateTable = asyncComponent(() => import('./updatetable'))
 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'))
-const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent'))
 const ChartGroupComponent = asyncComponent(() => import('@/templates/sharecomponent/chartgroupcomponent'))
 const ChartComponent = asyncComponent(() => import('@/templates/sharecomponent/chartcomponent'))
 const CardComponent = asyncComponent(() => import('@/templates/sharecomponent/cardcomponent'))
@@ -57,11 +50,9 @@
     delActions: [],          // 鍒犻櫎鎸夐挳鍒楄〃
     copyActions: [],         // 澶嶅埗鎸夐挳缁�
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
-    thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
     activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
     chartview: null,         // 褰撳墠瑙嗗浘
     openEdition: '',         // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣�
-    modalStatus: false       // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤
   }
 
   /**
@@ -163,10 +154,23 @@
       let _shortcut = `${preKey}+${keyCode}`
 
       if (_shortcut === 'ctrl+83') {
-        if (this.state.modalStatus) {
+        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: '璇蜂繚瀛�' + this.state.modalStatus,
+            message: '璇蜂繚瀛�' + msg,
             duration: 5
           })
           return false
@@ -179,8 +183,6 @@
         return false
       }
     }
-
-    MKEmitter.addListener('modalStatus', this.modalStatus)
   }
 
   /**
@@ -191,11 +193,6 @@
       return
     }
     document.onkeydown = () => {}
-    MKEmitter.removeListener('modalStatus', this.modalStatus)
-  }
-
-  modalStatus = (val) => {
-    this.setState({modalStatus: val})
   }
 
   /**
@@ -206,7 +203,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,
@@ -286,484 +283,428 @@
   /**
    * @description 涓夌骇鑿滃崟淇濆瓨
    */
-  submitConfig = () => {
-    const { menu } = this.props
-    const { delActions, thawButtons, openEdition } = this.state
+  // submitConfig = () => {
+  //   const { menu } = this.props
+  //   const { delActions, openEdition } = this.state
 
-    let _config = fromJS(this.state.config).toJS()
+  //   let _config = fromJS(this.state.config).toJS()
 
-    // 鍩烘湰淇℃伅楠岃瘉
-    if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) {
-      notification.warning({
-        top: 92,
-        message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒',
-        duration: 5
-      })
-      this.setState({activeKey: '0'})
-      return
-    }
+  //   // 鍩烘湰淇℃伅楠岃瘉
+  //   if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) {
+  //     notification.warning({
+  //       top: 92,
+  //       message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒',
+  //       duration: 5
+  //     })
+  //     this.setState({activeKey: '0'})
+  //     return
+  //   }
 
-    // 鏂板缓鑿滃崟锛屾竻闄ら粯璁ら」
-    if (_config.isAdd) {
-      _config.search = _config.search.filter(item => !item.origin)
-      _config.action = _config.action.filter(item => !item.origin)
-      _config.columns = _config.columns.filter(item => !item.origin)
-      _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin)
-    }
+  //   // 鏂板缓鑿滃崟锛屾竻闄ら粯璁ら」
+  //   if (_config.isAdd) {
+  //     _config.search = _config.search.filter(item => !item.origin)
+  //     _config.action = _config.action.filter(item => !item.origin)
+  //     _config.columns = _config.columns.filter(item => !item.origin)
+  //     _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin)
+  //   }
 
-    // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id
-    if (_config.type === 'user') {
-      _config.action = _config.action.map(item => {
-        if (item.OpenType === 'popview' && !item.linkTab) {
-          item.linkTab = Utils.getuuid()
-        }
-        return item
-      })
+  //   // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id
+  //   if (_config.type === 'user') {
+  //     _config.action = _config.action.map(item => {
+  //       if (item.OpenType === 'popview' && !item.linkTab) {
+  //         item.linkTab = Utils.getuuid()
+  //       }
+  //       return item
+  //     })
   
-      _config.tabgroups.forEach(group => {
-        group.sublist = group.sublist.map(tab => {
-          if (!tab.linkTab) {
-            tab.linkTab = Utils.getuuid()
-          }
-          return tab
-        })
-      })
-    }
+  //     _config.tabgroups.forEach(group => {
+  //       group.sublist = group.sublist.map(tab => {
+  //         if (!tab.linkTab) {
+  //           tab.linkTab = Utils.getuuid()
+  //         }
+  //         return tab
+  //       })
+  //     })
+  //   }
 
-    // 鎸夐挳涓嶅瓨鍦ㄦ椂锛屽幓鎺夌粦瀹氱殑鍙屽嚮鎸夐挳
-    if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) {
-      _config.setting.doubleClick = ''
-    }
+  //   // 鎸夐挳涓嶅瓨鍦ㄦ椂锛屽幓鎺夌粦瀹氱殑鍙屽嚮鎸夐挳
+  //   if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) {
+  //     _config.setting.doubleClick = ''
+  //   }
 
-    // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
-    let vresult = this.verifyconfig(_config)
-    if (vresult !== true) {
-      _config.enabled = false
-    }
+  //   // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
+  //   let vresult = this.verifyconfig(_config)
+  //   if (vresult !== true) {
+  //     _config.enabled = false
+  //   }
 
-    if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬�
-      this.setState({
-        menucloseloading: true
-      })
-    } else {
-      this.setState({
-        menuloading: true
-      })
-    }
+  //   if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬�
+  //     this.setState({
+  //       menucloseloading: true
+  //     })
+  //   } else {
+  //     this.setState({
+  //       menuloading: true
+  //     })
+  //   }
 
-    let _LongParam = ''
-    let reload = _config.isAdd
+  //   let _LongParam = ''
 
-    // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
-    delete _config.type
-    delete _config.isAdd
+  //   // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝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
-    }
+  //   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 _sort = 0
+  //   // let btntabs = []
 
-    let btnParam = {             // 娣诲姞鑿滃崟鎸夐挳
-      func: 'sPC_Button_AddUpt',
-      Type: 40,                  // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60
-      ParentID: menu.MenuID,
-      MenuNo: _config.MenuNo,
-      Template: _config.Template || '',
-      PageParam: '',
-      LongParam: '',
-      LText: []
-    }
+  //   let btnParam = {             // 娣诲姞鑿滃崟鎸夐挳
+  //     func: 'sPC_Button_AddUpt',
+  //     Type: 40,                  // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60
+  //     ParentID: menu.MenuID,
+  //     MenuNo: _config.MenuNo,
+  //     Template: _config.Template || '',
+  //     PageParam: '',
+  //     LongParam: '',
+  //     LText: []
+  //   }
 
-    _config.action.forEach(item => {
-      if (item.hidden === 'true') return
-      _sort++
-      if (item.OpenType === 'popview') {
-        btntabs.push({
-          uuid: item.uuid,
-          linkTab: item.linkTab,
-          label: item.label,
-          sort: _sort
-        })
-      }
+  //   _config.action.forEach(item => {
+  //     if (item.hidden === 'true') return
+  //     _sort++
+  //     // if (item.OpenType === 'popview') {
+  //     //   btntabs.push({
+  //     //     uuid: item.uuid,
+  //     //     linkTab: item.linkTab,
+  //     //     label: item.label,
+  //     //     sort: _sort
+  //     //   })
+  //     // }
       
-      btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`)
-    })
+  //     btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`)
+  //   })
 
-    btnParam.LText = btnParam.LText.join(' union all ')
-    btnParam.LText = Utils.formatOptions(btnParam.LText)
-    btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-    btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
+  //   btnParam.LText = btnParam.LText.join(' union all ')
+  //   btnParam.LText = Utils.formatOptions(btnParam.LText)
+  //   btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+  //   btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
     
-    let tabParam = { // 娣诲姞鑿滃崟tab椤�
-      func: 'sPC_sMenusTab_AddUpt',
-      MenuID: menu.MenuID
-    }
+  //   // let tabParam = { // 娣诲姞鑿滃崟tab椤�
+  //   //   func: 'sPC_sMenusTab_AddUpt',
+  //   //   MenuID: menu.MenuID
+  //   // }
 
-    let _LText = []
+  //   // 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`)
-      })
-    })
+  //   // 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 ')
+  //   // _LText = _LText.join(' union all ')
 
-    // 娓呯┖鑿滃崟涓嬪叧鑱旂殑鏍囩
-    if (!_LText) {
-      _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort`
-    }
+  //   // 娓呯┖鑿滃崟涓嬪叧鑱旂殑鏍囩
+  //   // if (!_LText) {
+  //   //   _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort`
+  //   // }
 
-    tabParam.LText = Utils.formatOptions(_LText)
-    tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-    tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
+  //   // tabParam.LText = Utils.formatOptions(_LText)
+  //   // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+  //   // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
 
-    let _vals = this.getFuncNames(_config)
+  //   let _vals = this.getFuncNames(_config)
 
-    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, hidden: _config.hidden || 'false'}),
-      LongParam: _LongParam,
-      LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`),
-      LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
-    }
+  //   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, hidden: _config.hidden || 'false'}),
+  //     LongParam: _LongParam,
+  //     LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`),
+  //     LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
+  //   }
 
-    if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴�
-      param.Sort = menu.menuSort
-    }
+  //   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)
+  //   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
-    }
+  //   if (openEdition) { // 鐗堟湰绠$悊
+  //     param.open_edition = openEdition
+  //   }
 
-    setTimeout(() => {
-      // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
-      // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
-      new Promise(resolve => {
-        if (delActions.length > 0) {
-          let deffers = delActions.map(item => {
-            let _param = {
-              func: 'sPC_MainMenu_Del',
-              MenuID: item.card ? item.card.uuid : item.uuid
-            }
+  //   setTimeout(() => {
+  //     // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣�
+  //     // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆
+  //     new Promise(resolve => {
+  //       if (delActions.length > 0) {
+  //         let deffers = delActions.map(item => {
+  //           let _param = {
+  //             func: 'sPC_MainMenu_Del',
+  //             MenuID: item.card ? item.card.uuid : item.uuid
+  //           }
 
-            if (item.type === 'action') {
-              let _ParentParam = null
+  //           if (item.type === 'action') {
+  //             let _ParentParam = null
 
-              try {
-                _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
-              } catch (e) {
-                console.warn('Stringify Failure')
-                _ParentParam = null
-              }
+  //             try {
+  //               _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
+  //             } catch (e) {
+  //               console.warn('Stringify Failure')
+  //               _ParentParam = null
+  //             }
 
-              if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽�
-                _param.ParentParam = _ParentParam
-              }
-            }
+  //             if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽�
+  //               _param.ParentParam = _ParentParam
+  //             }
+  //           }
 
-            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
-              }
-            })
+  //           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({
-                delActions: []
-              })
-              resolve(true)
-            }
-          })
-        } else if (delActions.length === 0) {
-          resolve(true)
-        }
-      }).then(resp => {
-        if (resp === false) return
+  //           if (error) {
+  //             this.setState({
+  //               menuloading: false,
+  //               menucloseloading: false
+  //             })
+  //             notification.warning({
+  //               top: 92,
+  //               message: error.message,
+  //               duration: 5
+  //             })
+  //             resolve(false)
+  //           } else {
+  //             this.setState({
+  //               delActions: []
+  //             })
+  //             resolve(true)
+  //           }
+  //         })
+  //       } else if (delActions.length === 0) {
+  //         resolve(true)
+  //       }
+  //     }).then(resp => {
+  //       if (resp === false) return
 
-        if (thawButtons.length > 0) {
-          let defers = thawButtons.map(item => {
-            return new Promise((resolve) => {
-              Api.getSystemConfig({
-                func: 'sPC_MainMenu_ReDel',
-                MenuID: item
-              }).then(res => {
-                if (res.status) {
-                  resolve('')
-                } else {
-                  resolve(res.message)
-                }
-              })
-            })
-          })
+  //       return true
+  //     }).then(res => {
+  //       if (res === true || res === false) return res
 
-          return Promise.all(defers)
-        } else {
-          return true
-        }
-      }).then(res => {
-        if (res === true || res === false) return res
+  //       let msg = res.filter(Boolean)[0]
+  //       if (msg) {
+  //         notification.warning({
+  //           top: 92,
+  //           message: msg,
+  //           duration: 5
+  //         })
+  //         return false
+  //       } else {
+  //         return 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()
+  //           })
 
-        let msg = res.filter(Boolean)[0]
-        if (msg) {
-          notification.warning({
-            top: 92,
-            message: msg,
-            duration: 5
-          })
-          return false
-        } else {
-          this.setState({
-            thawButtons: []
-          })
-          return true
-        }
-      }).then(resp => {
-        if (resp === false) return
-        let localParam = fromJS(param).toJS()
-        Api.getSystemConfig(param).then(response => {
-          if (response.status) {
-            this.setState({
-              config: _config,
-              openEdition: response.open_edition || '',
-              originMenu: fromJS(_config).toJS()
-            }, () => {
-              reload && MKEmitter.emit('revert')
-            })
-
-            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
-
-            this.submitAction(btnParam, tabParam, localParam)
-          } else {
-            this.setState({
-              menuloading: false,
-              menucloseloading: false
-            })
-            notification.warning({
-              top: 92,
-              message: response.message,
-              duration: 5
-            })
-          }
-        })
-      })
-    }, +sessionStorage.getItem('mkDelay'))
-  }
+  //           this.submitAction(btnParam)
+  //         } else {
+  //           this.setState({
+  //             menuloading: false,
+  //             menucloseloading: false
+  //           })
+  //           notification.warning({
+  //             top: 92,
+  //             message: response.message,
+  //             duration: 5
+  //           })
+  //         }
+  //       })
+  //     })
+  //   }, +sessionStorage.getItem('mkDelay'))
+  // }
 
   /**
    * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽泦
    */
-  submitAction = (btnParam, tabParam, localParam) => {
-    const { config } = this.state
+  // submitAction = (btnParam) => {
+  //   const { config } = this.state
 
-    new Promise(resolve => {
-      let deffers = []
+  //   new Promise(resolve => {
+  //     if (btnParam.LText) {
+  //       Api.getCloudConfig(btnParam).then(result => {
+  //         if (result.status) {
+  //           this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛�
+  //             copyActions: []
+  //           })
+  //           resolve(result)
+  //         } else {
+  //           notification.warning({
+  //             top: 92,
+  //             message: result.message,
+  //             duration: 5
+  //           })
+  //           resolve(false)
+  //         }
+  //       })
+  //     } else {
+  //       resolve(true)
+  //     }
+  //   }).then(response => {
+  //     if (response === false) return response
 
-      let defer = new Promise(resolve => {
-        Api.getSystemConfig(tabParam).then(result => {
-          resolve(result)
-        })
-      })
-      deffers.push(defer)
+  //     if (!this.state.originActions || this.state.originActions.length === 0) return 'true'
 
-      if (btnParam.LText) {
-        let defer = new Promise(resolve => {
-          Api.getSystemConfig(btnParam).then(result => {
-            if (result.status) {
-              this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛�
-                copyActions: []
-              })
-            }
-            resolve(result)
-          })
-        })
-        deffers.push(defer)
-      }
+  //     let oriActions = []
+  //     this.state.originActions.forEach(item => {
+  //       let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦�
+  //       if (!curBtn) return
+  //       if (curBtn.OpenType !== item.prebtn.OpenType) return
+  //       if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return
 
-      Promise.all(deffers).then(result => {
-        let error = false
-        result.forEach(res => {
-          if (!res.status) {
-            error = res
-          }
-        })
+  //       oriActions.push({
+  //         prebtn: item.prebtn,
+  //         curBtn: curBtn
+  //       })
+  //     })
 
-        if (error) {
-          notification.warning({
-            top: 92,
-            message: error.message,
-            duration: 5
-          })
-          resolve(false)
-        } else {
-          resolve(true)
-        }
-      })
-    }).then(response => {
-      if (response === false) return response
+  //     if (oriActions.length === 0) return 'true'
 
-      if (!this.state.originActions || this.state.originActions.length === 0) return 'true'
+  //     oriActions.forEach(action => {
+  //       if (!action.prebtn || !action.prebtn.uuid) return
 
-      let oriActions = []
-      this.state.originActions.forEach(item => {
-        let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦�
-        if (!curBtn) return
-        if (curBtn.OpenType !== item.prebtn.OpenType) return
-        if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return
+  //       Api.getCloudConfig({
+  //         func: 'sPC_Get_LongParam',
+  //         MenuID: action.prebtn.uuid
+  //       }).then(result => {
+  //         if (result.status && result.LongParam) {
+  //           let _temp = ''
 
-        oriActions.push({
-          prebtn: item.prebtn,
-          curBtn: curBtn
-        })
-      })
+  //           let _subconfig = ''
+  //           try {
+  //             _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
+  //             _temp = _subconfig.type
+  //           } catch (e) {
+  //             console.warn('Parse Failure')
+  //             _subconfig = ''
+  //           }
 
-      if (oriActions.length === 0) return 'true'
+  //           if (!_subconfig) return
 
-      oriActions.forEach(action => {
-        if (!action.prebtn || !action.prebtn.uuid) return
-
-        Api.getSystemConfig({
-          func: 'sPC_Get_LongParam',
-          MenuID: action.prebtn.uuid
-        }).then(result => {
-          if (result.status && result.LongParam) {
-            let _temp = ''
-
-            let _subconfig = ''
-            try {
-              _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
-              _temp = _subconfig.type
-            } catch (e) {
-              console.warn('Parse Failure')
-              _subconfig = ''
-            }
-
-            if (!_subconfig) return
-
-            let param = {
-              func: 'sPC_ButtonParam_AddUpt',
-              ParentID: this.props.menu.MenuID,
-              MenuID: action.curBtn.uuid,
-              MenuNo: config.MenuNo,
-              Template: _temp,
-              MenuName: action.curBtn.label,
-              PageParam: JSON.stringify({Template: _temp}),
-              LongParam: result.LongParam
-            }
-            Api.getSystemConfig(param).then(() => {})
-          }
-        })
-      })
-      return 'true'
-    }).then(response => {
-      if (response === 'true') {
-        notification.success({
-          top: 92,
-          message: '淇濆瓨鎴愬姛',
-          duration: 2
-        })
-        if (this.state.closeVisible) {
-          this.props.handleView()
-        } else {
-          this.setState({
-            originActions: [],
-            menuloading: false,
-            menucloseloading: false
-          })
-        }
-        this.props.reloadmenu()
-        Api.genericInterface(localParam)
-      } else {
-        this.setState({
-          menuloading: false,
-          menucloseloading: false
-        })
-      }
-    })
-  }
+  //           let param = {
+  //             func: 'sPC_ButtonParam_AddUpt',
+  //             ParentID: this.props.menu.MenuID,
+  //             MenuID: action.curBtn.uuid,
+  //             MenuNo: config.MenuNo,
+  //             Template: _temp,
+  //             MenuName: action.curBtn.label,
+  //             PageParam: JSON.stringify({Template: _temp}),
+  //             LongParam: result.LongParam
+  //           }
+  //           Api.getCloudConfig(param).then(() => {})
+  //         }
+  //       })
+  //     })
+  //     return 'true'
+  //   }).then(response => {
+  //     if (response === 'true') {
+  //       notification.success({
+  //         top: 92,
+  //         message: '淇濆瓨鎴愬姛',
+  //         duration: 2
+  //       })
+  //       if (this.state.closeVisible) {
+  //         this.props.handleView()
+  //       } else {
+  //         this.setState({
+  //           originActions: [],
+  //           menuloading: false,
+  //           menucloseloading: false
+  //         })
+  //       }
+  //       this.props.reloadmenu()
+  //     } else {
+  //       this.setState({
+  //         menuloading: false,
+  //         menucloseloading: false
+  //       })
+  //     }
+  //   })
+  // }
 
   /**
    * @description 鐐瑰嚮杩斿洖鏃讹紝鍒ゆ柇閰嶇疆淇濆瓨鐘舵��
    */
   cancelConfig = () => {
-    const { config, originMenu } = this.state
+    // const { config, originMenu } = this.state
 
-    let _this = this
+    // let that = this
 
-    if (config.isAdd) {
-      confirm({
-        content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�',
-        onOk() {
-          _this.props.handleView()
-        },
-        onCancel() {}
-      })
-    } else {
-      if (!is(fromJS(originMenu), fromJS(config))) {
-        this.setState({
-          closeVisible: true
-        })
-      } else {
-        this.props.handleView()
-      }
-    }
+    // 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()
   }
 
   /**
@@ -848,7 +789,7 @@
         loading: true
       })
 
-      Api.getSystemConfig({
+      Api.getCloudConfig({
         func: 'sPC_Get_LongParam',
         MenuID: uuid
       }).then(res => {
@@ -969,23 +910,6 @@
     })
     
     config.action && config.action.forEach((btn) => {
-      if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
-        let hascheck = false
-        btn.verify.scripts.forEach(item => {
-          if (item.status === 'false') return
-    
-          if (/\$check@|@check\$/ig.test(item.sql)) {
-            hascheck = true
-          }
-        })
-        if (hascheck) {
-          notification.warning({
-            top: 92,
-            message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`,
-            duration: 5
-          })
-        }
-      }
       if (btn.intertype === 'custom' && btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) {
         notification.warning({
           top: 92,
@@ -995,7 +919,7 @@
       }
     })
 
-    if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) {
+    if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) {
       return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒'
     } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) {
       return '鏁版嵁婧愭湭璁剧疆鍓嶇疆鑴氭湰锛屼笉鍙惎鐢紒'
@@ -1025,7 +949,7 @@
         func: 'sPC_MainMenu_Del',
         MenuID: item
       }
-      Api.getSystemConfig(_param)
+      Api.getCloudConfig(_param)
     })
     this.props.handleView()
   }
@@ -1035,7 +959,6 @@
    */
   editConfig = (res) => {
     this.setState({
-      thawButtons: res.thawButtons,
       config: res.config
     })
   }
@@ -1089,7 +1012,7 @@
       MenuID: menu.MenuID
     }
 
-    Api.getSystemConfig(param).then(res => {
+    Api.getCloudConfig(param).then(res => {
       if (res.status) {
         let _config = ''
         if (res.LongParam) {
@@ -1144,11 +1067,9 @@
 
   render () {
     const { menu } = this.props
-    const { activeKey, config, chartview, openEdition } = this.state
+    const { activeKey, config, chartview } = 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')))
 
     let configTabs = []
     config.tabgroups.forEach(group => {
@@ -1180,74 +1101,6 @@
                   updatetable={this.updateconfig}
                 />
               </Panel>
-              {/* 鎼滅储鏉′欢娣诲姞 */}
-              <Panel header="鎼滅储" key="1">
-                <div className="search-element">
-                  {Source.searchItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
-                </div>
-                <FieldsComponent config={config} type="search" />
-              </Panel>
-              {/* 鎸夐挳娣诲姞 */}
-              <Panel header="鎸夐挳" key="2">
-                <div className="search-element">
-                  {Source.actionItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
-                </div>
-                <div className="config-btn">
-                  {confActions.length > 0 ?
-                    <p className="config-btn-title">
-                      <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫寜閽厤缃俊鎭��">
-                        <QuestionCircleOutlined className="mk-form-tip"/>
-                      </Tooltip>
-                      鎸夐挳閰嶇疆
-                    </p> : null
-                  }
-                </div>
-                {confActions.map((item, index) => {
-                  return (
-                    <div key={index}>
-                      <Button
-                        icon={item.icon}
-                        style={{marginBottom: '10px'}}
-                        className={'config-button mk-btn mk-' + item.class}
-                        onClick={() => this.setSubConfig(item, 'button')}
-                      >{item.label}</Button>
-                    </div>
-                  )
-                })}
-              </Panel>
-              {/* 娣诲姞鏄剧ず鍒� */}
-              <Panel header="鏄剧ず鍒�" key="3">
-                <div className="search-element">
-                  {Source.columnItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
-                </div>
-                <FieldsComponent config={config} type="columns"/>
-              </Panel>
-              {/* 娣诲姞鏍囩 */}
-              <Panel header="鏍囩椤�" key="4">
-                <div className="search-element">
-                  {Source.tabItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
-                </div>
-                {configTabs.length > 0 ?
-                  <p className="config-btn-title">
-                    <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫爣绛鹃厤缃俊鎭��">
-                      <QuestionCircleOutlined className="mk-form-tip"/>
-                    </Tooltip>
-                    鏍囩閰嶇疆
-                  </p> : null
-                }
-                {configTabs.map((item, index) => {
-                  return (
-                    <div key={index}>
-                      <Button
-                        className="config-button"
-                        icon={item.icon}
-                        style={{marginBottom: '10px'}}
-                        onClick={() => this.setSubConfig(item, 'tab')}
-                      >{item.label}</Button>
-                    </div>
-                  )
-                })}
-              </Panel>
             </Collapse>
           </div>
           <div className="setting">
@@ -1259,11 +1112,12 @@
             } 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 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="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
-                <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button>
+                {/* <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> */}
+                {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */}
+                {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> */}
+                <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%' }}>
@@ -1352,7 +1206,7 @@
           </div>
         </DndProvider>
         {/* 杩斿洖鏃舵湭淇濆瓨鎻愮ず */}
-        <Modal
+        {/* <Modal
           bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}}
           closable={false}
           maskClosable={false}
@@ -1366,7 +1220,7 @@
           destroyOnClose
         >
           閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛�
-        </Modal>
+        </Modal> */}
         {this.state.loading && <Spin size="large" />}
       </div>
     )

--
Gitblit v1.8.0