From 3989f167b217f60e6c52722a2726450e029c7800 Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期二, 04 六月 2024 15:01:16 +0800
Subject: [PATCH] 调整打印
---
HTML_09/views/SystemSettings/PrintModule.html | 42 ++++++++-------------
HTML_09/views/SystemSettings/PrintTemplateFrom.html | 9 ++--
HTML_09/views/SystemSettings/PrintSetting.html | 19 +++------
HTML_09/js/hiprint/plugins/config-etype-provider.js | 10 ++--
HTML_09/js/public.js | 18 ++++++++
5 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/HTML_09/js/hiprint/plugins/config-etype-provider.js b/HTML_09/js/hiprint/plugins/config-etype-provider.js
index b4ce7a1..17eb26d 100644
--- a/HTML_09/js/hiprint/plugins/config-etype-provider.js
+++ b/HTML_09/js/hiprint/plugins/config-etype-provider.js
@@ -143,11 +143,11 @@
[
new hiprint.PrintElementTypeGroup("鎵撳嵃鏍囩", datalist),
new hiprint.PrintElementTypeGroup("杈呭姪", [
- // {
- // tid: 'testModule.tableCustom',
- // title: '鑷畾涔夎〃鏍�',
- // type: 'tableCustom'
- // },
+ {
+ tid: 'testModule.tableCustom',
+ title: '鑷畾涔夎〃鏍�',
+ type: 'tableCustom'
+ },
{ tid: 'configModule.customText', title: '鑷畾涔夋枃鏈�', customText: '鑷畾涔夋枃鏈�', custom: true, type: 'text' },
{ tid: 'configModule.image', title: '鍥剧墖', data: '../../js/hiprint/hi.png', type: 'image' },
{
diff --git a/HTML_09/js/public.js b/HTML_09/js/public.js
index baf1024..65df63c 100644
--- a/HTML_09/js/public.js
+++ b/HTML_09/js/public.js
@@ -281,4 +281,20 @@
}
}
return target;
-}
\ No newline at end of file
+}
+
+//璋冪敤鎵撳嵃
+function openPrintDialog(printData){
+ layer.open({
+ type: 2,
+ title: '鎵撳嵃',
+ content: '/views/SystemSettings/PrintModule.html',
+ maxmin: true,
+ area: ['100%', '100%'],
+ data: printData,
+ success: function (layero, index) {
+ var body = layer.getChildFrame('body',index);
+ body.find('#printData').val(JSON.stringify(printData));
+ }
+ });
+}
\ No newline at end of file
diff --git a/HTML_09/views/SystemSettings/PrintModule.html b/HTML_09/views/SystemSettings/PrintModule.html
index 7b9f477..28394cc 100644
--- a/HTML_09/views/SystemSettings/PrintModule.html
+++ b/HTML_09/views/SystemSettings/PrintModule.html
@@ -12,15 +12,6 @@
<link rel="stylesheet" type="text/css" href="../../js/HiPrint/css/hiprint.css?t=' + Math.random() + '" />
<link rel="stylesheet" type="text/css" href="../../js/HiPrint/css/print-lock.css" />
<!-- <link rel="stylesheet" type="text/css" href="../../js/HiPrint/css/bootstrap.min.css" > -->
- <script src="../../js/jquery-3.5.1.min.js"></script>
- <script src="../../js/hiprint/content/bootstrap.min.js"></script>
- <script src="../../js/HiPrint/hiprint.bundle.js?t=' + Math.random() + '"></script>
- <script src="../../js/HiPrint/polyfill.min.js"></script>
- <script src="../../js/HiPrint/plugins/jquery.minicolors.min.js"></script>
- <script src="../../js/HiPrint/plugins/JsBarcode.all.min.js"></script>
- <script src="../../js/HiPrint/plugins/qrcode.js"></script>
- <script src="../../js/HiPrint/plugins/jquery.hiwprint.js"></script>
- <script src="../../js/HiPrint/plugins/config-etype-provider.js"></script>
<style>
.layui-form-label {
padding: 5px 1px;
@@ -35,6 +26,7 @@
<body>
<div class="layui-card">
+ <input type="hidden" id="printData" name="printData">
<div class="row">
<!--宸︿晶div-->
@@ -79,24 +71,19 @@
</div>
</div>
+ <script src="../../js/jquery-3.5.1.min.js"></script>
+ <script src="../../js/jquery.cookie.js"></script>
+ <script src="../../js/hiprint/content/bootstrap.min.js"></script>
+ <script src="../../js/HiPrint/hiprint.bundle.js?t=' + Math.random() + '"></script>
+ <script src="../../js/HiPrint/polyfill.min.js"></script>
+ <script src="../../js/HiPrint/plugins/jquery.minicolors.min.js"></script>
+ <script src="../../js/HiPrint/plugins/JsBarcode.all.min.js"></script>
+ <script src="../../js/HiPrint/plugins/qrcode.js"></script>
+ <script src="../../js/HiPrint/plugins/jquery.hiwprint.js"></script>
+ <script src="../../js/HiPrint/plugins/config-etype-provider.js"></script>
<script src="../../layuiadmin/layui/layui.js"></script>
<script src="../../js/public.js"></script>
- <script src="../../js/jquery.cookie.js"></script>
<script>
- //杩欓噷鑾峰彇涓婄骇椤甸潰鐨刾rintData鏁版嵁鎵撳嵃
- // var printData = [{
- // SkuNo: '000001',
- // SkuName: '娴嬭瘯鐗╂枡1',
- // Standard:'xxxxxx',
- // LotNo:'20230801'
- // },{
- // SkuNo: '000002',
- // SkuName: '娴嬭瘯鐗╂枡2',
- // Standard:'xxxxxx',
- // LotNo:'20230801'
- // }];
- debugger;
- var printData = deepClone(parent.printData);
var configPrintJson;
//鍒濆鍖栨墦鍗版彃浠舵覆鏌�
@@ -126,10 +113,13 @@
hiprintTemplate.design('#hiprint-printTemplate');
//鎵撳嵃
- hiprintTemplate.print(printData);
setTimeout(function () {
+ //杩欓噷鑾峰彇涓婄骇椤甸潰鐨刾rintData鏁版嵁鎵撳嵃
+ // var printData = deepClone(parent.printData);
+ var printData = JSON.parse($("#printData").val());
+ hiprintTemplate.print(printData);
parent.layer.closeAll();
- }, 2000);
+ }, 100);
}
else //涓嶆垚鍔�
{
diff --git a/HTML_09/views/SystemSettings/PrintSetting.html b/HTML_09/views/SystemSettings/PrintSetting.html
index c6ad4b9..34857ec 100644
--- a/HTML_09/views/SystemSettings/PrintSetting.html
+++ b/HTML_09/views/SystemSettings/PrintSetting.html
@@ -256,6 +256,7 @@
active = {
//鏂板
add: function () {
+ objRowsData = {};
var index = layer.open({
type: 2,
title: '娣诲姞妯℃澘淇℃伅',
@@ -347,24 +348,16 @@
SkuNo: '000001',
SkuName: '娴嬭瘯鐗╂枡1',
Standard: 'xxxxxx',
- LotNo: '20230801'
+ LotNo: '20230801',
+ Qty: 100
}, {
SkuNo: '000002',
SkuName: '娴嬭瘯鐗╂枡2',
Standard: 'xxxxxx',
- LotNo: '20230801'
+ LotNo: '20230801',
+ Qty: 100
}];
- layer.open({
- type: 2,
- title: '鎵撳嵃',
- content: '/views/SystemSettings/PrintModule.html',
- maxmin: true,
- area: ['100%', '100%'],
- data: printData,
- end: function () {
-
- }
- });
+ openPrintDialog(printData)
});
</script>
</body>
diff --git a/HTML_09/views/SystemSettings/PrintTemplateFrom.html b/HTML_09/views/SystemSettings/PrintTemplateFrom.html
index 6723c98..cc0aa87 100644
--- a/HTML_09/views/SystemSettings/PrintTemplateFrom.html
+++ b/HTML_09/views/SystemSettings/PrintTemplateFrom.html
@@ -184,6 +184,7 @@
//淇敼
var id = getQueryString('id');
if (!id) {
+ $('#Id').val('');
id = 0;
}
else {
@@ -214,10 +215,10 @@
hiprint.PrintElementTypeManager.build('.hiprintEpContainer',
'testModule');
-
- var hiprintTemplate;
- var JsonData = JSON.parse(window.parent.objRowsData.PositionJson)
- if (JsonData != '') {
+ let hiprintTemplate;
+ if (window.parent.objRowsData.PositionJson)
+ var JsonData = JSON.parse(window.parent.objRowsData.PositionJson)
+ if (JsonData) {
$("#customWidth").val(JsonData.panels[0].width);
$("#customHeight").val(JsonData.panels[0].height);
hiprintTemplate = new hiprint.PrintTemplate({
--
Gitblit v1.8.0