From 8fcd7a67e4391a5f1fbdb590c2a3f913aeb2a0a0 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期二, 31 三月 2026 14:11:23 +0800
Subject: [PATCH] PP平库功能上线,PDA优化,部分问题点优化
---
代码管理/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue | 146 ++++++++++++++++++++++++++++--------------------
1 files changed, 84 insertions(+), 62 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue"
index 43f8429..108ba91 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/extension/basic/extend/materielcodeprintView.vue"
@@ -7,42 +7,35 @@
:padding="15"
title="鎵撳嵃"
>
- <div
- id="printContent"
- style="display: flex; justify-content: center; align-items: center"
- >
- <div
- style="display: flex; justify-content: center; align-items: center"
- >
+ <div id="printContent" style="display: flex; justify-content: center; align-items: center">
+ <div style="display: flex; justify-content: center; align-items: center">
<VueQrcode id="qrcode" :value="Code" :size="200"></VueQrcode>
</div>
</div>
<div id="palletcode">
- <!-- <span
- style="display: flex; justify-content: center; align-items: center"
- >{{ Code }}</span
- > -->
- <span
- style="display: flex; justify-content: center; align-items: center"
+ <span style="display: flex; justify-content: center; align-items: center"
>鐗╂枡缂栫爜:{{ materielCode }}</span
+ >
+ <!-- decimal鏈夊�兼墠鏄剧ず鐗╂枡闀垮害锛屾棤鍊煎垯闅愯棌 -->
+ <span
+ v-if="isHasMaterielLength"
+ style="display: flex; justify-content: center; align-items: center; margin-top: 8px"
+ >鐗╂枡闀垮害:{{ materielLength }}</span
>
</div>
<template #footer>
<el-button type="primary" size="small" @click="print()">鎵撳嵃</el-button>
- <el-button type="danger" size="small" @click="showDetialBox = false"
- >鍏抽棴</el-button
- >
+ <el-button type="danger" size="small" @click="showDetialBox = false">鍏抽棴</el-button>
</template>
</vol-box>
</div>
</template>
-
- <script>
+
+<script>
import VolBox from "@/components/basic/VolBox.vue";
import VueQrcode from "vue-qrcode";
import QRCode from "qrcode";
-import { da } from "element-plus/es/locales.mjs";
export default {
components: { VolBox, VueQrcode },
data() {
@@ -57,102 +50,131 @@
quantity: "",
productionDate: "",
effectiveDate: "",
+ materielLength: null, // decimal绫诲瀷鍒濆鍖栦负null锛屽尮閰嶅悗绔暟鍊肩被鍨�
};
+ },
+ computed: {
+ // 璁$畻灞炴�э細缁熶竴鍒ゆ柇鏄惁鏈夌墿鏂欓暱搴︼紙decimal鏈夋湁鏁堟暟鍊硷級锛屾ā鏉垮拰閫昏緫澶嶇敤
+ isHasMaterielLength() {
+ return this.materielLength !== null && this.materielLength !== undefined&& this.materielLength !== 0;
+ },
},
methods: {
open(row) {
this.row = row;
this.showDetialBox = true;
+ // 姣忔鎵撳紑閲嶇疆鎵�鏈夊�硷紝閬垮厤缂撳瓨
+ this.resetForm();
if (row && row.materielCode) {
- this.materielCode = row.materielCode;
- this.lotNo = row.lotNo;
- this.purchaseOrderNo = row.purchaseOrderNo;
- this.quantity = row.quantity;
+ // 璧嬪�煎熀纭�瀛楁
+ this.materielCode = row.materielCode || "";
+ this.lotNo = row.lotNo || "";
+ this.purchaseOrderNo = row.purchaseOrderNo || "";
+ this.quantity = row.quantity || "";
this.productionDate = formatDate(row.productionDate);
this.effectiveDate = formatDate(row.effectiveDate);
+ // 璧嬪�糳ecimal绫诲瀷鐗╂枡闀垮害锛岀洿鎺ュ彇鍚庣鍊硷紙null/undefined/鏁板�奸兘鍏煎锛�
+ this.materielLength = row.materielLength;
}
- this.Code =
- "M:" +
- this.materielCode +
- ",BS:" +
- this.lotNo +
- ",DM:" +
- this.productionDate +
- ",DE:" +
- this.effectiveDate +
- ",Q:" +
- this.quantity +
- ",PO:" +
- this.purchaseOrderNo;
+ // 鏍稿績锛氭嫾鎺ヤ簩缁寸爜Code锛屾棤闀垮害鍒欏畬鍏ㄤ笉鍑虹幇,ML
+ this.Code = this.spliceQrCode();
+ },
+ // 鎶界浜岀淮鐮佹嫾鎺ラ�昏緫锛屼唬鐮佹洿娓呮櫚
+ spliceQrCode() {
+ // 鍩虹鍥哄畾鎷兼帴閮ㄥ垎
+ let baseStr = [
+ `M:${this.materielCode}`,
+ `BS:${this.lotNo}`,
+ `DM:${this.productionDate}`,
+ `DE:${this.effectiveDate}`,
+ `Q:${this.quantity}`,
+ `PO:${this.purchaseOrderNo}`,
+ ].join(",");
+ // 浠呭綋鏈夌墿鏂欓暱搴︽椂锛岃拷鍔�,ML:鏁板�硷紱鏃犲�煎垯鐩存帴杩斿洖鍩虹涓�
+ if (this.isHasMaterielLength) {
+ baseStr += `,ML:${this.materielLength}`;
+ }
+ return baseStr;
},
print() {
- let printContent = document.getElementById("printContent");
- let palletcode = document.getElementById("palletcode");
- var printWindow = window.open("", "");
- printWindow.document.write(printContent.innerHTML);
- printWindow.document.write(palletcode.innerHTML);
+ const printContent = document.getElementById("printContent");
+ const palletcode = document.getElementById("palletcode");
+ const printWindow = window.open("", "");
+ // 瀹屽杽鎵撳嵃椤甸潰缁撴瀯锛岄伩鍏嶆牱寮忛敊涔�
+ printWindow.document.write(`
+ <html>
+ <head><meta charset="utf-8"><title>鎵撳嵃</title></head>
+ <body style="text-align: center; padding: 20px;">
+ ${printContent.innerHTML}
+ ${palletcode.innerHTML}
+ </body>
+ </html>
+ `);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
},
- formatDate(dateStr) {
- let date = new Date(dateStr);
- let year = date.getFullYear();
- let month = String(date.getMonth() + 1).padStart(2, "0");
- let day = String(date.getDate()).padStart(2, "0");
- return year + "-" + month + "-" + day;
+ // 閲嶇疆琛ㄥ崟锛岄伩鍏嶅娆℃墦寮�寮圭獥缂撳瓨涓婁竴娆℃暟鎹�
+ resetForm() {
+ this.materielCode = "";
+ this.lotNo = "";
+ this.purchaseOrderNo = "";
+ this.quantity = "";
+ this.productionDate = "";
+ this.effectiveDate = "";
+ this.materielLength = null;
+ this.Code = "";
},
},
-
- created() {},
};
+// 鏃ユ湡鏍煎紡鍖栧伐鍏峰嚱鏁帮紝鍔犵┖鍊煎垽鏂伩鍏嶆姤閿�
function formatDate(dateStr) {
+ if (!dateStr) return "";
const date = new Date(dateStr);
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
- 2,
- "0"
- )}-${String(date.getDate()).padStart(2, "0")}`;
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
}
</script>
-
- <style scoped>
+
+<style scoped>
.el-col {
border-radius: 4px;
}
-
.grid-content {
border-radius: 4px;
min-height: 36px;
}
-
.content-text {
display: flex;
align-items: center;
justify-content: center;
}
-
.right-text {
display: flex;
align-items: center;
justify-content: flex-end;
}
</style>
- <style>
+
+<style>
.el-table .warning-row {
background: #e6a23c;
}
-
.el-table .success-row {
background: #f0f9eb;
}
-
.el-table .error-row {
background: #f56c6c;
}
-
canvas {
display: block;
margin: auto;
}
+/* 鎵撳嵃鏍峰紡浼樺寲锛岄�傞厤鎵撳嵃鏈� */
+@media print {
+ body {
+ margin: 0;
+ padding: 0;
+ }
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3