From c3f562696aae30188e84e6686e6a7286d9cad676 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 24 十二月 2021 18:52:16 +0800
Subject: [PATCH] 2021-12-24

---
 src/tabviews/zshare/actionList/exceloutbutton/index.jsx |   41 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
index 3f3d390..79ef835 100644
--- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx
@@ -30,7 +30,25 @@
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     excelName: '',  // 鏂囦欢鍚�
     search: '',     // 鎼滅储鏉′欢
-    loading: false  // 瀵煎嚭涓�
+    loading: false, // 瀵煎嚭涓�
+    hidden: false
+  }
+
+  UNSAFE_componentWillMount () {
+    const { btn, BData } = this.props
+
+    if (btn.control === 'parent') {
+      if (!BData || !BData.hasOwnProperty(btn.controlField)) {
+        this.setState({hidden: true})
+      } else {
+        let s = BData[btn.controlField] + ''
+        if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) {
+          this.setState({hidden: true})
+        } else {
+          this.setState({hidden: false})
+        }
+      }
+    }
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -40,6 +58,23 @@
   componentDidMount () {
     MKEmitter.addListener('triggerBtnId', this.actionTrigger)
     MKEmitter.addListener('returnModuleParam', this.triggerExcelout)
+  }
+
+  UNSAFE_componentWillReceiveProps (nextProps) {
+    const { btn } = this.props
+
+    if (btn.control === 'parent') {
+      if (!nextProps.BData || !nextProps.BData.hasOwnProperty(btn.controlField)) {
+        this.setState({hidden: true})
+      } else {
+        let s = nextProps.BData[btn.controlField] + ''
+        if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) {
+          this.setState({hidden: true})
+        } else {
+          this.setState({hidden: false})
+        }
+      }
+    }
   }
 
   componentWillUnmount () {
@@ -875,7 +910,9 @@
 
   render() {
     const { btn, show } = this.props
-    const { loading } = this.state
+    const { loading, hidden } = this.state
+
+    if (hidden) return null
 
     if (show === 'actionList') {
       return (

--
Gitblit v1.8.0