king
2025-05-23 24842b40de5cd60700bf69dfd38a0332f5431e36
src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -143,7 +143,7 @@
    if (setting.supModule && !BID) {
      notification.warning({
        top: 92,
        message: dict['sup_key_req'] || '需要上级主键值!',
        message: setting.supModTip || dict['sup_key_req'] || '需要上级主键值!',
        duration: 5
      })
      return
@@ -558,9 +558,47 @@
    const { btn } = this.props
    let callback = null
    let printReject = null
    let skip = false
    let send = false
    let data = fromJS({
      data: printlist,
      form: formdata
    }).toJS()
    if (!window.GLOB.errorLog) {
      printReject = (msg) => {
        if (send) return
        send = true
        data.message = msg
        window.mkInfo(JSON.stringify(data))
      }
    } else {
      printReject = (msg) => {
        if (send) return
        send = true
        data.message = msg
        let param = {
          func: 's_special_error_note_log',
          api_url: btn.logLabel,
          error_code: 507,
          error_time: moment().format('YYYY-MM-DD HH:mm:ss'),
          api_param: JSON.stringify(data)
        }
        Api.genericInterface(param)
      }
    }
    if (/callback\(\)/.test(btn.verify.printFunc)) {
      callback = () => {
        if (skip) return
        skip = true
        this.execSuccess({
          ErrCode: '-1',
          message: '',
@@ -577,8 +615,8 @@
    try {
      // eslint-disable-next-line
      let func = new Function('data', 'form', 'printer', 'notification', 'Api', 'systemType', 'callback', btn.verify.printFunc)
      func(printlist, formdata, btn.verify, notification, Api, window.GLOB.systemType, callback)
      let func = new Function('data', 'form', 'printer', 'notification', 'Api', 'systemType', 'callback', 'printReject', btn.verify.printFunc)
      func(printlist, formdata, btn.verify, notification, Api, window.GLOB.systemType, callback, printReject)
      // 自定义打印示例
      // let defaultPrinter = printer.defaultPrinter || 'lackprinter'
@@ -779,6 +817,8 @@
        message: window.GLOB.dict['func_error'] || '自定义函数执行错误!',
        duration: 5
      })
      printReject(window.GLOB.dict['func_error'] || '自定义函数执行错误!')
    }
  }
@@ -968,7 +1008,7 @@
        let val = form.value
        if (form.type === 'number' || form.type === 'rate') {
          if (isNaN(val)) {
          if (isNaN(val) || val === '') {
            val = 0
          }
        } else if (['date', 'datemonth'].includes(form.type)) {
@@ -1058,8 +1098,15 @@
      _dataresource = ''
    }
    let custompage = false
    if (/order\s+by\s+sort_id\s*$/i.test(_dataresource)) {
      custompage = true
    } else if (/@pageSize@|@orderBy@|@mk_total/i.test(_dataresource + _customScript + _tailScript)) {
      custompage = true
    }
    let isDataM = sessionStorage.getItem('dataM') === 'true'
    let custompage = /@pageSize@|@orderBy@|@mk_total/i.test(_dataresource + _customScript + _tailScript)
    let regoptions = [
      { reg: /@orderBy@/ig, value: btn.verify.setting.order },
      { reg: /@pageSize@/ig, value: '9999' },
@@ -1102,7 +1149,7 @@
      if (form.type === 'number' || form.type === 'rate') {
        let val = form.value
        if (isNaN(val)) {
        if (isNaN(val) || val === '') {
          val = 0
        }
        _initvars.push(`@${_key}=${val}`)
@@ -1694,6 +1741,41 @@
    const { btn } = this.props
    const { dict } = this.state
    let printReject = null
    let send = false
    let data = fromJS({
      data: list,
      template: template
    }).toJS()
    if (!window.GLOB.errorLog) {
      printReject = (msg) => {
        if (send) return
        send = true
        data.message = msg
        window.mkInfo(JSON.stringify(data))
      }
    } else {
      printReject = (msg) => {
        if (send) return
        send = true
        data.message = msg
        let param = {
          func: 's_special_error_note_log',
          api_url: btn.logLabel,
          error_code: 507,
          error_time: moment().format('YYYY-MM-DD HH:mm:ss'),
          api_param: JSON.stringify(data)
        }
        Api.genericInterface(param)
      }
    }
    let _errors = []
    let defaultPrinter = btn.verify.defaultPrinter || 'lackprinter'
@@ -1906,6 +1988,8 @@
          message: data.message,
          status: false
        })
        printReject(data.message)
      }
    }
@@ -2205,6 +2289,10 @@
      let key = item.field.toLowerCase()
      let _readin = item.readin !== 'false'
      if (item.type === 'linkMain' && item.verifyVal === 'true') {
        _item.$verify = true
        _item.label = item.label
      }
      if (_item.type === 'date') { // 时间兼容
        _item.precision = item.precision || 'day'
      } else if (_item.type === 'datetime') {
@@ -2273,8 +2361,13 @@
            _item.value = _item.value.replace(/(^\s*|\s*$)/g, '')
          }
        }
        if (_item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换
          _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || ''))
        if (_item.type === 'text') {
          if (/@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 特殊字段替换
            _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || ''))
          }
          if (/@currentYear@/ig.test(_item.value)) { // 系统变量替换
            _item.value = _item.value.replace(/@currentYear@/ig, moment().format('YYYY'))
          }
        }
        if (_item.type === 'text' && item.lenControl && item.lenControl !== 'limit') {
          if (item.lenControl === 'left') {