diff --git a/src/views/device/sparePartsLedger/index.vue b/src/views/device/sparePartsLedger/index.vue
index 5c6cdf7..5c447f5 100644
--- a/src/views/device/sparePartsLedger/index.vue
+++ b/src/views/device/sparePartsLedger/index.vue
@@ -135,6 +135,22 @@
>
+
+
+
+
+
+ 打印
+
+
+
+
+
+
+
+ - {{printData.materialCode}}
+ - {{printData.materialDesc}}
+
+
+
+
+
+
@@ -729,6 +759,7 @@ import {
updateSparePartsLedger,
} from "@/api/device/sparePartsLedger";
import { getToken } from "@/utils/auth";
+import QRCode from 'qrcode';
export default {
name: "SparePartsLedger",
@@ -753,7 +784,7 @@ export default {
url:
process.env.VUE_APP_BASE_API + "/device/sparePartsLedger/importFile",
},
-
+ selectedRow: null,
// 遮罩层
loading: true,
// 选中数组
@@ -770,8 +801,25 @@ export default {
sparePartsLedgerList: [],
// 弹出层标题
title: "",
+ //打印弹出层标题
+ printTitle:"",
// 是否显示弹出层
open: false,
+ //是否显示打印弹出层
+ printOpen: false,
+ // 打印
+ printData: {
+ printable: 'printFrom',
+ ignore: ['no-print'],
+ workCenter: "暂无数据",
+ SAPNo: null,
+ manufacture: null,
+ auditor: null,
+ printDate: null,
+ factory: null,
+ productDate: null,
+ workTable: [],
+ },
// 查询参数
queryParams: {
pageNum: 1,
@@ -853,6 +901,7 @@ export default {
},
};
},
+
created() {
this.getList();
},
@@ -1012,6 +1061,43 @@ export default {
);
},
+
+ showPrint(row) {
+
+ const storageId = row.storageId || this.ids;
+ getSparePartsLedger(storageId).then((response) => {
+ this.reset();
+ this.printData = response.data;
+ this.printOpen = true;
+ // 使用 Vue 的 nextTick 来确保 DOM 已经更新
+ this.$nextTick(() => {
+ const canvas = this.$refs.qrCanvas;
+ const options = {
+ width: 200, // 设定二维码的宽度
+ height: 200 // 设定二维码的高度
+ };
+ QRCode.toCanvas(canvas,response.data.materialCode, options, error => {
+ if (error) console.error(error);
+ });
+ });
+ });
+ },
+ // 打印
+ handlePrint(params) {
+ console.log(params)
+ printJS({
+ printable: params.printable || 'printFrom', // 标签元素id
+ type: params.type || 'html',
+ maxWidth: 1500, // 最大宽度
+ font_size: "",// 设置字体大小
+ header: params.header, // '表单',
+ targetStyles: ['*'],
+ style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾
+ ignoreElements: params.ignore || [], // ['no-print']
+ properties: params.properties || null
+ })
+ },
+
// 导入-导入窗口打开
handleImport() {
this.upload.title = "设备信息导入";
@@ -1055,3 +1141,29 @@ export default {
},
};
+
+