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/normalbutton/index.jsx |  363 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 244 insertions(+), 119 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 3eff1c7..473d3e1 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1,9 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import moment from 'moment'
-import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import { Button, Modal, notification, message, Drawer, Switch, Checkbox } from 'antd'
+import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd'
 
 import Api from '@/api'
 import Utils, { getSysDefaultSql } from '@/utils/utils.js'
@@ -21,8 +20,6 @@
 
 class NormalButton extends Component {
   static propTpyes = {
-    show: PropTypes.any,              // 鎸夐挳鏄剧ず鏍峰紡鎺у埗
-    position: PropTypes.any,          // 鎸夐挳浣嶇疆锛屽伐鍏锋爮涓簍oolbar
     BID: PropTypes.string,            // 涓昏〃ID
     BData: PropTypes.any,             // 涓昏〃鏁版嵁
     style: PropTypes.any,             // 鎸夐挳鏍峰紡
@@ -33,7 +30,6 @@
     setting: PropTypes.any,           // 椤甸潰閫氱敤璁剧疆
     ContainerId: PropTypes.any,       // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒�
     disabled: PropTypes.any,          // 琛屾寜閽鐢�
-    lineId: PropTypes.any,            // 琛岀储寮�+涓婚敭鍊硷紝鐢ㄤ簬琛屾寜閽弻鍑�
   }
 
   state = {
@@ -45,6 +41,7 @@
     btnconfig: null,
     loading: false,
     loadingNumber: '',
+    loadingTotal: '',
     disabled: false,
     hidden: false,
     checkParam: null,
@@ -97,10 +94,10 @@
   }
 
   componentDidMount () {
-    const { position, btn } = this.props
+    const { btn } = this.props
 
     MKEmitter.addListener('triggerBtnId', this.actionTrigger)
-    if (position === 'form') {
+    if (btn.OpenType === 'formSubmit') {
       MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
     }
     MKEmitter.addListener('returnModuleParam', this.resetModuleParam)
@@ -234,12 +231,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({
@@ -248,17 +240,15 @@
         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
     }
 
     this.setState({autoMatic: type === 'autoMatic'})
 
     let _this = this
     let data = record || selectedData || []
-
+    
     if (btn.Ot !== 'notRequired' && data.length === 0) {
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
       notification.warning({
@@ -543,7 +533,7 @@
         }
       }
 
-      if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
+      if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
         if (check_param) {
           check_param.open_key = Utils.encryptOpenKey(check_param.secretkey, check_param.timestamp)
@@ -665,7 +655,7 @@
           }
         }
 
-        if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
+        if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
           param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
         }
 
@@ -714,7 +704,7 @@
         })
       }
 
-      if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+      if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
@@ -751,7 +741,7 @@
           param[setting.primaryKey] = primaryId
         }
 
-        if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
+        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
           param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
           param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
           param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
@@ -843,6 +833,10 @@
                     })
                   }, 600)
                 }
+
+                if (res.status) {
+                  this.triggerNote(res) // 娑堟伅
+                }
                 resolve(res)
               }, () => {
                 this.updateStatus()
@@ -870,6 +864,11 @@
           _resolve()
         })
       } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц
+        if (btn.progress === 'progressbar' && btn.$toolbtn) {
+          this.setState({
+            loadingTotal: params.length
+          })
+        }
         this.innerLoopRequest(params, btn, _resolve)
       }
     } else if (btn.intertype === 'outer') {
@@ -930,8 +929,14 @@
         })
       }
 
+      if (_params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) {
+        this.setState({
+          loadingTotal: _params.length
+        })
+      }
+
       // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛�
-      this.outerLoopRequest(_params, btn, _resolve, _params.length > 20)
+      this.outerLoopRequest(_params, btn, _resolve)
     } else if (btn.intertype === 'custom') { // 绯荤粺鎺ュ彛
       let params = []
 
@@ -945,6 +950,12 @@
         params = this.getInnerParam(data, formdata)
       }
 
+      if (params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) {
+        this.setState({
+          loadingTotal: params.length
+        })
+      }
+
       this.customLoopRequest(params, _resolve)
     }
   }
@@ -956,7 +967,7 @@
     let param = params.shift()
 
     this.setState({
-      loadingNumber: params.length || ''
+      loadingNumber: params.length
     })
 
     let record = {
@@ -1238,7 +1249,7 @@
         param.s_debug_type = 'Y'
       }
 
-      if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
+      if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
         param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
       }
     } else {
@@ -1287,7 +1298,7 @@
     let param = params.shift()
 
     this.setState({
-      loadingNumber: params.length || ''
+      loadingNumber: params.length
     })
 
     let _param = null
@@ -1319,6 +1330,9 @@
             })
           }, 600)
         }
+
+        this.triggerNote(res) // 娑堟伅
+
         if (params.length === 0) {
           this.execSuccess(res)
           _resolve()
@@ -1338,17 +1352,15 @@
   /**
    * @description 澶栭儴璇锋眰寰幆鎵ц
    */
-  outerLoopRequest = (params, btn, _resolve, widthNumber) => {
+  outerLoopRequest = (params, btn, _resolve) => {
     if (!params && params.length === 0) return
 
     let param = params.shift()
     let _outParam = null
 
-    if (widthNumber) {
-      this.setState({
-        loadingNumber: params.length || ''
-      })
-    }
+    this.setState({
+      loadingNumber: params.length
+    })
 
     new Promise(resolve => {
       // 鍐呴儴璇锋眰
@@ -1356,7 +1368,7 @@
         param.func = btn.innerFunc
 
         // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
-        if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) {
+        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) {
           param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
           param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp)
           param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
@@ -1397,7 +1409,7 @@
       if (btn.outerFunc) {
         res.func = btn.outerFunc
       }
-      if (this.props.menuType === 'HS') {
+      if (window.GLOB.mkHS) {
         if (btn.sysInterface === 'true' && options.cloudServiceApi) {
           res.rduri = options.cloudServiceApi
         } else if (btn.sysInterface !== 'true') {
@@ -1440,7 +1452,7 @@
         let _callbackparam = {..._outParam, ...response}
 
         // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉
-        if (this.props.menuType === 'HS' && _callbackparam.func === 's_sDataDictb_TBBack' && _callbackparam.LTextOut) {
+        if (window.GLOB.mkHS && _callbackparam.func === 's_sDataDictb_TBBack' && _callbackparam.LTextOut) {
           _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
           _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp)
           _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp)
@@ -1455,7 +1467,7 @@
             this.execSuccess(response)
             _resolve()
           } else {
-            this.outerLoopRequest(params, btn, _resolve, widthNumber)
+            this.outerLoopRequest(params, btn, _resolve)
           }
         } else {
           this.execError(response)
@@ -1470,7 +1482,7 @@
           this.execSuccess(res)
           _resolve()
         } else {
-          this.outerLoopRequest(params, btn, _resolve, widthNumber)
+          this.outerLoopRequest(params, btn, _resolve)
         }
       } else {
         this.execError(res)
@@ -1504,6 +1516,11 @@
     } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
 
     }
+
+    this.setState({
+      loadingNumber: '',
+      loadingTotal: '',
+    })
     
     if (autoMatic) {
       this.setState({
@@ -1519,13 +1536,13 @@
       })
     }
 
-    if (btn.verify && btn.verify.noteEnable === 'true') {
-      this.sendMessage()
-    }
-
     let id = ''
     if (btn.output) {
       id = res.mk_b_id || res[btn.output] || ''
+    }
+
+    if (res.mk_icon) {
+      sessionStorage.setItem('avatar', res.mk_icon)
     }
     let tabId = ''
     if (btn.refreshTab && btn.refreshTab.length > 0) {
@@ -1543,9 +1560,9 @@
       MKEmitter.emit('popclose')
     } else if (btn.execSuccess !== 'never') {
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines)
-    } else {
-      btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
     }
+    
+    btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
 
     if (tabId) {
       MKEmitter.emit('reloadMenuView', tabId, 'table')
@@ -1562,7 +1579,7 @@
       node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'})
     }
 
-    if (btn.openmenu && btn.openmenu.length > 0 && btn.MenuID) {
+    if (btn.MenuID && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) {
       let newtab = {
         MenuID: btn.MenuID,
         MenuName: btn.MenuName,
@@ -1581,13 +1598,139 @@
     }
   }
 
-  sendMessage = () => {
-    const { btn : { verify } } = this.props
+  triggerNote = (res) => {
+    const { btn } = this.props
 
+    if (!btn.verify) return
+    if (btn.verify.noteEnable !== 'true' && btn.verify.wxNote !== 'true') return
+
+    let id = ''
+    if (btn.output) {
+      id = res.mk_b_id || res[btn.output] || ''
+    }
+
+    if (!id) return
+
+    if (btn.verify.noteEnable === 'true') {
+      this.sendMessage(btn.verify, id)
+    }
+    if (btn.verify.wxNote === 'true') {
+      this.sendWxMessage(btn.verify, id)
+    }
+  }
+
+  sendWxMessage = (verify, id) => {
+    let param = {
+      func: 's_get_sms_weixin_local',
+      upid: id
+    }
+
+    param.LText = Utils.formatOptions(Utils.getuuid())
+    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+    Api.genericInterface(param).then(res => {
+      // res.data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: '2223333', first: '鎮ㄧ殑缂磋垂淇℃伅濡備笅', keyword1: '010000000001', keyword2: '2022骞�07鏈�03鏃�', keyword3: '渚涙殩缂磋垂', keyword4: '20鍏�', keyword5: '鎴愬姛', remark: '鎰熻阿鎮ㄧ殑浣跨敤锛�'}]
+      if (!res.status) {
+        notification.warning({
+          top: 92,
+          message: res.message,
+          duration: 5
+        })
+        return
+      } else if (!res.send_data || res.send_data.length === 0) {
+        return
+      }
+
+      let _param = {
+        touser: '',
+        template_id: verify.wxTemplateId,
+        data: {}
+      }
+
+      if (verify.wxNoteLink === 'url' && verify.wxNoteLinkUrl) {
+        _param.url = verify.wxNoteLinkUrl
+      } else if (verify.wxNoteLink === 'miniProgram' && window.GLOB.WXminiAppID) {
+        _param.miniprogram = {
+          appid: window.GLOB.WXminiAppID,
+          pagepath: '/pages/index/index'
+        }
+
+        if (verify.wxNoteLinkMenuId) {
+          _param.miniprogram.pagepath = `/pages/index/index?MenuId=${verify.wxNoteLinkMenuId}`
+        }
+      }
+
+      let keys = []
+      verify.wxNoteKeys.forEach(item => {
+        keys.push(item.key)
+
+        _param.data[item.key] = {value: '', color: item.color}
+      })
+
+      let params = res.send_data.map(item => {
+        let m = fromJS(_param).toJS()
+
+        m.touser = item.openid || ''
+        if (item.bid && m.miniprogram && m.miniprogram.pagepath.indexOf('MenuId') > -1) {
+          m.miniprogram.pagepath = m.miniprogram.pagepath + `&BID=${item.bid}`
+        }
+
+        if (item.send_id) { // 闃查噸鍏d
+          m.client_msg_id = item.send_id
+        }
+
+        keys.forEach(key => {
+          if (item[key] !== undefined) {
+            m.data[key].value = item[key]
+          }
+        })
+
+        return m
+      })
+
+      Api.wxAccessToken().then(res => {
+        if (!res.oa_access_token) return
+  
+        params.forEach(n => {
+          if (!n.touser) return
+
+          Api.wxNginxRequest(`cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => {
+            if (verify.wxNoteCallback === 'true') {
+              let _p = {
+                func: 's_get_sms_weixin_local_suc_err',
+                upid: id,
+                send_id: n.client_msg_id || '',
+                status_result: re.errcode === 0 ? 'S' : 'E',
+                msg_result: re.errmsg
+              }
+
+              _p.LText = Utils.formatOptions(Utils.getuuid())
+              _p.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+              _p.secretkey = Utils.encrypt(_p.LText, _p.timestamp)
+
+              Api.genericInterface(_p).then(result => {
+                if (!result.status) {
+                  notification.warning({
+                    top: 92,
+                    message: result.message,
+                    duration: 5
+                  })
+                }
+              })
+            }
+          })
+        })
+      })
+    })
+  }
+
+  sendMessage = (verify, id) => {
     let param = {
       func: 's_get_sms_local',
       TypeCharOne: verify.noteTemp, // N涓嶅悓鍐呭锛孻鐩稿悓鍐呭
-      TypeCharTwo: verify.noteType  // N瀹氭椂锛孻瀹炴椂
+      TypeCharTwo: verify.noteType, // N瀹氭椂锛孻瀹炴椂
+      upid: id
     }
 
     param.LText = Utils.formatOptions(Utils.getuuid())
@@ -1666,13 +1809,14 @@
       }
 
       if (Ltext.length === 0) return
+
       Ltext = Ltext.join(';')
 
       _param.LText = window.btoa(window.encodeURIComponent(Ltext))
       _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
       _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
 
-      _param.rduri = 'http://sso.mk9h.cn/webapi/dostars'
+      _param.rduri = 'https://sso.mk9h.cn/webapi/dostars'
 
       _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
       _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
@@ -1724,6 +1868,7 @@
       this.setState({
         loading: false,
         loadingNumber: '',
+        loadingTotal: '',
         visible: false
       })
       MKEmitter.emit('autoExecOver', btn.uuid, 'error')
@@ -1732,7 +1877,8 @@
     
     this.setState({
       loading: false,
-      loadingNumber: ''
+      loadingNumber: '',
+      loadingTotal: '',
     })
 
     if (res.ErrCode === 'C') {
@@ -2013,7 +2159,7 @@
 
     if (!btnconfig || !btnconfig.setting) return null
 
-    let title = btnconfig.setting.title
+    let title = btn.label
     let width = btnconfig.setting.width > 100 ? btnconfig.setting.width : btnconfig.setting.width + 'vw'
     let clickouter = btnconfig.setting.clickouter === 'close'
 
@@ -2038,7 +2184,6 @@
           <MutilForm
             BID={BID}
             dict={this.state.dict}
-            menuType={this.props.menuType}
             action={btnconfig}
             inputSubmit={this.handleOk}
             data={this.state.selines[0]}
@@ -2081,7 +2226,6 @@
           <MutilForm
             BID={BID}
             dict={this.state.dict}
-            menuType={this.props.menuType}
             action={btnconfig}
             inputSubmit={this.handleOk}
             data={this.state.selines[0]}
@@ -2094,81 +2238,62 @@
   }
 
   render() {
-    const { btn, show, style } = this.props
-    const { loadingNumber, loading, disabled, hidden, check } = this.state
+    const { btn } = this.props
+    const { loadingNumber, loadingTotal, loading, disabled, hidden, check } = this.state
 
     if (hidden) return null
 
     if (btn.OpenType === 'form') {
       if (btn.formType === 'switch') {
-        return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/>
+        return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/>
       } else {
-        return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={style}></Checkbox>
+        return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox>
       }
-    } else if (show === 'actionList') {
-      return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
-        <Button
-          style={style}
-          icon={btn.icon}
-          loading={loading}
-          disabled={disabled}
-          title={disabled ? (btn.reason || '') : ''}
-          className={'mk-btn mk-' + btn.class}
-          onClick={() => {this.actionTrigger()}}
-        >{(loadingNumber ? `(${loadingNumber})` : '') + btn.label}</Button>
-        {this.getModels()}
-      </div>
-    } else if (show && show.indexOf('plus') > -1) {
-      return <div style={{display: 'inline-block'}}>
-        <Button
-          type="link"
-          loading={loading}
-          icon={btn.icon || 'plus'}
-          style={{fontSize: show.substring(4) + 'px'}}
-          onClick={() => {this.actionTrigger()}}
-        ></Button>
-        {this.getModels()}
-      </div>
-    } else { // icon銆乼ext銆� all 鍗$墖
-      let label = ''
-      let icon = ''
-
-      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 <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
-        <Button
-          type="link"
-          title={disabled ? (btn.reason || '') : (show === 'icon' ? btn.label : '')}
-          loading={loading}
-          disabled={disabled}
-          style={btn.style || style}
-          icon={icon}
-          onClick={() => {this.actionTrigger()}}
-        >{label}</Button>
-        {this.getModels()}
-      </div>
     }
+
+    let label = ''
+    let icon = ''
+    let type = 'link'
+    let className = ''
+
+    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 || 'unset')
+    } else {
+      type = ''
+      icon = btn.icon || ''
+      label = btn.label
+      className = 'mk-btn mk-' + (btn.class || 'unset')
+    }
+
+    if (loadingNumber && !loadingTotal && btn.$toolbtn && (!btn.show || btn.show === 'button')) {
+      label = (loadingNumber && !loadingTotal ? `(${loadingNumber})` : '') + btn.label
+    }
+
+    return <>
+      <Button
+        type={type}
+        icon={icon}
+        title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
+        loading={loading}
+        disabled={disabled}
+        style={btn.style}
+        className={className}
+        onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
+      >{label}</Button>
+      <span onClick={(e) => {e.stopPropagation()}}>{this.getModels()}</span>
+      {loadingTotal ? <Progress className="mk-button-progress" percent={(loadingTotal - loadingNumber) / loadingTotal * 100} size="small" showInfo={false} /> : null}
+    </>
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menuType: state.editLevel
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(NormalButton)
\ No newline at end of file
+export default NormalButton
\ No newline at end of file

--
Gitblit v1.8.0