king
2024-09-12 ffa0d7a5e06556c358bf8bbb1af30082214d4376
src/tabviews/zshare/actionList/funcbutton/index.jsx
@@ -187,6 +187,8 @@
        dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
        ID: orderId
      }
    } else if (window.backend && window.GLOB.CacheData.has('sql_' + btn.uuid)) {
      param = this.getbackParam(orderId, data)
    } else if (btn.payMode === 'system') {
      let sql = this.getSysDeclareSql(orderId, data)
@@ -215,21 +217,6 @@
      }
    }
    let appId = window.GLOB.WXAppID || window.GLOB.WXminiAppID || ''
    if (btn.wxApp && window.GLOB.WXApps && window.GLOB.WXApps.findIndex(item => item.appId === btn.wxApp) > -1) {
      appId = btn.wxApp
    }
    if (!appId) {
      notification.warning({
        top: 10,
        message: '未获取到应用ID!',
        duration: 5
      })
      return
    }
    this.setState({loading: true})
    if (param) {
@@ -240,7 +227,7 @@
            id = res.mk_b_id || res[btn.output] || orderId
          }
          Api.setRefund({out_biz_no: id, app_id: appId}).then(res => {
          Api.setRefund({out_biz_no: id}).then(res => {
            if (!res.status) {
              this.execError({ErrCode: 'E', message: res.message || window.GLOB.dict['exc_fail'] || '执行失败!', ...res})
            } else {
@@ -252,13 +239,91 @@
        }
      })
    } else {
      Api.setRefund({out_biz_no: orderId, app_id: appId}).then(res => {
      Api.setRefund({out_biz_no: orderId}).then(res => {
        if (!res.status) {
          this.execError({ErrCode: 'E', message: res.message || window.GLOB.dict['exc_fail'] || '执行失败!', ...res})
        } else {
          this.execSuccess({ErrCode: 'S', ...res})
        }
      })
    }
  }
  getbackParam = (ID, data) => {
    const { columns, btn, BID } = this.props
    let ex = window.GLOB.CacheData.get('sql_' + btn.uuid)
    let exps = []
    let values = {
      time_id: Utils.getguid(),
      roleid: sessionStorage.getItem('role_id') || '',
      mk_departmentcode: sessionStorage.getItem('departmentcode') || '',
      mk_organization: sessionStorage.getItem('organization') || '',
      mk_user_type: sessionStorage.getItem('mk_user_type') || '',
      mk_nation: sessionStorage.getItem('nation') || '',
      mk_province: sessionStorage.getItem('province') || '',
      mk_city: sessionStorage.getItem('city') || '',
      mk_district: sessionStorage.getItem('district') || '',
      mk_address: sessionStorage.getItem('address') || '',
      id: ID || '',
      bid: BID || '',
      typename: 'admin',
      datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
      datam_begin: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
      datam_end: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
    }
    if (window.GLOB.externalDatabase !== null) {
      values.db = window.GLOB.externalDatabase
    }
    ex.reps.forEach(n => {
      let key = n.toLowerCase()
      if (values.hasOwnProperty(key)) {
        exps.push({
          key: n,
          value: values[key]
        })
      }
    })
    let _data = {}
    Object.keys(data).forEach(key => {
      _data[key.toLowerCase()] = data[key]
    })
    columns.forEach(col => {
      if (!ex.reps.includes(col.field)) return
      if (!col.datatype) return
      let _key = col.field.toLowerCase()
      let _val = _data.hasOwnProperty(_key) ? _data[_key] : ''
      if (/^date/ig.test(col.datatype) && !_val) {
        _val = '1949-10-01'
      }
      exps.push({
        key: 'mk_' + col.field + '_mk',
        value: _val
      })
    })
    let md5_id = ''
    if (window.GLOB.probation) {
      md5_id = md5(ex.id + JSON.stringify(exps) + Math.floor(new Date().getTime() / 600000))
      md5_id = moment().format('YYYYMMDDHHmmss') + md5_id.slice(-18)
    }
    return {
      $backend: true,
      $type: 's_TableData_InUpDe',
      data: [{
        id: ex.id,
        menuname: btn.logLabel || '',
        exps: exps,
        md5_id: md5_id
      }]
    }
  }
@@ -363,8 +428,8 @@
    }
    if (window.GLOB.debugger === true) {
      console.info('%c' + btn.logLabel, 'color: blue')
      console.info(_sql)
      window.mkInfo('%c' + btn.logLabel, 'color: blue')
      window.mkInfo(_sql)
    }
    return _sql