From 91a577205dec0b967ed1e94f31426a9062ff10f4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 十月 2024 22:40:00 +0800 Subject: [PATCH] Merge branch 'develop' --- src/views/billprint/index.jsx | 120 ++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 68 insertions(+), 52 deletions(-) diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 183f6cb..25fbfea 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -1043,63 +1043,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 } } -- Gitblit v1.8.0