Kaynağa Gözat

增加了打印凭证和打印协议功能

panlijun 2 ay önce
ebeveyn
işleme
b79478381f

+ 11 - 17
sa-view/tb-orders/tb-orders-email.html

@@ -186,9 +186,9 @@
 			</div>
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
-				<!--<el-button type="primary" icon="el-icon-printer" @click="htmlToPdf()">预览凭证</el-button>-->
-				<el-button type="primary" icon="el-icon-printer" @click="downloadToPdf()">下载凭证</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button type="success" icon="el-icon-printer" @click="htmlToPdf()">打印协议</el-button>
+				<el-button type="primary" icon="el-icon-download" @click="downloadToPdf()">下载协议</el-button>
+				<el-button @click="sa.closeCurrIframe()">关闭</el-button>
 			</div>
 		</div>
 		<script>
@@ -240,20 +240,14 @@
 							// 添加图片,适应页面大小
 							pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
 							// 将 PDF 保存为 Blob 并处理它  这里需要处理跨域问题
-							pdf.output('blob').then(function(blob) {
-								var blobURL = URL.createObjectURL(blob);
-								var newWindow = window.open(blobURL, '_blank');
-								if (newWindow) {
-									newWindow.focus();
-								} else {
-									alert('请允许弹出窗口或在新标签页中手动查看 PDF。');
-								}
-					
-								// 清理:当不再需要时,可以释放 Blob URL
-								// setTimeout(function() {
-								//     URL.revokeObjectURL(blobURL);
-								// }, 5000);
-							});
+							const pdfBlob = pdf.output('blob');
+							var blobURL = window.URL.createObjectURL(pdfBlob);
+							var newWindow = window.open(blobURL, '_blank');
+							if (newWindow) {
+								newWindow.focus();
+							} else {
+								alert('请允许弹出窗口或在新标签页中手动查看 PDF。');
+							}	
 						});
 					},
 				},

+ 12 - 17
sa-view/tb-orders/tb-orders-print.html

@@ -120,9 +120,9 @@
 			</div>
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
-				<!--<el-button type="primary" icon="el-icon-printer" @click="htmlToPdf()">预览凭证</el-button>-->
-				<el-button type="primary" icon="el-icon-printer" @click="downloadToPdf()">下载凭证</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button type="success" icon="el-icon-printer" @click="htmlToPdf()">打印凭证</el-button>
+				<el-button type="primary" icon="el-icon-download" @click="downloadToPdf()">下载凭证</el-button>
+				<el-button @click="sa.closeCurrIframe()">关闭</el-button>
 			</div>
 		</div>
 		<script>
@@ -173,21 +173,16 @@
 					
 							// 添加图片,适应页面大小
 							pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
+							
 							// 将 PDF 保存为 Blob 并处理它  这里需要处理跨域问题
-							pdf.output('blob').then(function(blob) {
-								var blobURL = URL.createObjectURL(blob);
-								var newWindow = window.open(blobURL, '_blank');
-								if (newWindow) {
-									newWindow.focus();
-								} else {
-									alert('请允许弹出窗口或在新标签页中手动查看 PDF。');
-								}
-					
-								// 清理:当不再需要时,可以释放 Blob URL
-								// setTimeout(function() {
-								//     URL.revokeObjectURL(blobURL);
-								// }, 5000);
-							});
+							const pdfBlob = pdf.output('blob');
+							var blobURL = window.URL.createObjectURL(pdfBlob);
+							var newWindow = window.open(blobURL, '_blank');
+							if (newWindow) {
+								newWindow.focus();
+							} else {
+								alert('请允许弹出窗口或在新标签页中手动查看 PDF。');
+							}							
 						});
 					},
 				},