king
2024-08-25 326aa6b3effaccc71cfe0775d47b0f29eb3695a6
src/views/billprint/index.jsx
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import { is, fromJS } from 'immutable'
import { Col, Row, Spin, notification, Button } from 'antd'
import { Col, Row, Spin, notification, Button, Modal } from 'antd'
import moment from 'moment'
import Api from '@/api'
@@ -48,6 +48,8 @@
    ismob: /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent)
  }
  reloading = false
  UNSAFE_componentWillMount() {
    const { params } = this.props.match
@@ -88,7 +90,7 @@
  }
  componentDidMount() {
    const _this = this
    const that = this
    if (window.GLOB.sysType !== 'cloud') {
      Object.defineProperty(window, 'debugger', {
@@ -116,7 +118,7 @@
            window.GLOB.breakpoint = value + ''
            sessionStorage.setItem('breakpoint', value)
          }
          _this.debugChange()
          that.debugChange()
        }
      })
    }
@@ -142,7 +144,7 @@
        window.GLOB.breakpoint = false
        sessionStorage.removeItem('breakpoint')
        
        _this.debugChange()
        that.debugChange()
      }
    }
  }
@@ -367,7 +369,9 @@
            let getColumns = (cols) => {
              return cols.filter(item => {
                if (item.Hide === 'true') return false
                item.IsSort = 'false'
                if (item.type === 'number') {
                  if (typeof(item.decimal) === 'number') {
                    item.round = Math.pow(10, item.decimal)
@@ -630,6 +634,9 @@
    if (cell.marks && cell.marks.length === 0) {
      cell.marks = null
    }
    if (cell.anchors && cell.anchors.length === 0) {
      cell.anchors = null
    }
    
    if (['text', 'number', 'formula'].includes(cell.eleType)) {
      cell.innerHeight = cell.innerHeight || 'auto'
@@ -806,6 +813,7 @@
      { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`},
      { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`},
      { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`},
      { reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`},
      { reg: /@typename@/ig, value: `'admin'`},
    ]
@@ -830,8 +838,8 @@
      // 测试系统打印查询语句
      if (window.GLOB.debugger === true) {
        _script && console.info(`${_sql ? '' : '/*不执行默认sql*/\n'}${_script}`)
        _sql &&  console.info(_sql)
        _script && window.mkInfo(`${_sql ? '' : '/*不执行默认sql*/\n'}${_script}`)
        _sql && window.mkInfo(_sql)
      }
      item.columns.forEach(cell => {
@@ -851,9 +859,9 @@
      param.menuname = MenuName
    }
    param.exec_type = 'y'
    param.LText = Utils.formatOptions(LText.join(' union all '))
    param.custom_script = Utils.formatOptions(LText_field.join(' union all '))
    param.exec_type = window.GLOB.execType || 'y'
    param.LText = Utils.formatOptions(LText.join(' union all '), param.exec_type)
    param.custom_script = Utils.formatOptions(LText_field.join(' union all '), param.exec_type)
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    param.secretkey = Utils.encrypt('', param.timestamp)
@@ -909,11 +917,18 @@
      return new Promise(resolve => {
        Api.genericInterface(item).then(res => {
          if (!res.status) {
            notification.warning({
              top: 92,
              message: res.message,
              duration: 5
            })
            if (item.func === 'sPC_Get_structured_data' && /将截断字符串或二进制数据/ig.test(res.message)) {
              res.message = res.message + '请检查字段集'
            }
            if (res.ErrCode === 'version_up') {
              this.reloadTabs()
            } else {
              notification.warning({
                top: 92,
                message: res.message,
                duration: 5
              })
            }
            resolve(false)
          } else {
            res.componentId = componentId
@@ -1073,6 +1088,20 @@
    })
  }
  reloadTabs = () => {
    if (this.reloading) return
    this.reloading = true
    Api.getAppVersion(true).then(() => {
      window.location.reload()
    }, (message) => {
      Modal.error({
        title: message || '系统配置更新失败!',
      })
    })
  }
  canvasToImage(canvas) {
    let image = new Image()
    image.src = canvas.toDataURL('image/jpg')