From f16b3e3678c8afa1a9f1daeefa215ba6969ba481 Mon Sep 17 00:00:00 2001 From: minom Date: Mon, 30 Mar 2026 18:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/admin/print/print_multi_new.aspx | 352 ++++++++++++++++----------- 1 file changed, 214 insertions(+), 138 deletions(-) diff --git a/web/admin/print/print_multi_new.aspx b/web/admin/print/print_multi_new.aspx index 6174aff..1bde59c 100644 --- a/web/admin/print/print_multi_new.aspx +++ b/web/admin/print/print_multi_new.aspx @@ -23,7 +23,7 @@ }*/ html, body, form, .full-home, #printArea, .canvas-area { height: auto !important; - width: 210mm !important; + width: auto !important; overflow: visible !important; /*必須為 visible */ margin: 0 !important; padding: 0 !important; @@ -107,7 +107,7 @@ { name: "紅2", path: "../../admin/print/html/tablet-2B.svg" } ], async init() { - console.log("init"); + let HTTP_HOST = "<%=UrlHost()%>"; this.http_host = HTTP_HOST; await Promise.all([ @@ -197,13 +197,25 @@ render() { let self = this; let canvas = $(`
`) + let nowPageWidth = 0; + let tabletpaper; this.printData.forEach(x => { - let style = this.allStyle.find(y => y.styleID == x.style); - console.log("style:", style); - let size = this.allSize.find(y => y.paperID == style.paperSize); + let style = self.allStyle.find(y => y.styleID == x.style); + + let size = self.allSize.find(y => y.paperID == style.paperSize); - - let tabletpaper = $(`
+ if ((nowPageWidth + parseFloat(size.width)) > 297) { + $(canvas).css("width", "297" + "mm"); + $(canvas).css("height", "210" + "mm"); + $(canvas).css("break-after", "page"); + $(canvas).css("page-break-after", "always"); + $(canvas).append(tabletpaper); + $("#printArea").append(canvas); + canvas = $(`
`) + nowPageWidth = 0; + } + nowPageWidth = nowPageWidth + parseFloat(size.width); + tabletpaper = $(`
`) let img = self.bg.find(y => y.name == style.backendImg); tabletpaper.css({ @@ -221,17 +233,20 @@ let mid_items = tablet.mid_items; let left_items = tablet.left_items; - console.log("mid_items:", mid_items) + let details = this.allStyleDetails.filter(y => y.styleID == x.style); let mid = []; mid_items.forEach(y => { mid.push(y.fam_name); }); + + console.log("details:", details); details.forEach(d => { if (d.isActive != "hidden") { - console.log(d); + //console.log(d); + let { newFontSize, newTxtWidth } = self.scaleFontSize(mid, style, d) let html = ""; - if (d.elementID = 'title1') { + if (d.elementID === 'title1') { let $namelist = $(`
`).css({ "writing-mode": "vertical rl", display: "flex", @@ -242,24 +257,29 @@ height: `${d.height}px`, border: "0px solid #ccc", padding: "1px", - "font-family": "Kaiti", + "font-family": "DFKai-sb", "letter-spacing": "0.1em", "column-gap": "1px", "row-gap": "1px", "align-items": "center", + "justify-content":"center" }); + mid.forEach(z => { + let $span = $(`${z}`).css({ display: "block", "min-height": `${d.textHeight}px`, "max-height": `${d.height}px`, - width: `${d.textWidth}px`, + //width: newTxtWidth +"px", //`${d.textWidth}px`, "text-align": "justify", "text-align-last": "justify", "margin-bottom": "20px", "margin-left": "5px", "text-justify": "inter-character", + //"font-size": newFontSize + "px", "z-index": 10000, + "word-break": "break-all" }); $namelist.append($span); }); @@ -267,28 +287,29 @@ html = $namelist; } + console.log(mid, newFontSize, newTxtWidth) let content = $(`
`) .css({ - position: "absolute", left: d.startX + "mm", top: d.startY + "mm", fontSize: d.fontSize + 'pt', fontFamily: d.fontFamily, "z-index": 9999, visibility: d.isActive + position: "absolute", left: d.startX + "mm", top: d.startY + "mm", fontSize: newFontSize + 'pt', + fontFamily: d.fontFamily, "font-weight": "bold", "z-index": 9999, visibility: d.isActive, + //"text-align": "justify","text-align-last": "justify", //position: "absolute", left: el.startX + "mm", top: el.startY + "mm", fontSize: el.fontSize + 'pt', fontFamily: el.fontFamily, "z-index": 9999, visibility: el.isActive }) .html(html); tabletpaper.append(content); + html = ""; } }) - $(canvas).append(tabletpaper); - console.log(size.width,size.height); - let pageStyle = ` + - + ${canvasHtml}