From 78eed586f6a0d15162c89878c53a301e7b142a8a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 10 十月 2022 00:07:06 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/views/menudesign/index.jsx |   83 +++++++++++++++++++++++------------------
 1 files changed, 46 insertions(+), 37 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 063842e..357f02f 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -7,6 +7,7 @@
 import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd'
 import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'
 import html2canvas from 'html2canvas'
+import md5 from 'md5'
 
 import Api from '@/api'
 import options from '@/store/options.js'
@@ -39,6 +40,7 @@
 const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
 const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
 const Versions = asyncComponent(() => import('@/menu/versions'))
+const TableNodes = asyncComponent(() => import('@/menu/tablenodes'))
 const SysInterface = asyncComponent(() => import('@/menu/sysinterface'))
 const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent'))
 const PictureController = asyncComponent(() => import('@/menu/picturecontroller'))
@@ -108,7 +110,6 @@
   componentDidMount () {
     MKEmitter.addListener('delButtons', this.delButtons)
     MKEmitter.addListener('modalStatus', this.modalStatus)
-    // MKEmitter.addListener('thawButtons', this.thawButtons)
     MKEmitter.addListener('copyButtons', this.copyButtons)
     MKEmitter.addListener('changePopview', this.initPopview)
     MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave)
@@ -179,7 +180,6 @@
     }
     MKEmitter.removeListener('delButtons', this.delButtons)
     MKEmitter.removeListener('modalStatus', this.modalStatus)
-    // MKEmitter.removeListener('thawButtons', this.thawButtons)
     MKEmitter.removeListener('copyButtons', this.copyButtons)
     MKEmitter.removeListener('changePopview', this.initPopview)
     MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave)
@@ -355,10 +355,6 @@
   copyButtons = (items) => {
     this.setState({copyButtons: [...this.state.copyButtons, ...items]})
   }
-  
-  // thawButtons = (item) => {
-  //   this.setState({thawButtons: [...this.state.thawButtons, item]})
-  // }
 
   initPopview = (card, btn) => {
     const { oriConfig, config } = this.state
@@ -483,13 +479,16 @@
     })
   }
 
-  getMenuMessage = (delButtons) => {
+  getMenuMessage = (delButtons, tbs) => {
     const { config } = this.state
     let buttons = []
     let _sort = 1
 
     let traversal = (components) => {
       components.forEach(item => {
+        if (item.$tables) {
+          tbs.push(...item.$tables)
+        }
         if (item.type === 'tabs') {
           item.subtabs.forEach(tab => {
             traversal(tab.components)
@@ -621,6 +620,37 @@
         config.enabled = false
       }
 
+      let tbs = []
+      let delButtons = fromJS(this.state.delButtons).toJS()
+      let btns = this.getMenuMessage(delButtons, tbs)
+      let arr = []
+      tbs = tbs.filter(tb => {
+        let _tb = tb.toLowerCase()
+
+        if (arr.includes(_tb)) return false
+        arr.push(_tb)
+
+        return true
+      })
+      tbs.sort()
+      if (tbs.length && sessionStorage.getItem('mk_tb_names')) {
+        let names = sessionStorage.getItem('mk_tb_names')
+        tbs = tbs.filter(tb => names.indexOf(',' + tb.toLowerCase() + ',') > -1)
+      }
+      tbs = tbs.map(tb => `'${tb}'`).join(';')
+
+      let key = md5(config.uuid + tbs.toLowerCase())
+      let url = ''
+
+      if (config.tbkey === key) {
+        key = ''
+      } else {
+        let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
+        urlparam.type = 'admin'
+        url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
+        config.tbkey = key
+      }
+
       let param = {
         func: 'sPC_TrdMenu_AddUpt',
         FstID: config.fstMenuId || '',
@@ -632,10 +662,13 @@
         Template: 'CustomPage',
         MenuName: config.MenuName || '',
         PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}),
-        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))),
         open_edition: config.open_edition,
         LText: '',
-        LTexttb: ''
+        LTexttb: '',
+        debug_md5: key,
+        debug_url: url,
+        debug_list: window.btoa(tbs),
+        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
       }
 
       param.LText = Utils.formatOptions(param.LText)
@@ -653,10 +686,9 @@
         LText: []
       }
 
-      let delButtons = fromJS(this.state.delButtons).toJS()
       let btnIds = '' // 鐢ㄤ簬澶嶅埗鎸夐挳鐨勮繃婊�
       if (MenuType !== 'billPrint') {
-        btnParam.LText = this.getMenuMessage(delButtons)
+        btnParam.LText = btns
         btnParam.LText = btnParam.LText.join(' union all ')
 
         btnIds = btnParam.LText
@@ -728,28 +760,6 @@
           }
           return Api.getSystemConfig(_param)
         }
-      // }).then(res => { // 鎸夐挳瑙i櫎鍐荤粨
-      //   if (!res) return
-      //   if (!res.status) {
-      //     notification.warning({
-      //       top: 92,
-      //       message: res.message,
-      //       duration: 5
-      //     })
-      //     return false
-      //   }
-
-      //   let ids = thawButtons.filter(item => btnIds.indexOf(item) !== -1)
-      //   if (ids.length === 0) {
-      //     return {
-      //       status: true
-      //     }
-      //   } else {
-      //     return Api.getSystemConfig({
-      //       func: 'sPC_MainMenu_ReDel',
-      //       MenuID: ids.join(',')
-      //     })
-      //   }
       }).then(res => { // 椤甸潰淇濆瓨
         if (!res) return
 
@@ -1130,12 +1140,11 @@
                 </Collapse>
               </div>
               <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}>
-                <Card title={
-                  <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div>
-                } bordered={false} extra={
-                  <div>
+                <Card title={config ? config.MenuName : ''} bordered={false} extra={
+                  <div className="mk-opeartion-list">
                     <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button>
                     <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/>
+                    <TableNodes config={config} />
                     <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                     <SysInterface config={config} updateConfig={this.updateConfig}/>
                     <PictureController/>

--
Gitblit v1.8.0