king
2020-04-09 b9a0e8541f0959db5d848f7b893c8838851ce411
src/tabviews/zshare/actionList/index.jsx
@@ -44,7 +44,8 @@
    loadingUuid: '',
    btnloading: false,
    configMap: {},
    running: false
    running: false,
    loadingNumber: ''
  }
  /**
@@ -73,6 +74,15 @@
   */
  actionTrigger = (item, record) => {
    const { setting, type, Tab, BID } = this.props
    if (this.state.loadingUuid || this.state.visible || this.state.running) {
      notification.warning({
        top: 92,
        message: '任务执行中,请稍后!',
        duration: 5
      })
      return
    }
    if (type === 'sub' && Tab && Tab.supMenu && !BID) {
      notification.warning({
@@ -123,6 +133,10 @@
      confirm({
        title: this.props.dict['main.action.confirm.tip'],
        onOk() {
          _this.setState({
            loadingUuid: item.uuid
          })
          return new Promise(resolve => {
            _this.execSubmit(item, data, resolve)
          })
@@ -1333,7 +1347,7 @@
      }
      // 循环调用外部接口(包括内部及回调函数)
      this.outerLoopRequest(_params, btn, _resolve)
      this.outerLoopRequest(_params, btn, _resolve, _params.length > 20)
      
    } else {
      this.actionSettingError()
@@ -1349,6 +1363,10 @@
    if (!params && params.length === 0) return
    let param = params.shift()
    this.setState({
      loadingNumber: params.length || ''
    })
    Api.genericInterface(param).then(res => {
      if (res.status) {
@@ -1368,11 +1386,17 @@
  /**
   * @description 外部请求循环执行
   */
  outerLoopRequest = (params, btn, _resolve) => {
  outerLoopRequest = (params, btn, _resolve, widthNumber) => {
    if (!params && params.length === 0) return
    let param = params.shift()
    let _outParam = null
    if (widthNumber) {
      this.setState({
        loadingNumber: params.length || ''
      })
    }
    new Promise(resolve => {
      // 内部请求
@@ -1449,7 +1473,7 @@
            this.execSuccess(btn, response)
            _resolve()
          } else {
            this.outerLoopRequest(params, btn, _resolve)
            this.outerLoopRequest(params, btn, _resolve, widthNumber)
          }
        } else {
          this.execError(response, btn)
@@ -1464,7 +1488,7 @@
          this.execSuccess(btn, res)
          _resolve()
        } else {
          this.outerLoopRequest(params, btn, _resolve)
          this.outerLoopRequest(params, btn, _resolve, widthNumber)
        }
      } else {
        this.execError(res, btn)
@@ -1504,7 +1528,8 @@
    this.setState({
      loadingUuid: '',
      running: false
      running: false,
      loadingNumber: ''
    })
    this.refreshdata(btn, 'success')
@@ -1540,7 +1565,8 @@
    
    this.setState({
      loadingUuid: '',
      running: false
      running: false,
      loadingNumber: ''
    })
    
    this.refreshdata(btn, 'error')
@@ -2425,13 +2451,18 @@
        value: _initval
      }
    })
    this.setState({
    _this.setState({
      running: true
    })
    confirm({
      title: this.props.dict['main.action.confirm.tip'],
      onOk() {
        _this.setState({
          loadingUuid: execAction.uuid
        })
        return new Promise(resolve => {
          _this.execSubmit(execAction, tabledata, resolve, result)
        })
@@ -2502,33 +2533,27 @@
  }
  render() {
    const { loadingUuid, btnloading } = this.state
    const { loadingUuid, btnloading, loadingNumber } = this.state
    if (this.props.setting.actionfixed && this.props.type === 'main') { // 按钮是否固定在头部
      return (
        <Affix offsetTop={48}>
          <div className="button-list toolbar-button" id={this.props.MenuID + 'mainaction'}>
            {this.props.actions.map((item, index) => {
              if (loadingUuid === item.uuid) {
                return (
                  <Button
                    className={'mk-btn mk-' + item.class}
                    icon={item.icon}
                    key={'action' + index}
                    onClick={() => {this.actionTrigger(item)}}
                    loading
                  >{item.label}</Button>
                )
              } else {
                return (
                  <Button
                    className={'mk-btn mk-' + item.class}
                    icon={item.icon}
                    key={'action' + index}
                    onClick={() => {this.actionTrigger(item)}}
                  >{item.label}</Button>
                )
              let label = item.label
              if (loadingUuid === item.uuid && loadingNumber !== '') {
                label = label + '(' + loadingNumber + ')'
              }
              return (
                <Button
                  className={'mk-btn mk-' + item.class}
                  icon={item.icon}
                  key={'action' + index}
                  onClick={() => {this.actionTrigger(item)}}
                  loading={loadingUuid === item.uuid}
                >{label}</Button>
              )
            })}
            {this.getModels()}
            {btnloading && <Spin size="large" />}
@@ -2540,26 +2565,20 @@
      return (
        <div className="button-list toolbar-button">
          {this.props.actions.map((item, index) => {
            if (loadingUuid === item.uuid) {
              return (
                <Button
                  className={'mk-btn mk-' + item.class}
                  icon={item.icon}
                  key={'action' + index}
                  onClick={() => {this.actionTrigger(item)}}
                  loading
                >{item.label}</Button>
              )
            } else {
              return (
                <Button
                  className={'mk-btn mk-' + item.class}
                  icon={item.icon}
                  key={'action' + index}
                  onClick={() => {this.actionTrigger(item)}}
                >{item.label}</Button>
              )
            let label = item.label
            if (loadingUuid === item.uuid && loadingNumber !== '') {
              label = label + '(' + loadingNumber + ')'
            }
            return (
              <Button
                className={'mk-btn mk-' + item.class}
                icon={item.icon}
                key={'action' + index}
                onClick={() => {this.actionTrigger(item)}}
                loading={loadingUuid === item.uuid}
              >{label}</Button>
            )
          })}
          {this.getModels()}
          {btnloading && <Spin size="large" />}