| | |
| | | :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> |
| | |
| | | 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() { |
| | |
| | | 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); |
| | | // èµå¼decimalç±»åç©æé¿åº¦ï¼ç´æ¥åå端å¼ï¼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> |
| | | |
| | |
| | | .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> |
| | | .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> |