From 191d6d48a282479c02ea212ca33789ad34137361 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 11 一月 2021 16:21:17 +0800
Subject: [PATCH] 2021-01-11

---
 src/tabviews/calendar/index.jsx |  117 +++++++++-------------------------------------------------
 1 files changed, 18 insertions(+), 99 deletions(-)

diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx
index 80e4661..550326c 100644
--- a/src/tabviews/calendar/index.jsx
+++ b/src/tabviews/calendar/index.jsx
@@ -2,7 +2,7 @@
 import PropTypes from 'prop-types'
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import { notification, Spin, Modal, Button, message, Tree, Typography } from 'antd'
+import { notification, Spin, Modal, Button } from 'antd'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -20,9 +20,7 @@
 const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch'))
 const CalendarComponent = asyncSpinComponent(() => import('@/tabviews/zshare/calendar'))
 const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable'))
-
-const { TreeNode } = Tree
-const { Paragraph } = Typography
+const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage'))
 
 class NormalTable extends Component {
   static propTpyes = {
@@ -49,9 +47,7 @@
     search: '',           // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞�
     visible: false,       // 鏍囩椤垫帶鍒�
     triggerTime: '',      // 鐐瑰嚮鏃堕棿
-    treevisible: false,   // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒�
     calendarYear: moment().format('YYYY'), // 鏃ュ巻骞翠唤
-    debug: sessionStorage.getItem('debug') === 'true'
   }
 
   /**
@@ -113,6 +109,9 @@
         if (config.tab && !permAction[config.tab.linkTab]) {
           config.tab = null
         }
+      }
+      if (config.tab) {
+        config.tab.uuid = Utils.getuuid()
       }
 
       if (_curUserConfig) {
@@ -454,65 +453,6 @@
     })
   }
 
-  handleviewconfig = (e) => {
-    e.stopPropagation()
-
-    const { MenuNo } = this.props
-    const { config } = this.state
-
-    if (config && config.funcs && config.funcs.length > 0) {
-      this.setState({
-        treevisible: true
-      })
-    } else {
-      let oInput = document.createElement('input')
-      oInput.value = MenuNo || ''
-      document.body.appendChild(oInput)
-      oInput.select()
-      document.execCommand('Copy')
-      document.body.removeChild(oInput)
-      message.success(this.state.dict['main.copy.success'])
-    }
-  }
-
-  getTreeNode = (data) => {
-    let _type = {
-      view: '椤甸潰',
-      btn: '鎸夐挳',
-      tab: '鏍囩'
-    }
-
-    return data.map(item => {
-      let _title = _type[item.subtype]
-      let _others = []
-
-      _others.push(
-        (item.menuNo ? item.menuNo + '(鑿滃崟鍙傛暟)' : ''),
-        (item.tableName ? item.tableName + '(琛ㄥ悕) ' : ''),
-        (item.innerFunc ? item.innerFunc + '(鍐呴儴鍑芥暟) ' : ''),
-        (item.outerFunc ? item.outerFunc + '(澶栭儴鍑芥暟)' : '')
-      )
-      _others = _others.filter(Boolean)
-      _others = _others.join('銆�')
-
-      if (item.label) {
-        _title = _title + '(' + item.label + ')'
-      }
-      if (_others) {
-        _title = _title + ': ' + _others
-      }
-
-      if (item.subfuncs && item.subfuncs.length > 0) {
-        return (
-          <TreeNode title={_title} key={item.uuid} dataRef={item} selectable={false}>
-            {this.getTreeNode(item.subfuncs)}
-          </TreeNode>
-        )
-      }
-      return <TreeNode key={item.uuid} title={_title} isLeaf selectable={false} />
-    })
-  }
-
   reloadMenuView = (menuId) => {
     const { MenuID } = this.props
 
@@ -543,7 +483,9 @@
   }
 
   componentDidMount () {
+    MKEmitter.addListener('openNewTab', this.closeTab)
     MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
+    MKEmitter.addListener('refreshPopButton', this.refreshPopButton)
   }
 
   /**
@@ -553,13 +495,17 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('openNewTab', this.closeTab)
     MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
+    MKEmitter.removeListener('refreshPopButton', this.refreshPopButton)
   }
 
-  changeDate = (value) => {
-    this.setState({calendarYear: value}, () => {
-      this.loadmaindata()
-    })
+  refreshPopButton = (tabId) => {
+    const { config } = this.props
+
+    if (!config.tab || config.tab.uuid !== tabId) return
+
+    this.loadmaindata()
   }
 
   triggerDate = (item) => {
@@ -582,7 +528,7 @@
 
   render() {
     const { menuType } = this.props
-    const { debug, BID, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state
+    const { BID, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state
 
     return (
       <div className="calendar-page" id={this.state.ContainerId}>
@@ -591,32 +537,7 @@
           <MainSearch BID={BID} searchlist={searchlist} menuType={menuType} refreshdata={this.refreshbysearch}/> : null
         }
         {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null}
-        {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
-          icon="copy"
-          shape="circle"
-          className="common-table-copy"
-          onClick={this.handleviewconfig}
-        /> : null}
-        <Modal
-          className="menu-tree-modal"
-          title={'鑿滃崟缁撴瀯鏍�'}
-          width={'650px'}
-          maskClosable={false}
-          visible={this.state.treevisible}
-          onCancel={() => this.setState({treevisible: false})}
-          footer={[
-            <Button key="close" onClick={() => this.setState({treevisible: false})}>{this.state.dict['main.close']}</Button>
-          ]}
-          destroyOnClose
-        >
-          <div className="menu-header">
-            <span>鑿滃崟鍚嶇О锛歿this.props.MenuName}</span>
-            <span>鑿滃崟鍙傛暟锛歿<Paragraph copyable>{this.props.MenuNo}</Paragraph>}</span>
-          </div>
-          {this.state.treevisible ? <Tree defaultExpandAll showLine={true}>
-            {this.getTreeNode(config.funcs)}
-          </Tree> : null}
-        </Modal>
+        {menuType !== 'HS' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null}
         <Modal
           title={config.tab ? config.tab.label : ''}
           width={'80vw'}
@@ -631,10 +552,8 @@
           {config.tab ? <SubTabTable
             BID={triggerTime}
             Tab={config.tab}
-            SupMenuID={this.props.MenuID}
             MenuID={config.tab.linkTab}
-            refreshSupView={() => this.loadmaindata()}
-            closeModalView={this.closeTab}
+            SupMenuID={this.props.MenuID}
           /> : null}
         </Modal>
         {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}

--
Gitblit v1.8.0