Merge remote-tracking branch 'origin/master'

master
Yangwl 1 year ago
commit 793034e0c1

@ -82,7 +82,7 @@
<el-table v-loading="loading" :data="bpprocureList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" v-if="false" />
<!-- <el-table-column label="id" align="center" prop="id" v-if="false" />-->
<el-table-column label="采购单号" align="center" prop="procureCode" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
@ -90,8 +90,32 @@
<el-table-column label="计划数量" align="center" prop="planNumber" />
<el-table-column label="已入库数量" align="center" prop="realityNumber" />
<el-table-column label="单位" align="center" prop="unit" />
<el-table-column label="" align="center" prop="price" />
<el-table-column label="价" align="center" prop="price" />
<el-table-column label="计划时间" align="center" prop="attr1" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.attr1, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['wms:bpprocure:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['wms:bpprocure:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
@ -105,9 +129,9 @@
<!-- 添加或修改白坯原材料采购单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="采购单号" prop="procureCode">
<el-input v-model="form.procureCode" placeholder="请输入采购单号" />
</el-form-item>
<!-- <el-form-item label="采购单号" prop="procureCode">-->
<!-- <el-input v-model="form.procureCode" placeholder="请输入采购单号" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料编码" prop="materialCode">-->
<!-- <el-input v-model="form.materialCode" placeholder="请输入物料编码" />-->
<!-- </el-form-item>-->
@ -176,7 +200,7 @@
<script>
import { listBpprocure, getBpprocure, delBpprocure, addBpprocure, updateBpprocure } from "@/api/wms/bpprocure";
import JsBarcode from 'jsbarcode';
export default {
name: "Bpprocure",
dicts: ['bp_raw'],
@ -315,6 +339,7 @@ export default {
}
});
},
handlePrint() {
//
const selectedData = this.bpprocureList.filter(item => this.ids.includes(item.id));
@ -326,7 +351,6 @@ export default {
//
this.printData = {
printDate: new Date().toLocaleString(),
workTable: selectedData.map(item => ({
procureCode: item.procureCode,
materialCode: item.materialCode,
@ -334,59 +358,89 @@ export default {
unit: item.unit,
supplyName: item.supplyName,
planNumber: item.planNumber,
realityNumber: item.realityNumber|| '',
realityNumber: item.realityNumber || '',
}))
};
//
let printContent = `
<div style="text-align: center;">
<h3>采购单</h3>
//
const barcodeCanvas = document.createElement('canvas');
console.log(" this.printData.workTable[0].procureCode: " + this.printData.workTable[0].procureCode);
JsBarcode(barcodeCanvas, this.printData.workTable[0].procureCode, {
format: "CODE128",
height: 35,
width: 1.5,
displayValue: true,
// background: "#FFFFFF", //
// lineColor: "#000000" //
});
// Data URL
const barcodeDataUrl = barcodeCanvas.toDataURL();
console.log(barcodeDataUrl); // Data URL
//
let printContent = `
<html>
<head>
<style>
body { font-family: Arial, sans-serif; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #000; text-align: center; padding: 8px; }
</style>
</head>
<body>
<div style="text-align: center;">
<h3>采购单</h3>
<div style="float: right; margin-top: -50px; width: 200px; height: 100px;">
<img src="${barcodeDataUrl}" alt="条形码" />
</div>
<div style="display: flex; justify-content: space-between; padding: 10px;">
<div>打印日期: ${this.printData.printDate}</div>
</div>
<table border="1" style="width: 100%; border-collapse: collapse;margin: 0 auto;">
<thead>
<tr>
<th style="text-align: center;">采购单</th>
<th style="text-align: center;">物料编码</th>
<th style="text-align: center;">物料描述</th>
<th style="text-align: center;">供应商</th>
<th style="text-align: center;">单位</th>
<th style="text-align: center;">计划数量</th>
<th style="text-align: center;">已入库数量</th>
</tr>
</thead>
<tbody>`;
</div>
<div style="display: flex; justify-content: space-between; padding: 10px;">
<div>打印日期: ${this.printData.printDate}</div>
</div>
<table>
<thead>
<tr>
<th>采购单</th>
<th>物料编码</th>
<th>物料描述</th>
<th>供应商</th>
<th>单位</th>
<th>计划数量</th>
<th>已入库数量</th>
</tr>
</thead>
<tbody>`;
this.printData.workTable.forEach(item => {
printContent += `
<tr>
<td style="text-align: center;">${item.procureCode}</td>
<td style="text-align: center;">${item.materialCode}</td>
<td style="text-align: center;">${item.materialDesc}</td>
<td style="text-align: center;">${item.supplyName}</td>
<td style="text-align: center;">${item.unit}</td>
<td style="text-align: center;">${item.planNumber}</td>
<td style="text-align: center;">${item.realityNumber}</td>
</tr>`;
<tr>
<td>${item.procureCode}</td>
<td>${item.materialCode}</td>
<td>${item.materialDesc}</td>
<td>${item.supplyName}</td>
<td>${item.unit}</td>
<td>${item.planNumber}</td>
<td>${item.realityNumber}</td>
</tr>`;
});
printContent += `
</tbody>
</table>
`;
</tbody>
</table>
</body>
</html>`;
const printWindow = window.open('', '_blank');
printWindow.document.write('<html><head><title>打印</title></head><body>');
printWindow.document.write(printContent);
printWindow.document.write('</body></html>');
printWindow.document.close();
printWindow.print();
printWindow.close();
},
// handleQuery, resetQuery, etc.

Loading…
Cancel
Save