From cc9d69e980b73aae333ab72d370aff82594afbf4 Mon Sep 17 00:00:00 2001 From: czt <czt18638530771@163.com> Date: 星期五, 23 五月 2025 11:03:28 +0800 Subject: [PATCH] 调整细节 --- igds-dzhwk-web/src/main/resources/static/dzhwk/pest/PrintBuilder.js | 140 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 140 insertions(+), 0 deletions(-) diff --git a/igds-dzhwk-web/src/main/resources/static/dzhwk/pest/PrintBuilder.js b/igds-dzhwk-web/src/main/resources/static/dzhwk/pest/PrintBuilder.js new file mode 100644 index 0000000..68a9e56 --- /dev/null +++ b/igds-dzhwk-web/src/main/resources/static/dzhwk/pest/PrintBuilder.js @@ -0,0 +1,140 @@ +/** + * 鏍规嵁姘斾綋淇℃伅鐢熸垚鎵撳嵃妯$増 + * + * @param depotData + * 浠撳簱鍩烘湰淇℃伅 + * @param grainData + * 绮儏鏁版嵁淇℃伅 + */ +builderModel = function(curData,dept) { + var depotData = curData.depotData; + var listPoint = curData.listPoint; + + var model = "<!DOCTYPE html><html lang=\"zh-cn\">\n" + + "<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"><title>姘斾綋鎶ヨ〃妯$増</title>" + + " <style>\n" + + " table,table tr th,table tr td{border:1px solid #0d1021}table{width:100%;line-height:23px;text-align:center;font-size:14px}.table-2{border-top:0px solid #0d1021 !important}.table-2 tr{border-top:0px solid #0d1021 !important}.table-2 td{border-top:0px solid #0d1021 !important}.table-row-tr{border-left:0px !important;border-right:0px !important;border-top:0px !important}.table-row-fz{border:0px !important}.link-top{width:100%;border-top:solid #0d1021 1px}</style>\n" + + "</head><body>"; + + model += "<div style=\"text-align: center\">\n" + + "<span style=\"font-size: 26px; font-weight: bold;\">\n"; + if(dept){ + model += dept.name; + }else{ + model += "--XXX--绮簱" + } + model += "</span><div class=\"link-top\"></div><div class=\"link-top\"></div>\n"; + model += "<span style=\"font-size: 18px; \">"; + model += depotData.name; + model += " 铏鎶ヨ〃</span>\n"; + model += "</div><div style=\"margin-top: 5px;\"><span style=\"float: left;\">"; + model += " 鏂瑰悜锛氫笢</span><span style=\"float: right;\">妫�娴嬫椂闂达細"; + model += curData.receiveDate; + model += "</span></div>"; + + // 鍔ㄦ�侀厤缃� + model += "<table cellspacing=\"0\" cellpadding=\"0\">"; + model += "<tr><td>閲囬泦浣�</td><td>铏澶存暟</td><td>铏绫诲瀷</td><td>閲囬泦浣�</td><td>铏澶存暟</td><td>铏绫诲瀷</td></tr>"; + + var num = Math.ceil(listPoint.length / 2); + var index = 1; + var point; + for (var i = 0; i < num; i++) { + point = listPoint[index - 1]; + model += "<tr>"; + + model += "<td class=\"table-row-fz\">閲囬泦浣� " + point.passCode + "</td>"; + model += "<td class=\"table-row-fz\">" + attrPoint(point, curData) + + "</td>"; + model += "<td class=\"table-row-fz\">" + point.pestType + "</td>"; + + index++; + + if (index > listPoint.length) { + model += "<td class=\"table-row-fz\"></td>"; + model += "<td class=\"table-row-fz\"></td>"; + model += "<td class=\"table-row-fz\"></td>"; + } else { + point = listPoint[index - 1]; + model += "<td class=\"table-row-fz\">閲囬泦浣� " + point.passCode + "</td>"; + model += "<td class=\"table-row-fz\">" + attrPoint(point, curData) + + "</td>"; + model += "<td class=\"table-row-fz\">" + point.pestType + "</td>"; + + index++; + } + model += "</tr>"; + } + model += "</table>"; + // <!--涓嬮潰琛ㄦ牸寮�濮�--> + model += "<table cellspacing=\"0\" cellpadding=\"0\" class=\"table-2\">"; + model += "<tr><td width=\"25%\">妫�娴嬪垎鏋愶細</td>"; + model += "<td colspan=3>" + curData.remark + "</td></tr>"; + model += "<tr><td width=\"25%\"></td><td width=\"25%\">鎬绘娴嬩綅鏁�</td><td width=\"25%\">妫�娴嬫渶澶氬ご鏁�</td><td width=\"25%\">澶囨敞</td></tr>"; + + // 姘斾綋鏁翠綋淇℃伅 + model += "<tr> <td>鏁翠粨</td><td>" + curData.checkNum + "</td>"; + model += "<td>" + curData.pestMax + "</td>"; + model += "<td></td></tr>"; + + + // 浠撳簱淇℃伅 + model += "<tr><td>浠撴埧绫诲瀷</td><td>" + depotData.depotTypeName + "</td>"; + model += "<td>鍏ヤ粨鏃ユ湡</td><td>" + depotData.storeDate + "</td></tr>"; + + model += "<tr><td>绮鍝佺</td><td>" + depotData.foodVarietyName + "</td>"; + model += "<td>瀹為檯鍌ㄩ噺锛堝惃锛�</td><td>" + depotData.storageReal + + "</td></tr>"; + + model += "<tr><td>鍏ヤ粨姘村垎锛�%锛�</td><td>" + depotData.perWet + "</td>"; + model += "<td>褰撳墠姘村垎锛�%锛�</td><td>" + depotData.perWet + "</td></tr>"; + + model += "<tr><td>鍙戣娊鐜囷紙%锛�</td><td></td>"; + model += "<td>绮浜у湴</td><td>" + depotData.foodLocation + + "</td></tr>"; + + model += "<tr><td>瀹归噸锛坘g/m3锛�</td><td>" + depotData.bulkWeight + "</td>"; + model += "<td>闈㈢瓔鎸佹按鐜囷紙%锛�</td><td></td></tr>"; + + model += "<tr><td>鏉傝川锛�%锛�</td><td>" + depotData.perImpurity + "</td>"; + model += "<td>涓嶅畬鍠勭矑锛�%锛�</td><td>" + depotData.broken + "</td></tr>"; + + model += "<tr><td>妫�娴嬩汉</td><td>" + curData.checkUser + "</td>"; + model += "<td>淇濈鍛�</td><td>" + depotData.storeKeeperName + + "</td></tr>"; + + model += "</table>"; + + // 娣诲姞灏鹃儴淇℃伅 + model += "<div style=\"margin-top: 5px;\">"; + model += "<span style=\"float: left;\">娉細#琛ㄧず鏈�浣� *琛ㄧず鏈�楂�</span>"; + model += "<span style=\"float: right;\">鍒惰〃鏃堕棿锛�" + curData.sysDate + + "</span></div>"; + model += "</div></body></html>"; + + return model; +}; + +// 鏍规嵁閲囬泦鐐硅祴鍊硷紝娉ㄦ剰鏁版嵁搴撶敓鎴愮殑鍧愭爣鏄粠0寮�濮嬬殑 +attrPoint = function(point, curData) { + if (-100.0 == point.pestNum) { + return "澶囩敤"; + } + if (curData.pestMax == point.pestNum) { + return point.pestNum + "*"; + } + return point.pestNum; +}; + +/** + * 鏍规嵁HTML妯$増鎵撳嵃涓篈4 + * + * @param strHtml + */ +previewA4 = function(strHtml) { + var LODOP = getLodop(); + LODOP.SET_PRINT_PAGESIZE(1, 0, 0, "A4"); + LODOP.PRINT_INIT("铏鎶ヨ〃"); + LODOP.ADD_PRINT_HTM(30, 40, "180mm", "100%", strHtml); + LODOP.PREVIEW(); +}; \ No newline at end of file -- Gitblit v1.9.3