king
2022-11-29 b0c7a660750a8b29e7f8b3a648296d56c50fd2ca
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -42,7 +42,6 @@
    loadingTotal: '',
    disabled: false,
    hidden: false,
    checkParam: null,
    autoMatic: false,
    check: false
  }
@@ -402,7 +401,6 @@
      let param = { // 系统存储过程
        func: 'sPC_TableData_InUpDe'
      }
      let check_param = null
      if (this.props.BID) {
        param.BID = this.props.BID
@@ -442,11 +440,9 @@
        param.secretkey = Utils.encrypt('', param.timestamp)
        if (/\$check@|@check\$/ig.test(param.LText)) {
          check_param = fromJS(param).toJS()
          check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
          check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
          check_param.LText = Utils.formatOptions(check_param.LText)
          if (btn.intertype === 'system') {
            param.$unCheckParam = fromJS(param).toJS()
          }
          param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
        }
@@ -487,11 +483,9 @@
          param.secretkey = Utils.encrypt('', param.timestamp)
          if (/\$check@|@check\$/ig.test(param.LText)) {
            check_param = fromJS(param).toJS()
            check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
            check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
            check_param.LText = Utils.formatOptions(check_param.LText)
            if (btn.intertype === 'system') {
              param.$unCheckParam = fromJS(param).toJS()
            }
            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
          }
@@ -522,11 +516,9 @@
          param.secretkey = Utils.encrypt('', param.timestamp)
          if (/\$check@|@check\$/ig.test(param.LText)) {
            check_param = fromJS(param).toJS()
            check_param.LText = check_param.LText.replace(/\$check@/ig, '/*')
            check_param.LText = check_param.LText.replace(/@check\$/ig, '*/')
            check_param.LText = Utils.formatOptions(check_param.LText)
            if (btn.intertype === 'system') {
              param.$unCheckParam = fromJS(param).toJS()
            }
            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
          }
@@ -536,9 +528,6 @@
      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)
        }
      }
      param.menuname = btn.logLabel
@@ -547,13 +536,18 @@
        param.s_debug_type = 'Y'
      }
      if (check_param) {
        check_param.menuname = btn.logLabel
        this.setState({checkParam: check_param})
      }
      if (window.GLOB.breakpoint) {
        param.func = 'sPC_TableData_InUpDe_debug'
      }
      if (param.$unCheckParam) {
        param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
        param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText)
        param.$unCheckParam.menuname = btn.logLabel
        if (window.GLOB.probation) {
          param.$unCheckParam.s_debug_type = 'Y'
        }
      }
      _params.push(param)
@@ -589,11 +583,18 @@
          } else {
            param.LText = param.LText.replace(/@\$|\$@/ig, '')
          }
          param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
          param.exec_type = 'y' // 后台解码
          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
          param.secretkey = Utils.encrypt('', param.timestamp)
          if (/\$check@|@check\$/ig.test(param.LText)) {
            if (btn.intertype === 'system') {
              param.$unCheckParam = fromJS(param).toJS()
            }
            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
          }
          param.LText = Utils.formatOptions(param.LText)
        } else if (btn.OpenType === 'pop') { // 表单
          if (index !== 0) {
@@ -629,11 +630,18 @@
            } else {
              param.LText = param.LText.replace(/@\$|\$@/ig, '')
            }
            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt('', param.timestamp)
            if (/\$check@|@check\$/ig.test(param.LText)) {
              if (btn.intertype === 'system') {
                param.$unCheckParam = fromJS(param).toJS()
              }
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            }
            param.LText = Utils.formatOptions(param.LText)
          } else {
            param.ID = primaryId
@@ -655,11 +663,18 @@
            } else {
              param.LText = param.LText.replace(/@\$|\$@/ig, '')
            }
            param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            param.exec_type = 'y' // 后台解码
            param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
            param.secretkey = Utils.encrypt('', param.timestamp)
            if (/\$check@|@check\$/ig.test(param.LText)) {
              if (btn.intertype === 'system') {
                param.$unCheckParam = fromJS(param).toJS()
              }
              param.LText = param.LText.replace(/\$check@|@check\$/ig, '')
            }
            param.LText = Utils.formatOptions(param.LText)
          }
        }
@@ -675,6 +690,16 @@
        if (window.GLOB.breakpoint) {
          param.func = 'sPC_TableData_InUpDe_debug'
        }
        if (param.$unCheckParam) {
          param.$unCheckParam.LText = param.$unCheckParam.LText.replace(/\$check@/ig, '/*').replace(/@check\$/ig, '*/')
          param.$unCheckParam.LText = Utils.formatOptions(param.$unCheckParam.LText)
          param.$unCheckParam.menuname = btn.logLabel
          if (window.GLOB.probation) {
            param.$unCheckParam.s_debug_type = 'Y'
          }
        }
        return param
@@ -995,7 +1020,9 @@
        params = this.getInnerParam(data, formdata)
      }
      if (params.length <= 20) {
      if (params[0].$unCheckParam) {
        this.checkLoopRequest(params, btn, _resolve)
      } else if (params.length <= 20) {
        let deffers = params.map((param, i) => {
          return new Promise(resolve => {
            setTimeout(() => {
@@ -1529,6 +1556,69 @@
        } else {
          this.innerLoopRequest(params, btn, _resolve)
        }
      } else {
        this.execError(res)
        _resolve()
      }
    }, () => {
      this.updateStatus()
      _resolve()
    })
  }
  /**
   * @description 数据检验循环执行
   */
  checkLoopRequest = (params, btn, _resolve) => {
    let param = params.shift()
    let unCheckParam = param.$unCheckParam
    delete param.$unCheckParam
    this.setState({
      loadingNumber: params.length
    })
    Api.genericInterface(param).then(res => {
      if (res.status) {
        this.triggerNote(res) // 消息
        if (params.length === 0) {
          this.execSuccess(res)
          _resolve()
        } else {
          this.checkLoopRequest(params, btn, _resolve)
        }
      } else if (res.ErrCode === 'C') {
        const _this = this
        confirm({
          title: '继续执行?',
          content: res.message,
          onOk() {
            return new Promise(resolve => {
              Api.genericInterface(unCheckParam).then(result => {
                if (result.status) {
                  _this.triggerNote(result) // 消息
                  if (params.length === 0) {
                    _this.execSuccess(result)
                    _resolve()
                  } else {
                    _this.checkLoopRequest(params, btn, _resolve)
                  }
                } else {
                  _this.execError(res)
                  _resolve()
                }
                resolve()
              })
            })
          },
          onCancel() {
            _this.execError(res)
            _resolve()
          }
        })
      } else {
        this.execError(res)
        _resolve()
@@ -2245,48 +2335,6 @@
      loadingNumber: '',
      loadingTotal: '',
    })
    if (res.ErrCode === 'C') {
      const _this = this
      if (this.state.checkParam) {
        let param = this.state.checkParam
        confirm({
          title: res.message || res.ErrMesg,
          content: '继续执行?',
          onOk() {
            return new Promise(resolve => {
              Api.genericInterface(param).then((result) => {
                if (result.status) {
                  _this.execSuccess(result)
                } else {
                  _this.execError(result)
                }
                resolve()
              }, () => {
                _this.setState({
                  visible: false
                })
                resolve()
              })
            })
          },
          onCancel() {
            _this.setState({
              visible: false
            })
            if (btn.execError !== 'never') {
              MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
            }
          }
        })
        this.setState({checkParam: null})
        return
      } else {
        Modal.error({
          title: res.message || res.ErrMesg,
        })
      }
    }
    if (btnconfig && btnconfig.setting && btnconfig.setting.errFocus) {
      MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus)