From 4d6b9f8a2d7b316633e43b489eae9ada949c07b5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 10 九月 2024 10:18:08 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/billprint/index.jsx | 86 +++++++++++++++++++++++++++++++++++++------ 1 files changed, 74 insertions(+), 12 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 85f4b7e..f708040 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -1,7 +1,8 @@ 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 md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -48,6 +49,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 @@ -63,6 +66,7 @@ let param = JSON.parse(window.decodeURIComponent(window.atob(params.param))) sessionStorage.setItem('dataM', param.dataM || '') + this.setState({ BID: param.id || '', tempId: param.tempId, @@ -88,7 +92,7 @@ } componentDidMount() { - const _this = this + const that = this if (window.GLOB.sysType !== 'cloud') { Object.defineProperty(window, 'debugger', { @@ -116,7 +120,7 @@ window.GLOB.breakpoint = value + '' sessionStorage.setItem('breakpoint', value) } - _this.debugChange() + that.debugChange() } }) } @@ -142,7 +146,7 @@ window.GLOB.breakpoint = false sessionStorage.removeItem('breakpoint') - _this.debugChange() + that.debugChange() } } } @@ -301,6 +305,22 @@ config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type)) + if (window.backend && config.allSqls) { + let urlparam = urlParam || {} + let keys = Object.keys(urlparam) + config.allSqls.forEach(item => { + item.id = md5(window.GLOB.appkey + item.v_id) + if (item.type === 'datasource' || item.type === 'excelOut') { + item.urlkeys = keys + item.urlparam = urlparam + if (config.flow_code) { + item.works_flow_code = config.flow_code + } + } + window.GLOB.CacheData.set('sql_' + item.uuid, item) + }) + } + let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' @@ -367,7 +387,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) @@ -483,6 +505,8 @@ component.setting.sync = 'false' return component } + + component.setting.uuid = component.uuid let _customScript = '' let _tailScript = '' @@ -528,6 +552,12 @@ component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + + if (window.backend && config.allSqls) { + component.setting.sync = 'false' + } else if (_tailScript) { + component.setting.sync = 'false' + } // floor 缁勪欢鐨勫眰绾� // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ @@ -630,6 +660,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' @@ -675,6 +708,8 @@ } return } + + inter.setting.uuid = inter.uuid let _customScript = '' let _tailScript = '' @@ -806,6 +841,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 +866,8 @@ // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 if (window.GLOB.debugger === true) { - _script && console.info(`${_sql ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_script}`) - _sql && console.info(_sql) + _script && window.mkInfo(`${_sql ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_script}`) + _sql && window.mkInfo(_sql) } item.columns.forEach(cell => { @@ -912,11 +948,15 @@ if (item.func === 'sPC_Get_structured_data' && /灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(res.message)) { res.message = res.message + '璇锋鏌ュ瓧娈甸泦' } - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode === 'version_up') { + this.reloadTabs() + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } resolve(false) } else { res.componentId = componentId @@ -1076,6 +1116,28 @@ }) } + reloadTabs = () => { + if (this.reloading) return + + let time = new Date().getTime() + + let oldTime = sessionStorage.getItem('mk_reloadTabs') + + if (oldTime && time - oldTime < 180000) return + + sessionStorage.setItem('mk_reloadTabs', time) + + 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') -- Gitblit v1.8.0