|
@@ -290,6 +290,7 @@ import {
|
|
|
saveCarrierReject,
|
|
|
download,
|
|
|
printQrcodePdf,
|
|
|
+ whether,
|
|
|
} from "@/api/business/carrier";
|
|
|
import carrierForm from "./form";
|
|
|
import printJS from "print-js";
|
|
@@ -503,19 +504,23 @@ const handleUnAbandoned = (row) => {
|
|
|
};
|
|
|
|
|
|
const handleBatchPrintQrCode = async () => {
|
|
|
- const imageGroup = document.getElementById("image-group");
|
|
|
- // for (var i = 0; i < selections.value.length; i++) {
|
|
|
- // console.log(webHost + selections.value[i].qcCode);
|
|
|
- // const img = document.createElement('img');
|
|
|
- // img.src = webHost + selections.value[i].qcCode
|
|
|
- // imageGroup.appendChild(img);
|
|
|
- // }
|
|
|
- printJS({
|
|
|
- printable: "image-group", // 这里是你要打印内容的DOM元素的id
|
|
|
- type: "html",
|
|
|
- style: "@page { size: auto; margin: 0mm; }", // 可以添加打印样式
|
|
|
+ whether(selections.value).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ const imageGroup = document.getElementById("image-group");
|
|
|
+ // for (var i = 0; i < selections.value.length; i++) {
|
|
|
+ // console.log(webHost + selections.value[i].qcCode);
|
|
|
+ // const img = document.createElement('img');
|
|
|
+ // img.src = webHost + selections.value[i].qcCode
|
|
|
+ // imageGroup.appendChild(img);
|
|
|
+ // }
|
|
|
+ printJS({
|
|
|
+ printable: "image-group", // 这里是你要打印内容的DOM元素的id
|
|
|
+ type: "html",
|
|
|
+ style: "@page { size: auto; margin: 0mm; }", // 可以添加打印样式
|
|
|
+ });
|
|
|
+ // window.print();
|
|
|
+ }
|
|
|
});
|
|
|
- // window.print();
|
|
|
};
|
|
|
|
|
|
const handleBatchPrintPdf = () => {
|
|
@@ -548,24 +553,28 @@ const handleBatchPrintPdf = () => {
|
|
|
async function handleBatchDownloadQrCode() {
|
|
|
console.log(selections.value);
|
|
|
|
|
|
- const zip = new JSZip();
|
|
|
- const zipFilename = "二维码.zip";
|
|
|
-
|
|
|
- for (var i = 0; i < selections.value.length; i++) {
|
|
|
- console.log(webHost + selections.value[i].qcCode);
|
|
|
-
|
|
|
- // 下载二维码图片数据
|
|
|
- const qrCodeResponse = await fetch(webHost + selections.value[i].qcCode);
|
|
|
- const qrCodeBlob = await qrCodeResponse.blob();
|
|
|
+ whether(selections.value).then(async (res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ const zip = new JSZip();
|
|
|
+ const zipFilename = "二维码.zip";
|
|
|
+ for (var i = 0; i < selections.value.length; i++) {
|
|
|
+ console.log(webHost + selections.value[i].qcCode);
|
|
|
|
|
|
- // 将二维码图片添加到 ZIP 文件中
|
|
|
- zip.file(selections.value[i].code + ".png", qrCodeBlob);
|
|
|
- }
|
|
|
+ // 下载二维码图片数据
|
|
|
+ const qrCodeResponse = await fetch(
|
|
|
+ webHost + selections.value[i].qcCode
|
|
|
+ );
|
|
|
+ const qrCodeBlob = await qrCodeResponse.blob();
|
|
|
|
|
|
- // 生成 ZIP 文件并提供下载
|
|
|
- zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
- // 使用 FileSaver.js 将 ZIP 文件保存到本地
|
|
|
- saveAs(content, zipFilename);
|
|
|
+ // 将二维码图片添加到 ZIP 文件中
|
|
|
+ zip.file(selections.value[i].code + ".png", qrCodeBlob);
|
|
|
+ }
|
|
|
+ // 生成 ZIP 文件并提供下载
|
|
|
+ zip.generateAsync({ type: "blob" }).then((content) => {
|
|
|
+ // 使用 FileSaver.js 将 ZIP 文件保存到本地
|
|
|
+ saveAs(content, zipFilename);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|