From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/zshare/actionList/funcMegvii/index.jsx |  124 ++++++++++++++++++++--------------------
 1 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/src/tabviews/zshare/actionList/funcMegvii/index.jsx b/src/tabviews/zshare/actionList/funcMegvii/index.jsx
index 0c80f56..246c2b5 100644
--- a/src/tabviews/zshare/actionList/funcMegvii/index.jsx
+++ b/src/tabviews/zshare/actionList/funcMegvii/index.jsx
@@ -1,8 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { withRouter } from 'react-router'
 import { is, fromJS } from 'immutable'
-import { Button, Modal, notification, message } from 'antd'
+import { Button, Modal, notification, message, Progress } from 'antd'
 import CryptoJS from 'crypto-js'
 import moment from 'moment'
 
@@ -26,6 +25,7 @@
     loading: false,
     disabled: false,
     loadingNumber: '',
+    loadingTotal: '',
     hidden: false,
     IpList: [],
     lines: [],
@@ -98,12 +98,7 @@
     const { loading, disabled } = this.state
 
     if (loading || disabled) return
-    if (triggerId) {
-      if (btn.uuid !== triggerId) return
-      if (this.props.lineId && record && record[0] && this.props.lineId !== record[0].$$key) {
-        return
-      }
-    }
+    if (triggerId && btn.uuid !== triggerId) return
 
     if (((Tab && Tab.supMenu) || setting.supModule) && !BID) {
       notification.warning({
@@ -112,10 +107,8 @@
         duration: 5
       })
       return
-    } else if (type === 'linkbtn' && selectedData && selectedData.length === 1) {
-      if (record[0].$Index !== selectedData[0].$Index) {
-        return
-      }
+    } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) {
+      return
     }
 
     let data = record || selectedData || []
@@ -135,7 +128,6 @@
       loading: true,
       lines: data
     })
-
     this.getIpList()
   }
 
@@ -195,6 +187,7 @@
   }
 
   loginDevice = () => {
+    const { btn } = this.props
     const { lines, selectIp } = this.state
 
     // 涓婃姤鎺ュ彛璁剧疆锛氬伐绋嬫ā寮�-鍦烘櫙妯″紡-寮�鏀炬帴鍙h缃�-鏁版嵁涓婃姤璁剧疆-鏁版嵁涓婃姤鏈嶅姟鍣ㄥ湴鍧�锛堝紑鍚湇鍔″櫒浜屾閴存潈锛�
@@ -244,6 +237,12 @@
           }
         })
 
+        if (data.length > 1 && btn.progress === 'progressbar') {
+          this.setState({
+            loadingTotal: data.length
+          })
+        }
+
         this.addUser(ip, data, result.session_id)
       })
     }, err => {
@@ -255,7 +254,7 @@
     let data = datas.shift()
 
     this.setState({
-      loadingNumber: datas.length || ''
+      loadingNumber: datas.length
     })
 
     let error = ''
@@ -332,7 +331,8 @@
 
     this.setState({
       loading: false,
-      loadingNumber: ''
+      loadingNumber: '',
+      loadingTotal: ''
     })
     
     // if (btn.execSuccess !== 'never') {
@@ -415,7 +415,8 @@
     
     this.setState({
       loading: false,
-      loadingNumber: ''
+      loadingNumber: '',
+      loadingTotal: ''
     })
 
     // if (btn.execError !== 'never') {
@@ -490,57 +491,56 @@
   }
 
   render() {
-    const { btn, show } = this.props
-    const { loading, disabled, hidden, loadingNumber } = this.state
+    const { btn } = this.props
+    const { loading, disabled, hidden, loadingNumber, loadingTotal } = this.state
 
     if (hidden) return null
 
-    if (show === 'actionList') {
-      return (
-        <>
-          <Button
-            icon={btn.icon}
-            loading={loading}
-            disabled={disabled}
-            title={disabled ? (btn.reason || '') : ''}
-            className={'mk-btn mk-' + btn.class}
-            onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
-          >{(loadingNumber ? `(${loadingNumber})` : '') + btn.label}</Button>
-          {this.getModels()}
-        </>
-      )
-    } else { // icon銆乼ext銆� all 鍗$墖
-      let label = ''
-      let icon = ''
+    let label = ''
+    let icon = ''
+    let type = 'link'
+    let className = ''
 
-      if (show === 'button') {
-        label = btn.label
-        icon = btn.icon || ''
-      } else if (show === 'link') {
-        label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
-        icon = ''
-      } else if (show === 'icon') {
-        icon = btn.icon || ''
-      } else {
-        label = btn.label
-      }
-
-      return (
-        <>
-          <Button
-            type="link"
-            title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')}
-            loading={loading}
-            disabled={disabled}
-            style={btn.style}
-            icon={icon}
-            onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
-          >{label}</Button>
-          {this.getModels()}
-        </>
-      )
+    if (btn.show === 'button') {
+      label = btn.label
+      icon = btn.icon || ''
+    } else if (btn.show === 'link') {
+      label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
+      icon = ''
+    } else if (btn.show === 'icon') {
+      icon = btn.icon || ''
+    } else if (!btn.$toolbtn) {
+      icon = btn.icon || ''
+      label = btn.label
+      className = 'mk-btn mk-' + btn.class
+    } else {
+      type = ''
+      icon = btn.icon || ''
+      label = btn.label
+      className = 'mk-btn mk-' + btn.class
     }
+    
+    if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) {
+      label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label
+    }
+
+    return (
+      <>
+        <Button
+          type={type}
+          title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
+          loading={loading}
+          disabled={disabled}
+          style={btn.style}
+          icon={icon}
+          className={className}
+          onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
+        >{label}</Button>
+        {this.getModels()}
+        {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null}
+      </>
+    )
   }
 }
 
-export default withRouter(FuncButton)
\ No newline at end of file
+export default FuncButton
\ No newline at end of file

--
Gitblit v1.8.0