diff --git a/src/api/yieldReport/com_separate_roll.js b/src/api/yieldReport/com_separate_roll.js index 960d2a7..c8bba18 100644 --- a/src/api/yieldReport/com_separate_roll.js +++ b/src/api/yieldReport/com_separate_roll.js @@ -20,3 +20,6 @@ export const workbenchCreateslittingrollRepackAction = data => createAPI('schedu // 获取固定载具列表 export const getFixedCarrierList = data => createAPI('schedule/getFixedCarrierList', 'POST', data) +// 批量更新固定载具可用数量 +export const updateFixedCarrierBatch = data => createAPI('schedule/updateFixedCarrierBatch', 'POST', data) + diff --git a/src/views/modules/yieldReport/com_separate_roll.vue b/src/views/modules/yieldReport/com_separate_roll.vue index 0bada69..1389766 100644 --- a/src/views/modules/yieldReport/com_separate_roll.vue +++ b/src/views/modules/yieldReport/com_separate_roll.vue @@ -126,7 +126,7 @@ - +
@@ -140,10 +140,12 @@ 查询 + 批量编辑 + 批量保存 + min-width="120"> + + + + + +
@@ -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 = ` +
+ +
+ QR Code +
+ + +
+ 固定载具标签 +
+ + + + + + + + + + + + + + + + + + + + + + + +
标签条码:${data.carrierNo || ''}
载具类型:${data.carrierTypeName || ''}
规格描述:${data.specification || ''}
尺寸:${data.dimensions || ''}
可用数量:${data.availableQty}
+ + +
+ 打印时间: ${this.dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')} +
+
+ ` + + // 创建打印窗口 + const printWindow = window.open('', '_blank') + printWindow.document.write(` + + + 打印固定载具标签 + + + + + ${printContent} + + + `) + printWindow.document.close() + + // 延迟打印,确保二维码图片加载完成 + setTimeout(() => { + printWindow.print() + printWindow.close() + }, 500) + + this.$message.success('正在打印载具标签...') + } catch (error) { + this.$message.error('打印失败: ' + error.message) + } + }, + /*关闭modal*/ closeDialog(){ //刷新报工的页面