king
2024-02-04 0bbaa727cdfc65622e33e91c4bf694c83f184535
src/views/billprint/index.jsx
@@ -44,7 +44,8 @@
    visible: false,
    rePos: false,
    loading: false,
    auto: true
    auto: true,
    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)
  }
  UNSAFE_componentWillMount() {
@@ -166,8 +167,6 @@
        sessionStorage.setItem('LoginUID', result.LoginUID || '')
        sessionStorage.setItem('dataM', 'false')
        this.getMenuParam()
        // 获取系统信息
        let _param = {
          func: 's_Get_style',
@@ -184,6 +183,7 @@
          if (res.status) {
            window.GLOB.style = res.CSS
            document.title = res.titleName
            sessionStorage.setItem('appname', res.appname || '')
        
            if (window.GLOB.style && styles[window.GLOB.style]) {
              document.body.className = styles[window.GLOB.style] + ' ' + (res.split_line_show === 'false' ? 'hidden-split-line' : '')
@@ -197,6 +197,8 @@
              document.getElementsByTagName('head')[0].appendChild(link)
            }
          }
          this.getMenuParam()
        })
      } else {
        notification.warning({
@@ -248,6 +250,10 @@
            lostmsg: '抱歉,您访问的页面未启用,请联系管理员。'
          })
          return
        }
        if (config.webTitle) {
          document.title = config.webTitle
        }
        config.style = config.style || {}
@@ -324,7 +330,7 @@
        let initInters = []
        this.formatInterSetting(config.interfaces, regs, initInters, params, BID)
        this.formatInterSetting(config.interfaces, regs, initInters, params, BID, config.MenuName)
        config.components = config.components.map(component => {
          if (component.action) {
@@ -340,6 +346,8 @@
            component.$searches = []
          }
          component.data = [] // 初始化数据为空
          component.$menuname = (config.MenuName || '') + '-' + (component.name || '')
          if (component.subtype === 'tablecard') { // 兼容
            component.type = 'card'
@@ -393,6 +401,10 @@
                  }
                } else {
                  item.IsSort = 'false'
                }
                if (item.marks && item.marks.length === 0) {
                  item.marks = null
                }
          
                return true
@@ -460,6 +472,12 @@
          if (!component.format) return component  // 没有动态数据  数据格式 array 或 object
          component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : ''
          component.setting.laypage = false   // 是否分页,转为boolean 统一格式
          component.setting.$name = component.$menuname
          if (component.format === 'object') {
            component.setting.$top = true
          }
          if (component.setting.interType !== 'system') { // 不使用系统函数时
            component.setting.sync = 'false'
@@ -483,7 +501,6 @@
          delete component.scripts
    
          component.setting.execute = component.setting.execute !== 'false'  // 默认sql是否执行,转为boolean 统一格式
          component.setting.laypage = false   // 是否分页,转为boolean 统一格式
          component.setting.onload = 'true'   // 默认加载
    
          if (!component.setting.execute) {
@@ -530,7 +547,7 @@
          return component
        })
        _pars = this.getFormatParam(_pars)
        _pars = this.getFormatParam(_pars, config.MenuName)
        if (_pars) {
          _pars.componentId = 'union'
@@ -609,6 +626,10 @@
    if (cell.style.display === 'inline-block') {
      cell.style.verticalAlign = 'top'
    }
    if (cell.marks && cell.marks.length === 0) {
      cell.marks = null
    }
    
    if (['text', 'number', 'formula'].includes(cell.eleType)) {
      cell.innerHeight = cell.innerHeight || 'auto'
@@ -627,7 +648,7 @@
    return cell
  }
  formatInterSetting = (inters, regs, initInters, params, BID) => {
  formatInterSetting = (inters, regs, initInters, params, BID, MenuName) => {
    if (!inters) return []
    let delay = 15
@@ -639,6 +660,7 @@
      inter.setting.supModule = ''
      inter.setting.arr_field = inter.columns.map(col => col.field).join(',')
      inter.setting.$name = (MenuName || '') + '-公共数据源-' + inter.setting.name
      if (inter.setting.interType !== 'system') {
        let param = UtilsDM.getQueryDataParams(inter.setting, [], inter.setting.order || '', 1, 1000, BID)
@@ -670,9 +692,9 @@
      })
      delete inter.scripts
      inter.setting.$name = '公共数据源-' + inter.setting.name
      inter.setting.execute = inter.setting.execute !== 'false'
      inter.setting.laypage = true
      inter.setting.laypage = false
      inter.setting.$top = true
      if (!inter.setting.execute) {
        inter.setting.dataresource = ''
@@ -757,7 +779,7 @@
    }
  }
  getFormatParam = (params) => {
  getFormatParam = (params, MenuName) => {
    const { BID } = this.state
    if (!params || params.length === 0) return ''
@@ -820,17 +842,21 @@
    let param = {
      func: 'sPC_Get_structured_data',
      LText: LText.join(' union all '),
      LText_field: LText_field.join(' union all '),
      BID: BID || '',
      username: userName,
      fullName: fullName
    }
    param.LText = Utils.formatOptions(param.LText)
    param.LText_field = Utils.formatOptions(param.LText_field)
    if (MenuName) {
      param.menuname = MenuName
    }
    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.LText, param.timestamp)
    param.secretkey = Utils.encrypt('', param.timestamp)
    return param
  }
@@ -1298,7 +1324,7 @@
  }
  render() {
    const { loadingview, viewlost, config, pages, auto, rePos, loading } = this.state
    const { loadingview, viewlost, config, pages, auto, rePos, loading, ismob } = this.state
    return (
      <div className="bill-print-wrap" >
@@ -1308,8 +1334,8 @@
        </div> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
        {config && window.GLOB.breakpoint ? <DebugTable /> : null}
        {pages && !loadingview && !viewlost ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null}
        {!loadingview && !viewlost ? <div className="refresh-button"><Button icon="reload" size="large" shape="circle" onClick={this.reload}></Button></div> : null}
        {pages && !loadingview && !viewlost && !ismob ? <div className="print-button"><Button icon="printer" size="large" shape="circle" onClick={this.print}></Button></div> : null}
        {!loadingview && !viewlost && !ismob ? <div className="refresh-button"><Button icon="reload" size="large" shape="circle" onClick={this.reload}></Button></div> : null}
      </div>
    )
  }