king
2022-09-18 0f6153ab337c4ecca5579a79b03f3ba5f831e0c4
src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -100,7 +100,6 @@
    if (btn.OpenType === 'formSubmit') {
      MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
    }
    MKEmitter.addListener('returnModuleParam', this.resetModuleParam)
    if (btn.autoMatic) {
      MKEmitter.addListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit)
@@ -156,7 +155,6 @@
    }
    MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
    MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit)
    MKEmitter.removeListener('returnModuleParam', this.resetModuleParam)
    MKEmitter.removeListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit)
  }
@@ -204,14 +202,6 @@
    this.execSubmit(data, () => {}, res.form)
  }
  resetModuleParam = (menuId, btnId, param) => {
    const { btn } = this.props
    if (btn.$menuId !== menuId || btn.uuid !== btnId || !param) return
    this.moduleParams = param
  }
  /**
   * @description 按钮状态改变
   */
@@ -248,7 +238,7 @@
    let _this = this
    let data = record || selectedData || []
    if (btn.Ot !== 'notRequired' && data.length === 0) {
      // 需要选择行时,校验数据
      notification.warning({
@@ -720,7 +710,7 @@
        })
      }
      if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 函数 s_sDataDictb_TBBack 云端验证
      if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 函数 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)
@@ -765,7 +755,7 @@
          param[setting.primaryKey] = primaryId
        }
        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 函数 s_sDataDictb_TBBack 云端验证
        if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 函数 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)
@@ -911,7 +901,7 @@
      _declarefields = ',' + _declarefields
    }
    _sql = `/* 系统生成 */
        Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50)${_declarefields}
        Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50)${_declarefields}
      `
  
    let userName = sessionStorage.getItem('User_Name') || ''
@@ -967,16 +957,10 @@
      btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' &&
      setting.dataresource
    ) {
      MKEmitter.emit('queryModuleParam', btn.$menuId, btn.uuid)
      setTimeout(() => {
        if (this.moduleParams) {
          this.execRealSubmit(data, _resolve, formdata)
        } else {
          setTimeout(() => {
            this.execRealSubmit(data, _resolve, formdata)
          }, 100)
        }
      }, 50)
      MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => {
        this.moduleParams = param
        this.execRealSubmit(data, _resolve, formdata)
      })
    } else {
      this.execRealSubmit(data, _resolve, formdata)
    }
@@ -1235,8 +1219,24 @@
    const { btn } = this.props
    let param = null
    let callback = result.mk_ex_invoke
    if (btn.callbackType === 'script' || btn.callbackType === 'default') {
    delete result.mk_ex_invoke
    if (callback === 'false' || callback === false) {
      if (result.status) {
        if (params.length === 0) {
          this.execSuccess(result)
          _resolve()
        } else {
          this.customLoopRequest(params, _resolve)
        }
      } else {
        this.execError(result)
        _resolve()
      }
      return
    } else if (btn.callbackType === 'script' || btn.callbackType === 'default') {
      param = this.getCallBackSql(result, record)
    } else if (btn.callbackType === 'func') {
      param = {
@@ -1573,6 +1573,11 @@
            res.BID = this.props.BID
          }
          if (res.mk_api_key) {
            record.mk_api_key = res.mk_api_key
          }
          delete res.mk_api_key
          this.outerOuterRequest(params, res, record, _resolve)
        }
      } else {
@@ -1593,8 +1598,14 @@
      result.func = btn.outerFunc
    }
    if (window.GLOB.mkHS) {
      if (btn.sysInterface === 'true' && options.cloudServiceApi) {
      if (btn.outerFunc === 's_app_version_upt') { // special 更新版本号时访问sso
        if (window.GLOB.mainSystemApi) {
          result.rduri = window.GLOB.mainSystemApi
        }
      } else if (btn.sysInterface === 'true' && options.cloudServiceApi) {
        result.rduri = options.cloudServiceApi
        result.userid = sessionStorage.getItem('CloudUserID') || ''
        result.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
      } else if (btn.sysInterface !== 'true') {
        if (window.GLOB.systemType === 'production' && btn.proInterface) {
          result.rduri = btn.proInterface
@@ -1603,7 +1614,7 @@
        }
      }
      // 函数 s_sDataDictb_TBBack 云端验证
      // special 函数 s_sDataDictb_TBBack 云端验证
      if (result.func === 's_sDataDictb_TBBack' && result.LTextOut) {
        result.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        result.secretkey = Utils.encrypt(result.LTextOut, result.timestamp)
@@ -1618,10 +1629,16 @@
        } else {
          result.rduri = btn.interface
        }
        let host = window.GLOB.baseurl.replace(/http(s):\/\//, '')
        if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) {
          result.$login = true
        }
      }
    }
    Api.genericInterface(result).then(res => {
      if (!res) return // LoginError时中断请求
      this.outerCallbackRequest(params, res, record, outParam, _resolve)
    }, () => {
      this.outerCallbackRequest(params, {status: false, message: 500, ErrCode: 'E', ErrMesg: 500}, record, outParam, _resolve)
@@ -1636,7 +1653,36 @@
    let param = null
    if (btn.callbackType === 'script' || btn.callbackType === 'default') {
    if (record.mk_api_key) {
      result.mk_api_key = record.mk_api_key
    }
    let callback = result.mk_ex_invoke
    delete result.mk_ex_invoke
    if (callback === 'false' || callback === false) {
      if (result.status) {
        if (params.length === 0) {
          this.execSuccess(result)
          _resolve()
        } else {
          this.outerLoopRequest(params, _resolve)
        }
      } else {
        this.execError(result)
        _resolve()
      }
      return
    } else if (window.GLOB.mkHS && btn.outerFunc === 's_get_sVersionDetail_Ltext' && btn.callbackFunc) { // special 版本升级回调处理
      if (result.status) {
        this.verupRequest(params, result, outParam, _resolve)
      } else {
        this.execError(result)
        _resolve()
      }
      return
    } else if (btn.callbackType === 'script' || btn.callbackType === 'default') {
      param = this.getCallBackSql(result, record)
    } else if (btn.callbackType === 'func' || btn.callbackFunc) {
      delete result.message
@@ -1648,7 +1694,7 @@
        func: btn.callbackFunc
      }
      // 函数 s_sDataDictb_TBBack 云端验证
      // special 函数 s_sDataDictb_TBBack 云端验证
      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)
@@ -1684,6 +1730,71 @@
        _resolve()
      }
    })
  }
  verupRequest = (params, result, outParam, _resolve) => {
    const { btn } = this.props
    delete result.message
    delete result.status
    result.func = btn.callbackFunc
    let ssoParam = null
    let callParam = {...outParam, ...result}
    if (callParam.LTextOut) {
      callParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      callParam.secretkey = Utils.encrypt(callParam.LTextOut, callParam.timestamp)
      callParam.open_key = Utils.encryptOpenKey(callParam.secretkey, callParam.timestamp)
    }
    if (callParam.UpType === 'SSO' && window.GLOB.mainSystemApi) {
      ssoParam = fromJS(callParam).toJS()
      ssoParam.rduri = window.GLOB.mainSystemApi
      delete ssoParam.UpType
    } else {
      delete callParam.UpType
    }
    if (ssoParam) {
      Api.genericInterface(ssoParam).then(res => {
        if (!res.status) {
          this.execError(res)
          _resolve()
        } else {
          Api.genericInterface(callParam).then(re => {
            if (!re.status) {
              this.execError(re)
              _resolve()
            } else {
              if (params.length === 0) {
                this.execSuccess(res)
                _resolve()
              } else {
                this.outerLoopRequest(params, _resolve)
              }
            }
          })
        }
      })
    } else {
      Api.genericInterface(callParam).then(re => {
        if (!re.status) {
          this.execError(re)
          _resolve()
        } else {
          if (params.length === 0) {
            this.execSuccess(re)
            _resolve()
          } else {
            this.outerLoopRequest(params, _resolve)
          }
        }
      })
    }
  }
  /**
@@ -1855,11 +1966,8 @@
          _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}
      })
@@ -1875,9 +1983,9 @@
          m.client_msg_id = item.send_id
        }
        keys.forEach(key => {
          if (item[key] !== undefined) {
            m.data[key].value = item[key]
        verify.wxNoteKeys.forEach(note => {
          if (item[note.value] !== undefined) {
            m.data[note.key].value = item[note.value]
          }
        })
@@ -2016,7 +2124,7 @@
      _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
      _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
      Api.getLocalConfig(_param).then(result => {
      Api.genericInterface(_param).then(result => {
        if (!result.status) {
          notification.warning({
            top: 92,
@@ -2068,10 +2176,13 @@
      })
      MKEmitter.emit('autoExecOver', btn.uuid, 'error')
      return
    } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') {
      this.setState({
        loading: false
      })
    }
    
    this.setState({
      loading: false,
      loadingNumber: '',
      loadingTotal: '',
    })
@@ -2245,7 +2356,7 @@
  }
  modelconfirm = () => {
    const { btn } = this.props
    const { btn, BID } = this.props
    const { btnconfig, selines } = this.state
    let _this = this
@@ -2287,15 +2398,17 @@
        _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD HH:mm:ss')
      }
      if (_initval === undefined) {
        _initval = ''
      }
      let _fieldlen = item.fieldlength || 50
      if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') {
        _fieldlen = item.fieldlength || 512
      } else if (item.type === 'number') {
        _fieldlen = item.decimal ? item.decimal : 0
      }
      if (_initval === undefined) {
        _initval = ''
      } else if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_initval)) { // 特殊字段替换
        _initval = _initval.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || ''))
      }
      let _type = item.type