From fec6c24bc3fd902f8ced64bc2600c0b0836f7e52 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 10 一月 2025 11:34:58 +0800 Subject: [PATCH] 2025-01-10 --- src/views/billprint/index.jsx | 237 ++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 163 insertions(+), 74 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 1969680..bb22cfb 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -2,6 +2,7 @@ import { is, fromJS } from 'immutable' 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' @@ -65,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, @@ -90,17 +92,29 @@ } componentDidMount() { - const _this = this + const that = this if (window.GLOB.sysType !== 'cloud') { Object.defineProperty(window, 'debugger', { configurable: true, enumerable: true, set(value) { - if (value + '' === 'false') { - window.GLOB.debugger = false - } else { + if (value === true) { window.GLOB.debugger = true + } else if (value === 0) { + if (window.backend) { + sessionStorage.setItem('systemRun', 'front') + window.location.reload() + } else { + window.mkInfo('绯荤粺褰撳墠鏈娇鐢ㄥ悗绔剼鏈紒') + } + } else if (value === false) { + if (sessionStorage.getItem('systemRun') === 'front') { + sessionStorage.removeItem('systemRun') + window.location.reload() + } else { + window.GLOB.debugger = false + } } } }) @@ -118,7 +132,7 @@ window.GLOB.breakpoint = value + '' sessionStorage.setItem('breakpoint', value) } - _this.debugChange() + that.debugChange() } }) } @@ -144,7 +158,7 @@ window.GLOB.breakpoint = false sessionStorage.removeItem('breakpoint') - _this.debugChange() + that.debugChange() } } } @@ -174,6 +188,10 @@ func: 's_Get_style', TypeCharOne: 'PC', LText: `select '${window.GLOB.appkey}'`, + } + + if (window.GLOB.style_appkey) { + _param.style_appkey = window.GLOB.style_appkey } _param.userid = result.UserID @@ -302,6 +320,22 @@ let _pars = [] 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') || '' @@ -487,6 +521,8 @@ component.setting.sync = 'false' return component } + + component.setting.uuid = component.uuid let _customScript = '' let _tailScript = '' @@ -532,11 +568,17 @@ component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + + if (window.backend && config.allSqls) { + component.setting.sync = 'false' + } else if (_tailScript) { + component.setting.sync = 'false' + } + component.dataName = 'mk' + component.uuid.slice(-18) // floor 缁勪欢鐨勫眰绾� // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ if (component.setting.sync === 'true') { - component.dataName = 'mk' + component.uuid.slice(-18) let param = this.getDefaultParam(component) _pars.push(param) } else if (component.subtype !== 'dualdatacard') { @@ -554,8 +596,29 @@ _pars = this.getFormatParam(_pars, config.MenuName) if (_pars) { - _pars.componentId = 'union' + _pars.componentId = '' params.unshift(_pars) + } else if (window.backend && config.allSqls && params.length > 0) { + let data = [] + params = params.filter(item => { + if (!item.$backend || item.public) return true + + item.data[0].exps.forEach(cell => { + if (cell.key === 'mk_obj_name') { + cell.value = 'mk' + item.componentId.slice(-18) + } + }) + data.push(item.data[0]) + return false + }) + if (data.length > 0) { + params.push({ + $backend: true, + $type: 's_Get_TableData', + componentId: '', + data + }) + } } if (config.everyPCount && !config.printPage) { // 鍏煎 @@ -682,6 +745,8 @@ } return } + + inter.setting.uuid = inter.uuid let _customScript = '' let _tailScript = '' @@ -876,11 +941,13 @@ return new Promise(resolve => { Api.genericInterface(item).then(res => { if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode !== '-2') { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } resolve() } else { let _data = { $$empty: true } @@ -911,7 +978,6 @@ let deffers = params.map(item => { let componentId = item.componentId - let ispublic = item.public delete item.componentId delete item.public return new Promise(resolve => { @@ -922,7 +988,7 @@ } if (res.ErrCode === 'version_up') { this.reloadTabs() - } else { + } else if (res.ErrCode !== '-2') { notification.warning({ top: 92, message: res.message, @@ -933,13 +999,12 @@ } else { res.componentId = componentId - if (ispublic) { - let _data = { $$empty: true } - if (res.data && res.data[0]) { - _data = res.data[0] - } - window.GLOB.CacheData.set(componentId, _data) + let _data = { $$empty: true } + if (res.data && res.data[0]) { + _data = res.data[0] } + window.GLOB.CacheData.set(componentId, _data) + resolve(res) } }) @@ -962,7 +1027,7 @@ _results.forEach(res => { if ((res.componentId === item.uuid || res.componentId === item.componentId) && res.data) { item.dataArray = fromJS(res.data).toJS() - } else if (res.componentId === 'union' && res[item.dataName]) { + } else if (res[item.dataName]) { let data = res[item.dataName] if (!Array.isArray(data)) { data = [data] @@ -994,63 +1059,79 @@ } } - while (!over) { - let page = [] - let count = 0 - let _pageover = false - - comps.forEach(comp => { - let item = fromJS(comp).toJS() - - if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 - item.data = item.dataArray || null - setData(item) - page.push(item) - comp.added = true - } - - if (_pageover) return - - if (item.$page && comp.dataArray.length > 0) { - item.data = [] - - while (count + 1 <= limit && comp.dataArray.length > 0) { - item.data.push(comp.dataArray.shift()) - count++ - } - - if (count >= limit || comp.dataArray.length > 0) { - _pageover = true - } - - if (comp.dataArray.length === 0) { + if (this.state.config.printPage === 'custom' && this.state.config.printScripts) { + try { + // eslint-disable-next-line + let func = new Function('components', 'pages', 'notification', this.state.config.printScripts) + func(comps, pages, notification) + } catch (e) { + console.warn(e) + + notification.warning({ + top: 92, + message: '鑷畾涔夎剼鏈墽琛岄敊璇紒', + duration: 5 + }) + } + } else { + while (!over) { + let page = [] + let count = 0 + let _pageover = false + + comps.forEach(comp => { + let item = fromJS(comp).toJS() + + if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 + item.data = item.dataArray || null + setData(item) + page.push(item) comp.added = true } - - setData(item) - page.push(item) - } else if (!comp.added) { - if (item.wrap.printHeight) { - count += item.wrap.printHeight - if (count >= limit) { - _pageover = true - return + + if (_pageover) return + + if (item.$page && comp.dataArray.length > 0) { + item.data = [] + + while (count + 1 <= limit && comp.dataArray.length > 0) { + item.data.push(comp.dataArray.shift()) + count++ } + + if (count >= limit || comp.dataArray.length > 0) { + _pageover = true + } + + if (comp.dataArray.length === 0) { + comp.added = true + } + + setData(item) + page.push(item) + } else if (!comp.added) { + if (item.wrap.printHeight) { + count += item.wrap.printHeight + if (count >= limit) { + _pageover = true + return + } + } + + item.data = item.dataArray || null + + setData(item) + page.push(item) + comp.added = true } - - item.data = item.dataArray || null - - setData(item) - page.push(item) - comp.added = true + }) + + pages.push(page) + pageIndex++ + + if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) { + over = true } - }) - - pages.push(page) - pageIndex++ - - if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) { - over = true } } @@ -1091,6 +1172,14 @@ 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(() => { -- Gitblit v1.8.0