|
|
|
@ -126,7 +126,7 @@ |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 固定载具选择对话框 --> |
|
|
|
<el-dialog title="固定载具清单" :close-on-click-modal="false" v-drag :visible.sync="carrierModelFlag" width="720px"> |
|
|
|
<el-dialog title="固定载具清单" :close-on-click-modal="false" v-drag :visible.sync="carrierModelFlag" width="950px"> |
|
|
|
<div class="rq"> |
|
|
|
<el-form :inline="true" label-position="top" :model="carrierSearchData"> |
|
|
|
<el-form-item label="标签条码"> |
|
|
|
@ -140,10 +140,12 @@ |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" @click="queryFixedCarrierList">查询</el-button> |
|
|
|
<el-button v-if="!editBatchVisible" @click="editBatchModel" type="success" icon="el-icon-edit">批量编辑</el-button> |
|
|
|
<el-button v-if="editBatchVisible" @click="batchSaveCarrier" type="primary" icon="el-icon-check" :loading="saveLoading">批量保存</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table |
|
|
|
:height="300" |
|
|
|
:height="400" |
|
|
|
:data="carrierList" |
|
|
|
@row-dblclick="selectCarrier" |
|
|
|
border |
|
|
|
@ -153,7 +155,7 @@ |
|
|
|
label="标签条码" |
|
|
|
header-align="center" |
|
|
|
align="left" |
|
|
|
min-width="100"> |
|
|
|
min-width="120"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
prop="carrierTypeName" |
|
|
|
@ -176,6 +178,39 @@ |
|
|
|
align="left" |
|
|
|
min-width="100"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="可用数量" |
|
|
|
header-align="center" |
|
|
|
align="right" |
|
|
|
min-width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number |
|
|
|
v-if="editBatchVisible" |
|
|
|
v-model="scope.row.availableQty" |
|
|
|
:controls="false" |
|
|
|
:min="0" |
|
|
|
:precision="0" |
|
|
|
style="width: 100%"> |
|
|
|
</el-input-number> |
|
|
|
<span v-else>{{ scope.row.availableQty || 0 }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="操作" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="80" |
|
|
|
fixed="right"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
icon="el-icon-printer" |
|
|
|
@click="printCarrier(scope.row)" |
|
|
|
style="color: #409eff;"> |
|
|
|
打印 |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<el-footer style="height:40px;margin-top: 20px;text-align:center"> |
|
|
|
@ -278,6 +313,8 @@ export default { |
|
|
|
carrierTypeName: '', |
|
|
|
specification: '' |
|
|
|
}, |
|
|
|
editBatchVisible: false, // 批量编辑状态 |
|
|
|
saveLoading: false, // 保存loading状态 |
|
|
|
buttons: { |
|
|
|
confirmButton: '确定', |
|
|
|
closeButton: '关闭', |
|
|
|
@ -615,6 +652,137 @@ export default { |
|
|
|
this.carrierModelFlag = false |
|
|
|
}, |
|
|
|
|
|
|
|
// 批量编辑模态框 |
|
|
|
editBatchModel() { |
|
|
|
if (this.editBatchVisible) { |
|
|
|
this.editBatchVisible = false |
|
|
|
} else { |
|
|
|
this.editBatchVisible = true |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 批量保存固定载具可用数量 |
|
|
|
batchSaveCarrier() { |
|
|
|
this.saveLoading = true |
|
|
|
// 调用API保存 |
|
|
|
import('@/api/yieldReport/com_separate_roll.js').then(module => { |
|
|
|
const { updateFixedCarrierBatch } = module |
|
|
|
updateFixedCarrierBatch(this.carrierList).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('批量保存成功') |
|
|
|
this.editBatchVisible = false |
|
|
|
this.queryFixedCarrierList() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '批量保存失败') |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
this.$message.error('批量保存失败: ' + error.message) |
|
|
|
}).finally(() => { |
|
|
|
this.saveLoading = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 打印固定载具 |
|
|
|
printCarrier(row) { |
|
|
|
// 构造打印数据 |
|
|
|
const printData = { |
|
|
|
carrierNo: row.carrierNo, |
|
|
|
carrierTypeName: row.carrierTypeName, |
|
|
|
specification: row.specification, |
|
|
|
dimensions: row.dimensions, |
|
|
|
availableQty: row.availableQty || 0, |
|
|
|
site: this.scheduleData.site |
|
|
|
} |
|
|
|
|
|
|
|
// 调用打印功能 |
|
|
|
this.printCarrierLabel(printData) |
|
|
|
}, |
|
|
|
|
|
|
|
// 打印载具标签 |
|
|
|
printCarrierLabel(data) { |
|
|
|
try { |
|
|
|
// 生成二维码(使用 QRCode.js 或者使用在线二维码API) |
|
|
|
const qrCodeUrl = `https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${encodeURIComponent(data.carrierNo)}` |
|
|
|
|
|
|
|
// 打印HTML模板 |
|
|
|
const printContent = ` |
|
|
|
<div style="width: 100mm; font-family: Arial, sans-serif; padding: 10px; position: relative;"> |
|
|
|
<!-- 左上角二维码 --> |
|
|
|
<div style="position: absolute; top: 10px; left: 10px;"> |
|
|
|
<img src="${qrCodeUrl}" style="width: 80px; height: 80px; border: 1px solid #ddd;" alt="QR Code"/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 标题 --> |
|
|
|
<div style="text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 15px; padding-top: 5px;"> |
|
|
|
固定载具标签 |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 信息表格 --> |
|
|
|
<table style="width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px;"> |
|
|
|
<tr> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-weight: bold; width: 35%; background-color: #f5f5f5;">标签条码:</td> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-size: 15px; font-weight: bold;">${data.carrierNo || ''}</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-weight: bold; background-color: #f5f5f5;">载具类型:</td> |
|
|
|
<td style="padding: 8px; border: 1px solid #333;">${data.carrierTypeName || ''}</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-weight: bold; background-color: #f5f5f5;">规格描述:</td> |
|
|
|
<td style="padding: 8px; border: 1px solid #333;">${data.specification || ''}</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-weight: bold; background-color: #f5f5f5;">尺寸:</td> |
|
|
|
<td style="padding: 8px; border: 1px solid #333;">${data.dimensions || ''}</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-weight: bold; background-color: #f5f5f5;">可用数量:</td> |
|
|
|
<td style="padding: 8px; border: 1px solid #333; font-size: 18px; font-weight: bold; color: #e74c3c;">${data.availableQty}</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
|
<!-- 打印时间 --> |
|
|
|
<div style="text-align: center; margin-top: 15px; font-size: 11px; color: #999; border-top: 1px dashed #ccc; padding-top: 10px;"> |
|
|
|
打印时间: ${this.dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
` |
|
|
|
|
|
|
|
// 创建打印窗口 |
|
|
|
const printWindow = window.open('', '_blank') |
|
|
|
printWindow.document.write(` |
|
|
|
<html> |
|
|
|
<head> |
|
|
|
<title>打印固定载具标签</title> |
|
|
|
<meta charset="UTF-8"> |
|
|
|
<style> |
|
|
|
@page { size: auto; margin: 5mm; } |
|
|
|
body { margin: 0; padding: 0; } |
|
|
|
@media print { |
|
|
|
body { -webkit-print-color-adjust: exact; print-color-adjust: exact; } |
|
|
|
} |
|
|
|
</style> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
${printContent} |
|
|
|
</body> |
|
|
|
</html> |
|
|
|
`) |
|
|
|
printWindow.document.close() |
|
|
|
|
|
|
|
// 延迟打印,确保二维码图片加载完成 |
|
|
|
setTimeout(() => { |
|
|
|
printWindow.print() |
|
|
|
printWindow.close() |
|
|
|
}, 500) |
|
|
|
|
|
|
|
this.$message.success('正在打印载具标签...') |
|
|
|
} catch (error) { |
|
|
|
this.$message.error('打印失败: ' + error.message) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/*关闭modal*/ |
|
|
|
closeDialog(){ |
|
|
|
//刷新报工的页面 |
|
|
|
|