From fb3ec146a9e1444ece749d0bcf232a554e933fb0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 五月 2022 22:56:16 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/views/menudesign/index.jsx |   64 ++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index f07b1fe..05c041b 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -4,6 +4,7 @@
 import moment from 'moment'
 import HTML5Backend from 'react-dnd-html5-backend'
 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 Api from '@/api'
@@ -72,7 +73,9 @@
     popBtn: null,             // 寮圭獥鏍囩椤�
     visible: false,
     customComponents: [],
-    comloading: false
+    comloading: false,
+    settingshow: true,
+    eyeopen: false
   }
 
   UNSAFE_componentWillMount() {
@@ -456,7 +459,7 @@
     })
   }
 
-  getMenuMessage = () => {
+  getMenuMessage = (delButtons) => {
     const { config } = this.state
     let buttons = []
     let _sort = 1
@@ -471,6 +474,10 @@
           traversal(item.components)
         } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) {
           item.action && item.action.forEach(btn => {
+            if (btn.hidden === 'true') {
+              delButtons.push(btn.uuid)
+              return
+            }
             this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
@@ -478,12 +485,20 @@
           item.subcards.forEach(card => {
             card.elements && card.elements.forEach(cell => {
               if (cell.eleType !== 'button') return
+              if (cell.hidden === 'true') {
+                delButtons.push(cell.uuid)
+                return
+              }
               this.checkBtn(cell)
               buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
             })
             card.backElements && card.backElements.forEach(cell => {
               if (cell.eleType !== 'button') return
+              if (cell.hidden === 'true') {
+                delButtons.push(cell.uuid)
+                return
+              }
               this.checkBtn(cell)
               buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
@@ -493,6 +508,10 @@
           item.subcards.forEach(card => {
             card.elements && card.elements.forEach(cell => {
               if (cell.eleType !== 'button') return
+              if (cell.hidden === 'true') {
+                delButtons.push(cell.uuid)
+                return
+              }
               this.checkBtn(cell)
               buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
@@ -501,18 +520,30 @@
         } else if (item.type === 'balcony') {
           item.elements && item.elements.forEach(cell => {
             if (cell.eleType !== 'button') return
+            if (cell.hidden === 'true') {
+              delButtons.push(cell.uuid)
+              return
+            }
             this.checkBtn(cell)
             buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
         } else if (item.type === 'line' || item.type === 'bar' || item.type === 'chart') {
           item.action && item.action.forEach(btn => {
+            if (btn.hidden === 'true') {
+              delButtons.push(btn.uuid)
+              return
+            }
             this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
           })
         } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) {
           item.action && item.action.forEach(btn => {
+            if (btn.hidden === 'true') {
+              delButtons.push(btn.uuid)
+              return
+            }
             this.checkBtn(btn)
             buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
             _sort++
@@ -520,6 +551,10 @@
           item.cols && item.cols.forEach(col => {
             if (col.type !== 'action') return
             col.elements.forEach(btn => {
+              if (btn.hidden === 'true') {
+                delButtons.push(btn.uuid)
+                return
+              }
               this.checkBtn(btn)
               buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`)
               _sort++
@@ -555,7 +590,7 @@
   }
 
   submitConfig = () => {
-    const { MenuType, delButtons, copyButtons, thawButtons } = this.state
+    const { MenuType, copyButtons, thawButtons } = this.state
     let config = fromJS(this.state.config).toJS()
 
     if (MenuType === 'billPrint' && (!config.firstCount || !config.everyPCount)) {
@@ -622,9 +657,10 @@
         LText: []
       }
 
+      let delButtons = fromJS(this.state.delButtons).toJS()
       let btnIds = '' // 鐢ㄤ簬澶嶅埗鎸夐挳鐨勮繃婊�
       if (MenuType !== 'billPrint') {
-        btnParam.LText = this.getMenuMessage()
+        btnParam.LText = this.getMenuMessage(delButtons)
         btnParam.LText = btnParam.LText.join(' union all ')
 
         btnIds = btnParam.LText
@@ -1055,8 +1091,16 @@
     })
   }
 
+  changeSetting = () => {
+    this.setState({settingshow: !this.state.settingshow})
+
+    setTimeout(() => {
+      MKEmitter.emit('tabsChange', 'all')
+    }, 400)
+  }
+
   render () {
-    const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, ParentId, MenuName, MenuNo, menuloading, customComponents } = this.state
+    const { activeKey, comloading, MenuType, popBtn, visible, dict, MenuId, config, settingshow, ParentId, MenuName, MenuNo, menuloading, customComponents, eyeopen } = this.state
 
     return (
       <ConfigProvider locale={_locale}>
@@ -1064,7 +1108,10 @@
           <Header />
           {!popBtn && !visible ? <DndProvider backend={HTML5Backend}>
             <div className="menu-body">
-              <div className="menu-setting">
+              <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}>
+                <div className="draw">
+                  {settingshow ? <DoubleLeftOutlined onClick={this.changeSetting}/> : <DoubleRightOutlined onClick={this.changeSetting}/>}
+                </div>
                 <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
                   {/* 鍩烘湰淇℃伅 */}
                   <Panel header={dict['mob.basemsg']} key="basedata">
@@ -1111,11 +1158,12 @@
                   </Panel>
                 </Collapse>
               </div>
-              <div className={'menu-view ' + (menuloading ? 'saving' : '')}>
+              <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}>
                 <Card title={
-                  <div> {config && config.MenuName} </div>
+                  <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div>
                 } bordered={false} extra={
                   <div>
+                    <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button>
                     <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/>
                     <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                     <SysInterface config={config} updateConfig={this.updateConfig}/>

--
Gitblit v1.8.0