From a1e9b18a4dbfd21e1bf4d5cb60974ac2f0115efd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 30 五月 2025 15:18:44 +0800
Subject: [PATCH] 2025-05-30

---
 src/tabviews/zshare/actionList/index.jsx |  174 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 117 insertions(+), 57 deletions(-)

diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx
index 3d00fe4..c0945f5 100644
--- a/src/tabviews/zshare/actionList/index.jsx
+++ b/src/tabviews/zshare/actionList/index.jsx
@@ -1,11 +1,10 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Affix } from 'antd'
+import { Affix, Dropdown } from 'antd'
+import { DownOutlined } from '@ant-design/icons'
 
 import asyncComponent from './asyncButtonComponent'
-import zhCN from '@/locales/zh-CN/main.js'
-import enUS from '@/locales/en-US/main.js'
 import './index.scss'
 
 const NormalButton = asyncComponent(() => import('./normalbutton'))
@@ -16,151 +15,206 @@
 const NewPageButton = asyncComponent(() => import('./newpagebutton'))
 const ChangeUserButton = asyncComponent(() => import('./changeuserbutton'))
 const PrintButton = asyncComponent(() => import('./printbutton'))
+const FuncMegvii = asyncComponent(() => import('./funcMegvii'))
+const FuncZip = asyncComponent(() => import('./funczip'))
+const EditLine = asyncComponent(() => import('./editLine'))
+const ExportPdf = asyncComponent(() => import('./exportPdf'))
+const FuncButton = asyncComponent(() => import('./funcbutton'))
 
 class ActionList extends Component {
   static propTpyes = {
     BID: PropTypes.any,               // 涓昏〃ID
     BData: PropTypes.any,             // 涓昏〃鏁版嵁
-    MenuName: PropTypes.any,          // 鑿滃崟鍚嶇О
     selectedData: PropTypes.any,      // 瀛愯〃涓�夋嫨鏁版嵁
-    Tab: PropTypes.any,               // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭�
     MenuID: PropTypes.string,         // 鑿滃崟ID
     actions: PropTypes.array,         // 鎸夐挳缁�
-    logcolumns: PropTypes.array,      // 鏄剧ず鍒�
+    columns: PropTypes.array,         // 鏄剧ず鍒�
     setting: PropTypes.any,           // 椤甸潰閫氱敤璁剧疆
-    ContainerId: PropTypes.any,       // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒�
-    refreshdata: PropTypes.func,      // 鎵ц瀹屾垚鍚庢暟鎹埛鏂�
-    getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
+    actions: [],
+    mores: null
+  }
+
+  UNSAFE_componentWillMount() {
+    const { setting, actions } = this.props
+
+    if (!setting.btnlimit || setting.btnlimit >= actions.length) {
+      this.setState({actions: actions})
+    } else {
+      let mores = fromJS(actions).toJS()
+      
+      this.setState({
+        actions: mores.splice(0, setting.btnlimit),
+        mores
+      })
+    }
   }
 
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
   }
 
-  updateStatus = (type, positon) => {
-    if (type === 'refresh') {
-      this.props.refreshdata(positon)
-    } else if (type === 'trigger') { // 鏃ュ巻涓殑鏂版爣绛鹃〉瑙﹀彂浜嬩欢
-      this.props.refreshdata('trigger')
-    }
-  }
-
   getButtonList = (actions) => {
-    const { BID, BData, MenuID, Tab, logcolumns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props
-
+    const { BID, BData, MenuID, columns, setting, selectedData } = this.props
     return actions.map(item => {
       if (['exec', 'prompt', 'pop'].includes(item.OpenType)) {
         return (
           <NormalButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
             BID={BID}
-            Tab={Tab}
             btn={item}
             BData={BData}
             setting={setting}
-            MenuName={MenuName}
-            columns={logcolumns}
-            ContainerId={ContainerId}
+            columns={columns}
             selectedData={selectedData}
-            updateStatus={this.updateStatus}
           />
         )
       } else if (item.OpenType === 'excelIn') {
         return (
           <ExcelInButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
             BID={BID}
-            Tab={Tab}
             btn={item}
+            BData={BData}
             setting={setting}
-            MenuName={MenuName}
             selectedData={selectedData}
-            updateStatus={this.updateStatus}
           />
         )
       } else if (item.OpenType === 'excelOut') {
         return (
           <ExcelOutButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
             BID={BID}
-            Tab={Tab}
             btn={item}
+            BData={BData}
             setting={setting}
-            MenuName={MenuName}
-            getexceloutparam={getexceloutparam}
-            updateStatus={this.updateStatus}
+            selectedData={selectedData}
           />
         )
       } else if (item.OpenType === 'popview') {
         return (
           <PopupButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
             BID={BID}
-            Tab={Tab}
             btn={item}
             BData={BData}
             setting={setting}
             selectedData={selectedData}
-            updateStatus={this.updateStatus}
           />
         )
-      } else if (item.OpenType === 'tab' || item.OpenType === 'blank') {
+      } else if (item.OpenType === 'tab') {
         return (
           <TabButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
             btn={item}
+            BID={BID}
+            BData={BData}
             MenuID={MenuID}
-            setting={setting}
             selectedData={selectedData}
-            updateStatus={this.updateStatus}
           />
         )
       } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') {
         return (
           <NewPageButton
             key={item.uuid}
-            show="actionList"
+            show={item.show || 'actionList'}
+            disabled={false}
+            BID={BID}
             btn={item}
-            setting={setting}
+            BData={BData}
+            columns={columns}
             selectedData={selectedData}
-            updateStatus={this.updateStatus}
           />
         )
       } else if (item.OpenType === 'funcbutton') {
-        if (item.funcType === 'changeuser') {
+        if (item.funcType === 'changeuser' || item.funcType === 'closetab') {
           return (
             <ChangeUserButton
               key={item.uuid}
-              show="actionList"
+              show={item.show || 'actionList'}
+              disabled={false}
               BID={BID}
               btn={item}
+              BData={BData}
+              MenuID={MenuID}
               setting={setting}
               selectedData={selectedData}
-              updateStatus={this.updateStatus}
             />
           )
         } else if (item.funcType === 'print') {
           return (
             <PrintButton
               key={item.uuid}
-              show="actionList"
+              show={item.show || 'actionList'}
+              disabled={false}
               BID={BID}
-              Tab={Tab}
               btn={item}
               BData={BData}
               setting={setting}
-              ContainerId={ContainerId}
+              columns={columns}
               selectedData={selectedData}
-              updateStatus={this.updateStatus}
+            />
+          )
+        } else if (item.funcType === 'megvii') {
+          return (
+            <FuncMegvii
+              key={item.uuid}
+              show={item.show || 'actionList'}
+              disabled={false}
+              BID={BID}
+              btn={item}
+              setting={setting}
+              selectedData={selectedData}
+            />
+          )
+        } else if (item.funcType === 'filezip') {
+          return (
+            <FuncZip
+              key={item.uuid}
+              disabled={false}
+              BID={BID}
+              btn={item}
+              BData={BData}
+              setting={setting}
+              selectedData={selectedData}
+            />
+          )
+        } else if (item.funcType === 'expPdf') {
+          return (
+            <ExportPdf
+              key={item.uuid}
+              btn={item}
+            />
+          )
+        } else if (item.funcType === 'addline' || item.funcType === 'delline') {
+          return (
+            <EditLine
+            key={item.uuid}
+            disabled={false}
+            btn={item}
+            selectedData={selectedData}
+            />
+          )
+        } else {
+          return (
+            <FuncButton
+              key={item.uuid}
+              BID={BID}
+              btn={item}
+              columns={columns}
+              selectedData={selectedData}
             />
           )
         }
@@ -170,21 +224,27 @@
   }
 
   render() {
-    const { setting, MenuID, actions } = this.props
-    let fixed = setting.actionfixed && setting.tabType === 'main' // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮�
+    const { setting } = this.props
+    const { actions, mores } = this.state
 
-    if (fixed) {
+    if (setting.actionfixed === 'true') {
       return (
         <Affix offsetTop={48}>
-          <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}>
+          <div className="button-list toolbar-button">
             {this.getButtonList(actions)}
+            {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}>
+              <div className="mk-button-more">{window.GLOB.dict['more'] || '鏇村'}<DownOutlined/></div>
+            </Dropdown> : null}
           </div>
         </Affix>
       )
     } else {
       return (
-        <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}>
+        <div className="button-list toolbar-button">
           {this.getButtonList(actions)}
+          {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}>
+            <div className="mk-button-more">{window.GLOB.dict['more'] || '鏇村'}<DownOutlined/></div>
+          </Dropdown> : null}
         </div>
       )
     }

--
Gitblit v1.8.0