Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f571704614 | ||
|
|
c3da8055ec | ||
|
|
852b446901 | ||
|
|
225a7a1932 | ||
|
|
466ac71f80 | ||
|
|
e7ac5f3bbf | ||
|
|
a173cf7044 |
@@ -7,6 +7,7 @@ export interface FullWorkOrderResp {
|
|||||||
title: string
|
title: string
|
||||||
orderNo: string
|
orderNo: string
|
||||||
materialCode: string
|
materialCode: string
|
||||||
|
encodingPrint: string
|
||||||
materialName: string
|
materialName: string
|
||||||
batch: string
|
batch: string
|
||||||
mark: string
|
mark: string
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export interface MaterialInfoResp {
|
|||||||
id: string
|
id: string
|
||||||
materialName: string
|
materialName: string
|
||||||
encoding: string
|
encoding: string
|
||||||
|
encodingPrint: string
|
||||||
unitWeight: string
|
unitWeight: string
|
||||||
materialSpec: string
|
materialSpec: string
|
||||||
photoUrl: string
|
photoUrl: string
|
||||||
@@ -22,6 +23,7 @@ export interface MaterialInfoResp {
|
|||||||
export interface MaterialInfoQuery {
|
export interface MaterialInfoQuery {
|
||||||
materialName: string | undefined
|
materialName: string | undefined
|
||||||
encoding: string | undefined
|
encoding: string | undefined
|
||||||
|
encodingPrint: string | undefined
|
||||||
batch: string | undefined
|
batch: string | undefined
|
||||||
mark: string | undefined
|
mark: string | undefined
|
||||||
sort: Array<string>
|
sort: Array<string>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const BASE_URL = '/weighManage/workOrder'
|
|||||||
export interface WeighManageResp {
|
export interface WeighManageResp {
|
||||||
id: string
|
id: string
|
||||||
encoding: string
|
encoding: string
|
||||||
|
encodingPrint: string
|
||||||
materialName: string
|
materialName: string
|
||||||
materialSpec: string
|
materialSpec: string
|
||||||
unitWeight: number
|
unitWeight: number
|
||||||
|
|||||||
@@ -79,3 +79,8 @@ export function deleteWorkOrder(ids: string | Array<string>) {
|
|||||||
export function exportWorkOrder(query: WorkOrderQuery) {
|
export function exportWorkOrder(query: WorkOrderQuery) {
|
||||||
return http.download(`${BASE_URL}/export`, query)
|
return http.download(`${BASE_URL}/export`, query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @desc 保存打印记录 */
|
||||||
|
export function savePrintRecord(data: any) {
|
||||||
|
return http.post(`/print/print`, data)
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,17 @@
|
|||||||
<a-input v-model="formData.batch" placeholder="未获取到生产批次" :disabled="true" />
|
<a-input v-model="formData.batch" placeholder="未获取到生产批次" :disabled="true" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="打印编码(国产替代)">
|
||||||
|
<a-input v-model="formData.encodingPrint" allow-clear placeholder="请输入打印编码" @change="getMaterialName"/>
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
<div class="form-grid-item">
|
||||||
|
<a-form-item label="打印物料名称(国产替代)">
|
||||||
|
<a-input v-model="formData.materialNamePrint" allow-clear placeholder="请输入打印物料名称"/>
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-form>
|
</a-form>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
@@ -190,8 +201,9 @@
|
|||||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import {getWorkOrder, type WorkOrderInfoResp} from "@/apis/workOrder/workOrder"
|
import {getWorkOrder, savePrintRecord, type WorkOrderInfoResp} from "@/apis/workOrder/workOrder"
|
||||||
import QRCode from 'qrcode';
|
import QRCode from 'qrcode';
|
||||||
|
import {getMaterialDetail} from "@/apis/weightManage/weightManage";
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -199,6 +211,8 @@ const route = useRoute()
|
|||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
workerOrderId: '',
|
workerOrderId: '',
|
||||||
encoding: '',
|
encoding: '',
|
||||||
|
encodingPrint: '',
|
||||||
|
materialNamePrint: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
orderNo: '',
|
orderNo: '',
|
||||||
totalCalculatedWeight: '',
|
totalCalculatedWeight: '',
|
||||||
@@ -243,6 +257,21 @@ const labelData = reactive({
|
|||||||
// 标签容器引用
|
// 标签容器引用
|
||||||
const labelContainer = ref<HTMLElement | null>(null)
|
const labelContainer = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
|
const getMaterialName = async (value: string) => {
|
||||||
|
try {
|
||||||
|
const res = await getMaterialDetail(value)
|
||||||
|
if (res.code == '0') {
|
||||||
|
formData.materialNamePrint = res.data.materialName || ''
|
||||||
|
} else {
|
||||||
|
formData.materialNamePrint = '';
|
||||||
|
Message.error('获取物料信息失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
formData.materialNamePrint = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 生成二维码
|
// 生成二维码
|
||||||
const generateQRCode = async (data: string) => {
|
const generateQRCode = async (data: string) => {
|
||||||
try {
|
try {
|
||||||
@@ -268,7 +297,6 @@ const generateDetailLabel = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!formData.batch) {
|
if (!formData.batch) {
|
||||||
console.log("11111", formData.batch);
|
|
||||||
Message.error('未获取到批次信息')
|
Message.error('未获取到批次信息')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -297,15 +325,15 @@ const generateDetailLabel = async () => {
|
|||||||
for (const workOrderInfo of formData.workOrderInfos) {
|
for (const workOrderInfo of formData.workOrderInfos) {
|
||||||
// 计算二维码数据
|
// 计算二维码数据
|
||||||
const orderNo = formData.orderNo + workOrderInfo.id;
|
const orderNo = formData.orderNo + workOrderInfo.id;
|
||||||
const qrCodeData = `10#${formData.encoding}$11#9DP$12#${formData.batch}$17#${workOrderInfo.quantity}$20#${formattedDate2}$31#${orderNo}$DY`
|
const qrCodeData = `10#${formData.encodingPrint || formData.encoding}$11#9DP$12#${formData.batch}$17#${workOrderInfo.quantity}$20#${formattedDate2}$31#${orderNo}$DY`;
|
||||||
|
|
||||||
// 生成二维码图片
|
// 生成二维码图片
|
||||||
const qrCodeImage = await generateQRCode(qrCodeData)
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
|
|
||||||
// 添加标签数据
|
// 添加标签数据
|
||||||
labelDataList.push({
|
labelDataList.push({
|
||||||
partName: formData.materialName || '',
|
partName: formData.materialNamePrint || formData.materialName || '',
|
||||||
partNumber: formData.encoding || '',
|
partNumber: formData.encodingPrint || formData.encoding || '',
|
||||||
totalCalculatedWeight: workOrderInfo.calculatedWeight || '',
|
totalCalculatedWeight: workOrderInfo.calculatedWeight || '',
|
||||||
totalWeight: workOrderInfo.weight || '',
|
totalWeight: workOrderInfo.weight || '',
|
||||||
productionDate: formattedDate,
|
productionDate: formattedDate,
|
||||||
@@ -353,15 +381,15 @@ const generateOverallLabel = async () => {
|
|||||||
String(now.getDate()).padStart(2, '0')
|
String(now.getDate()).padStart(2, '0')
|
||||||
|
|
||||||
// 计算二维码数据
|
// 计算二维码数据
|
||||||
const qrCodeData = `10#${formData.encoding}$11#9DP$12#${formData.batch}$17#${formData.totalCount}$20#${formattedDate2}$31#${formData.orderNo}$DY`
|
const qrCodeData = `10#${formData.encodingPrint || formData.encoding}$11#9DP$12#${formData.batch}$17#${formData.totalCount}$20#${formattedDate2}$31#${formData.orderNo}$DY`
|
||||||
|
|
||||||
// 生成二维码图片
|
// 生成二维码图片
|
||||||
const qrCodeImage = await generateQRCode(qrCodeData)
|
const qrCodeImage = await generateQRCode(qrCodeData)
|
||||||
|
|
||||||
// 直接从 formData 中获取数据
|
// 直接从 formData 中获取数据
|
||||||
Object.assign(labelData, {
|
Object.assign(labelData, {
|
||||||
partName: formData.materialName || '',
|
partName: formData.materialNamePrint || formData.materialName || '',
|
||||||
partNumber: formData.encoding || '',
|
partNumber: formData.encodingPrint || formData.encoding || '',
|
||||||
totalCalculatedWeight: formData.totalCalculatedWeight || '',
|
totalCalculatedWeight: formData.totalCalculatedWeight || '',
|
||||||
totalWeight: formData.totalWeight || '',
|
totalWeight: formData.totalWeight || '',
|
||||||
productionDate: formattedDate,
|
productionDate: formattedDate,
|
||||||
@@ -486,30 +514,51 @@ const printLabel = async () => {
|
|||||||
</div>
|
</div>
|
||||||
`).join('')
|
`).join('')
|
||||||
|
|
||||||
// 构建打印内容
|
// 构建打印内容,通过 matchMedia 监听打印确认事件(仅在确认打印时保存记录)
|
||||||
const printHTML = `
|
const printHTML = `
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>标签打印</title>
|
<title>标签打印</title>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 10mm; font-family: Arial, sans-serif; }
|
@page { size: 80mm 50mm; margin: 0; }
|
||||||
.label-container { display: flex; flex-wrap: wrap; gap: 10mm; justify-content: center; }
|
body { margin: 0; padding: 1mm; font-family: Arial, sans-serif; }
|
||||||
.label { width: 90mm; height: 38.5mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; }
|
.label-container { display: flex; flex-wrap: wrap; gap: 1mm; justify-content: center; align-items: center; transform-origin: center; }
|
||||||
.label-table { width: 100%; height: 100%; border-collapse: collapse; }
|
.label { width: 75mm; height: 45mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; overflow: hidden; margin: 0 auto; }
|
||||||
.label-cell { border: 1px solid #000; padding: 1mm; vertical-align: top; }
|
.label-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||||
.qr-cell { width: 24mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
.label-cell { border: 1px solid #000; padding: 0.8mm; vertical-align: top; }
|
||||||
|
.qr-cell { width: 22mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
||||||
.label-row { display: flex; align-items: center; }
|
.label-row { display: flex; align-items: center; }
|
||||||
.label-field { font-size: 8pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
.label-field { font-size: 7.5pt; font-weight: bold; margin-right: 1mm; min-width: 22pt; white-space: nowrap; }
|
||||||
.label-value { font-size: 8pt; font-weight: bold; flex: 1; }
|
.label-value { font-size: 7.5pt; font-weight: bold; flex: 1; overflow-wrap: break-word; word-break: break-word; }
|
||||||
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
.qr-code img { width: 22mm; height: 22mm; margin: 0.5mm 0; }
|
||||||
.mark-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; text-align: center; }
|
.mark-number { font-size: 7pt; font-weight: bold; margin-top: 0.5mm; text-align: center; }
|
||||||
.serial-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; }
|
.serial-number { font-size: 7.5pt; font-weight: bold; margin-top: 0.5mm; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="label-container">
|
<div class="label-container">
|
||||||
${labelsHTML}
|
${labelsHTML}
|
||||||
</div>
|
</div>
|
||||||
|
<script>
|
||||||
|
// 标记是否已保存打印记录(避免重复触发)
|
||||||
|
var printRecordSaved = false;
|
||||||
|
// 通过 matchMedia 监听打印状态变化
|
||||||
|
// mediaQuery.matches === true 表示浏览器进入"打印"渲染状态(用户点击了"打印/确认"按钮)
|
||||||
|
// 取消或关闭窗口不会触发此状态切换
|
||||||
|
var mediaQuery = window.matchMedia('print');
|
||||||
|
var handlePrintChange = function(mql) {
|
||||||
|
if (mql.matches && !printRecordSaved) {
|
||||||
|
printRecordSaved = true;
|
||||||
|
// 向父窗口发送消息,通知保存打印记录
|
||||||
|
window.opener && window.opener.postMessage({ type: 'PRINT_CONFIRMED' }, '*');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (mediaQuery.addEventListener) {
|
||||||
|
mediaQuery.addEventListener('change', handlePrintChange);
|
||||||
|
} else if (mediaQuery.addListener) {
|
||||||
|
mediaQuery.addListener(handlePrintChange);
|
||||||
|
}
|
||||||
|
<\/script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`
|
`
|
||||||
@@ -517,6 +566,46 @@ const printLabel = async () => {
|
|||||||
printWindow.document.write(printHTML)
|
printWindow.document.write(printHTML)
|
||||||
printWindow.document.close()
|
printWindow.document.close()
|
||||||
|
|
||||||
|
// 监听子窗口发来的打印确认消息,保存打印记录
|
||||||
|
const onPrintConfirmed = async (event: MessageEvent) => {
|
||||||
|
if (event.data && event.data.type === 'PRINT_CONFIRMED') {
|
||||||
|
try {
|
||||||
|
const printRecords = labelsToPrint.map(item => ({
|
||||||
|
workerOrderId: formData.workerOrderId,
|
||||||
|
materialNamePrint: item.partName,
|
||||||
|
encodingPrint: item.partNumber,
|
||||||
|
totalCount: item.totalCount,
|
||||||
|
totalCalculatedWeight: item.totalCalculatedWeight,
|
||||||
|
totalWeight: item.totalWeight,
|
||||||
|
qrCodeData: item.qrCodeData,
|
||||||
|
batch: formData.batch,
|
||||||
|
mark: item.mark,
|
||||||
|
productionDate: item.productionDate,
|
||||||
|
packingSignature: item.packingSignature == '' ? null : item.packingSignature,
|
||||||
|
inspectionSignature: item.inspectionSignature == '' ? null : item.inspectionSignature,
|
||||||
|
}))
|
||||||
|
await savePrintRecord({
|
||||||
|
workerOrderId: formData.workerOrderId,
|
||||||
|
orderNo: formData.orderNo,
|
||||||
|
encoding: formData.encoding,
|
||||||
|
materialName: formData.materialName,
|
||||||
|
materialNamePrint: formData.materialNamePrint,
|
||||||
|
encodingPrint: formData.encodingPrint,
|
||||||
|
batch: formData.batch,
|
||||||
|
labelType: isDetailLabels ? 0 : 1,
|
||||||
|
labelCount: labelsToPrint.length,
|
||||||
|
printInfoList: printRecords,
|
||||||
|
})
|
||||||
|
Message.success('打印记录已保存')
|
||||||
|
} catch (err) {
|
||||||
|
console.error('保存打印记录失败:', err)
|
||||||
|
Message.error('保存打印记录失败')
|
||||||
|
}
|
||||||
|
window.removeEventListener('message', onPrintConfirmed)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener('message', onPrintConfirmed)
|
||||||
|
|
||||||
// 等待图片加载完成后再打印
|
// 等待图片加载完成后再打印
|
||||||
printWindow.onload = () => {
|
printWindow.onload = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -638,12 +727,13 @@ defineOptions({ name: 'print' })
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-code img {
|
.qr-code img {
|
||||||
width: 100px;
|
width: 115px;
|
||||||
height: 100px;
|
height: 120px;
|
||||||
margin: 5px 0;
|
margin: 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-code .loading {
|
.qr-code .loading {
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ const weighingPageStatus = ref<'idle' | 'entering' | 'entered' | 'error'>('idle'
|
|||||||
|
|
||||||
const [form, resetForm] = useResetReactive({
|
const [form, resetForm] = useResetReactive({
|
||||||
materialCode: '',
|
materialCode: '',
|
||||||
|
encodingPrint: '',
|
||||||
imgUrl: '',
|
imgUrl: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
batch: '',
|
batch: '',
|
||||||
@@ -178,6 +179,7 @@ const originalHandleMaterialCodeChange = async () => {
|
|||||||
form.materialName = ''
|
form.materialName = ''
|
||||||
form.inputMaterialCode2 = ''
|
form.inputMaterialCode2 = ''
|
||||||
form.batch = ''
|
form.batch = ''
|
||||||
|
form.encodingPrint = ''
|
||||||
form.count = undefined
|
form.count = undefined
|
||||||
form.mark = undefined
|
form.mark = undefined
|
||||||
|
|
||||||
@@ -205,6 +207,7 @@ const fetchMaterialData = async (code: string) => {
|
|||||||
if (res.code === '0') {
|
if (res.code === '0') {
|
||||||
// 更新表单数据
|
// 更新表单数据
|
||||||
form.materialCode = res.data?.encoding || ''
|
form.materialCode = res.data?.encoding || ''
|
||||||
|
form.encodingPrint = res.data?.encodingPrint || ''
|
||||||
form.materialName = res.data?.materialName || ''
|
form.materialName = res.data?.materialName || ''
|
||||||
form.batch = res.data?.batch || ''
|
form.batch = res.data?.batch || ''
|
||||||
}
|
}
|
||||||
@@ -213,6 +216,7 @@ const fetchMaterialData = async (code: string) => {
|
|||||||
const handleMaterialCodeChange2 = async (code: string) => {
|
const handleMaterialCodeChange2 = async (code: string) => {
|
||||||
if (!code || code?.trim()=== '') {
|
if (!code || code?.trim()=== '') {
|
||||||
form.materialCode = ''
|
form.materialCode = ''
|
||||||
|
form.encodingPrint = ''
|
||||||
form.materialName = ''
|
form.materialName = ''
|
||||||
form.batch = ''
|
form.batch = ''
|
||||||
form.mark = undefined
|
form.mark = undefined
|
||||||
@@ -227,6 +231,7 @@ const handleMaterialCodeChange2 = async (code: string) => {
|
|||||||
if (res.code === '0') {
|
if (res.code === '0') {
|
||||||
// 更新表单数据
|
// 更新表单数据
|
||||||
form.materialCode = res.data?.encoding || ''
|
form.materialCode = res.data?.encoding || ''
|
||||||
|
form.encodingPrint = res.data?.encodingPrint || ''
|
||||||
form.materialName = res.data?.materialName || ''
|
form.materialName = res.data?.materialName || ''
|
||||||
form.batch = res.data?.batch || ''
|
form.batch = res.data?.batch || ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,18 +218,19 @@ const onPrint = async (record: FullWorkOrderResp) => {
|
|||||||
<head>
|
<head>
|
||||||
<title>标签打印</title>
|
<title>标签打印</title>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 10mm; font-family: Arial, sans-serif; }
|
@page { size: 80mm 50mm; margin: 0; }
|
||||||
.label-container { display: flex; flex-wrap: wrap; gap: 10mm; justify-content: center; }
|
body { margin: 0; padding: 1mm; font-family: Arial, sans-serif; }
|
||||||
.label { width: 90mm; height: 38.5mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; }
|
.label-container { display: flex; flex-wrap: wrap; gap: 1mm; justify-content: center; align-items: center; transform-origin: center; }
|
||||||
.label-table { width: 100%; height: 100%; border-collapse: collapse; }
|
.label { width: 75mm; height: 45mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; overflow: hidden; margin: 0 auto; }
|
||||||
.label-cell { border: 1px solid #000; padding: 1mm; vertical-align: top; }
|
.label-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||||
.qr-cell { width: 24mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
.label-cell { border: 1px solid #000; padding: 0.8mm; vertical-align: top; }
|
||||||
|
.qr-cell { width: 22mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
||||||
.label-row { display: flex; align-items: center; }
|
.label-row { display: flex; align-items: center; }
|
||||||
.label-field { font-size: 8pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
.label-field { font-size: 7.5pt; font-weight: bold; margin-right: 1mm; min-width: 22pt; white-space: nowrap; }
|
||||||
.label-value { font-size: 8pt; font-weight: bold; flex: 1; }
|
.label-value { font-size: 7.5pt; font-weight: bold; flex: 1; overflow-wrap: break-word; word-break: break-word; }
|
||||||
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
.qr-code img { width: 22mm; height: 22mm; margin: 0.5mm 0; }
|
||||||
.mark-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; text-align: center; }
|
.mark-number { font-size: 7pt; font-weight: bold; margin-top: 0.5mm; text-align: center; }
|
||||||
.serial-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; }
|
.serial-number { font-size: 7.5pt; font-weight: bold; margin-top: 0.5mm; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -44,11 +44,6 @@ const loading = ref(false)
|
|||||||
// 登录
|
// 登录
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
console.log("卡号登录handleLogin")
|
console.log("卡号登录handleLogin")
|
||||||
// 检查用户是否已经登录
|
|
||||||
if (userStore.token) {
|
|
||||||
console.log("卡号-用户已登录")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const isInvalid = await formRef.value?.validate()
|
const isInvalid = await formRef.value?.validate()
|
||||||
if (isInvalid) return
|
if (isInvalid) return
|
||||||
@@ -75,6 +70,8 @@ const handleLogin = async () => {
|
|||||||
Message.success('欢迎使用')
|
Message.success('欢迎使用')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 登录失败处理
|
// 登录失败处理
|
||||||
|
console.error('刷卡登录失败:', error)
|
||||||
|
Message.error( '登录失败,请刷新页面')
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,9 +59,6 @@
|
|||||||
:src="record.photoUrl"
|
:src="record.photoUrl"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<!-- <template #lightLevel="{ record }">-->
|
|
||||||
<!-- <GiCellTag :value="record.lightLevel" :dict="light_level" />-->
|
|
||||||
<!-- </template>-->
|
|
||||||
|
|
||||||
<template #action="{ record }">
|
<template #action="{ record }">
|
||||||
<a-space>
|
<a-space>
|
||||||
@@ -100,12 +97,6 @@ import {Message} from "@arco-design/web-vue";
|
|||||||
|
|
||||||
defineOptions({ name: 'MaterialInfo' })
|
defineOptions({ name: 'MaterialInfo' })
|
||||||
|
|
||||||
// const { light_level } = useDict('light_level')
|
|
||||||
|
|
||||||
interface MaterialInfoRespWithStatus extends MaterialInfoResp {
|
|
||||||
photoLoadError?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryForm = reactive<MaterialInfoQuery>({
|
const queryForm = reactive<MaterialInfoQuery>({
|
||||||
materialName: undefined,
|
materialName: undefined,
|
||||||
encoding: undefined,
|
encoding: undefined,
|
||||||
@@ -128,14 +119,14 @@ const {
|
|||||||
const columns = ref<TableInstanceColumns[]>([
|
const columns = ref<TableInstanceColumns[]>([
|
||||||
{ title: '物料名称', dataIndex: 'materialName', slotName: 'materialName' },
|
{ title: '物料名称', dataIndex: 'materialName', slotName: 'materialName' },
|
||||||
{ title: '物料编码', dataIndex: 'encoding', slotName: 'encoding' },
|
{ title: '物料编码', dataIndex: 'encoding', slotName: 'encoding' },
|
||||||
|
{ title: '物料照片', dataIndex: 'photoUrl', slotName: 'photoUrl', width: 120, align: 'center' },
|
||||||
{ title: '物料单位重量(g)', dataIndex: 'unitWeight', slotName: 'unitWeight' },
|
{ title: '物料单位重量(g)', dataIndex: 'unitWeight', slotName: 'unitWeight' },
|
||||||
{ title: '物料品类', dataIndex: 'typeName' },
|
{ title: '物料品类', dataIndex: 'typeName' },
|
||||||
{ title: '批次', dataIndex: 'batch' },
|
{ title: '批次', dataIndex: 'batch' },
|
||||||
{ title: '物料直径', dataIndex: 'materialSpec', slotName: 'materialSpec', show: false },
|
{ title: '物料直径', dataIndex: 'materialSpec', slotName: 'materialSpec', show: false },
|
||||||
{ title: '物料颜色', dataIndex: 'color', slotName: 'color', show: false },
|
{ title: '物料颜色', dataIndex: 'color', slotName: 'color', show: false },
|
||||||
{ title: '物料流程', dataIndex: 'materialProcess', slotName: 'materialProcess' },
|
{ title: '物料流程', dataIndex: 'materialProcess', slotName: 'materialProcess', show: false },
|
||||||
{ title: '灯光等级', dataIndex: 'lightLevel', slotName: 'lightLevel' },
|
{ title: '灯光等级', dataIndex: 'lightLevel', slotName: 'lightLevel', show: false },
|
||||||
{ title: '物料照片', dataIndex: 'photoUrl', slotName: 'photoUrl', width: 120, align: 'center' },
|
|
||||||
{ title: '创建人', dataIndex: 'createUserString', slotName: 'createUser' },
|
{ title: '创建人', dataIndex: 'createUserString', slotName: 'createUser' },
|
||||||
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
{ title: '创建时间', dataIndex: 'createTime', slotName: 'createTime' },
|
||||||
{
|
{
|
||||||
@@ -177,17 +168,6 @@ const onExport = () => {
|
|||||||
useDownload(() => exportMaterialInfo(queryForm))
|
useDownload(() => exportMaterialInfo(queryForm))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 【修改点】图片加载处理逻辑
|
|
||||||
const handleImgLoad = (record: MaterialInfoRespWithStatus) => {
|
|
||||||
record.photoLoadError = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleImgError = (record: MaterialInfoRespWithStatus, e: Event) => {
|
|
||||||
// 标记为加载错误,触发模板渲染 "照片异常"
|
|
||||||
record.photoLoadError = true
|
|
||||||
console.warn(`物料照片加载失败: ${record.photoUrl}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const MaterialInfoAddModalRef = ref<InstanceType<typeof MaterialInfoAddModal>>()
|
const MaterialInfoAddModalRef = ref<InstanceType<typeof MaterialInfoAddModal>>()
|
||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
MaterialInfoAddModalRef.value?.onAdd()
|
MaterialInfoAddModalRef.value?.onAdd()
|
||||||
|
|||||||
@@ -477,18 +477,19 @@ const printLabel = async () => {
|
|||||||
<head>
|
<head>
|
||||||
<title>标签打印</title>
|
<title>标签打印</title>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 10mm; font-family: Arial, sans-serif; }
|
@page { size: 80mm 50mm; margin: 0; }
|
||||||
.label-container { display: flex; flex-wrap: wrap; gap: 10mm; justify-content: center; }
|
body { margin: 0; padding: 1mm; font-family: Arial, sans-serif; }
|
||||||
.label { width: 90mm; height: 38.5mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; }
|
.label-container { display: flex; flex-wrap: wrap; gap: 1mm; justify-content: center; align-items: center; transform-origin: center; }
|
||||||
.label-table { width: 100%; height: 100%; border-collapse: collapse; }
|
.label { width: 75mm; height: 45mm; border: 1px solid #000; padding: 0; box-sizing: border-box; page-break-inside: avoid; overflow: hidden; margin: 0 auto; }
|
||||||
.label-cell { border: 1px solid #000; padding: 1mm; vertical-align: top; }
|
.label-table { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||||
.qr-cell { width: 24mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
.label-cell { border: 1px solid #000; padding: 0.8mm; vertical-align: top; }
|
||||||
|
.qr-cell { width: 22mm; text-align: center; vertical-align: middle; border: 1px solid #000; }
|
||||||
.label-row { display: flex; align-items: center; }
|
.label-row { display: flex; align-items: center; }
|
||||||
.label-field { font-size: 8pt; font-weight: bold; margin-right: 2mm; min-width: 25pt; }
|
.label-field { font-size: 7.5pt; font-weight: bold; margin-right: 1mm; min-width: 22pt; white-space: nowrap; }
|
||||||
.label-value { font-size: 8pt; font-weight: bold; flex: 1; }
|
.label-value { font-size: 7.5pt; font-weight: bold; flex: 1; overflow-wrap: break-word; word-break: break-word; }
|
||||||
.qr-code img { width: 20mm; height: 20mm; margin: 1mm 0; }
|
.qr-code img { width: 22mm; height: 22mm; margin: 0.5mm 0; }
|
||||||
.mark-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; text-align: center; }
|
.mark-number { font-size: 7pt; font-weight: bold; margin-top: 0.5mm; text-align: center; }
|
||||||
.serial-number { font-size: 8pt; font-weight: bold; margin-top: 1mm; }
|
.serial-number { font-size: 7.5pt; font-weight: bold; margin-top: 0.5mm; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -644,12 +645,13 @@ defineOptions({ name: 'LabelPrint' })
|
|||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-code img {
|
.qr-code img {
|
||||||
width: 100px;
|
width: 115px;
|
||||||
height: 100px;
|
height: 120px;
|
||||||
margin: 5px 0;
|
margin: 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading {
|
.loading {
|
||||||
|
|||||||
@@ -169,8 +169,6 @@ const processColumns = (columns: TableInstanceColumns[]): TableInstanceColumns[]
|
|||||||
// 定义列配置,使用工具函数处理
|
// 定义列配置,使用工具函数处理
|
||||||
const columns = ref<TableInstanceColumns[]>(processColumns([
|
const columns = ref<TableInstanceColumns[]>(processColumns([
|
||||||
{ title: '标题', dataIndex: 'title', width: 180 },
|
{ title: '标题', dataIndex: 'title', width: 180 },
|
||||||
{ title: '创建人', dataIndex: 'createUserString' },
|
|
||||||
{ title: '人员卡号', dataIndex: 'cardNo' },
|
|
||||||
{ title: '任务工单号', dataIndex: 'orderNo' },
|
{ title: '任务工单号', dataIndex: 'orderNo' },
|
||||||
{ title: '批次', dataIndex: 'batch' },
|
{ title: '批次', dataIndex: 'batch' },
|
||||||
{ title: '物料图片', dataIndex: 'photoUrl', slotName: 'photoUrl', minWidth: 180, ellipsis: true, tooltip: true },
|
{ title: '物料图片', dataIndex: 'photoUrl', slotName: 'photoUrl', minWidth: 180, ellipsis: true, tooltip: true },
|
||||||
@@ -180,6 +178,8 @@ const columns = ref<TableInstanceColumns[]>(processColumns([
|
|||||||
{ title: '总数量', dataIndex: 'totalCount' },
|
{ title: '总数量', dataIndex: 'totalCount' },
|
||||||
{ title: '标准总重量', dataIndex: 'totalCalculatedWeight' ,slotName: 'totalCalculatedWeight'},
|
{ title: '标准总重量', dataIndex: 'totalCalculatedWeight' ,slotName: 'totalCalculatedWeight'},
|
||||||
{ title: '实际总重量', dataIndex: 'totalWeight' ,slotName: 'totalWeight'},
|
{ title: '实际总重量', dataIndex: 'totalWeight' ,slotName: 'totalWeight'},
|
||||||
|
{ title: '人员卡号', dataIndex: 'cardNo' },
|
||||||
|
{ title: '创建人', dataIndex: 'createUserString' },
|
||||||
{ title: '创建时间', dataIndex: 'createTime', width: 180 },
|
{ title: '创建时间', dataIndex: 'createTime', width: 180 },
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
|
|||||||
Reference in New Issue
Block a user