|
|
|
@ -2,14 +2,38 @@
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-dialog title="" :visible.sync="printDialogVisible" width="1000px">
|
|
|
|
|
<div>
|
|
|
|
|
<el-form inline>
|
|
|
|
|
<el-form-item label="补打版次" prop="factory">
|
|
|
|
|
<el-input v-model="idCardsNum" placeholder="请输入补打版次" style="width:100px"/>
|
|
|
|
|
<el-form inline label-width="80px">
|
|
|
|
|
<el-form-item label="补打板次" prop="factory">
|
|
|
|
|
<el-input v-model="idCardsNum" placeholder="请输入" style="width:100px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-check" circle @click="showPrint()"/>
|
|
|
|
|
<el-button type="primary" icon="el-icon-check" circle @click="showSupplementPrint()"/>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="增打批次" prop="batchCode">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="batchCode"
|
|
|
|
|
placeholder="请选择批次"
|
|
|
|
|
@change="$forceUpdate()"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in batchCodeOption"
|
|
|
|
|
:key="item.batchCode"
|
|
|
|
|
:label="item.batchCode"
|
|
|
|
|
:value="item.batchCode"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="增打板次" prop="idCardsNumAdd">
|
|
|
|
|
<el-input v-model="idCardsNumAdd" placeholder="请输入" style="width:100px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="增打数量" prop="batchQuantity">
|
|
|
|
|
<el-input v-model="batchQuantity" placeholder="请输入" style="width:100px"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-button type="primary" icon="el-icon-check" circle @click="showAddPrint()"/>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="printFrom" class="my-print-box">
|
|
|
|
|
<div v-for="(item, index) in printData.idCardList" :key="index">
|
|
|
|
|
<el-form class="print-card">
|
|
|
|
@ -26,19 +50,25 @@
|
|
|
|
|
<div class="custom-divider"></div>
|
|
|
|
|
|
|
|
|
|
<el-row class="my-print-foot">
|
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
|
<div class="card-div1">产品名称: {{ item.productName }}</div><br />
|
|
|
|
|
<div class="card-div1">批次号: {{ item.batchCode }}</div><br />
|
|
|
|
|
<el-col :offset="1" :span="13">
|
|
|
|
|
<div class="card-div2">产品名称: {{ item.productName }}</div><br />
|
|
|
|
|
<div class="card-div2">批次号: {{ item.batchCode }}</div><br />
|
|
|
|
|
<div class="card-div2">生产日期: {{ item.productDateStr }}</div><br />
|
|
|
|
|
<div class="card-div2">板次: {{ item.palletNo }}</div><br />
|
|
|
|
|
<div class="card-div2">数量: {{ item.batchQuantity }}</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :offset="1" :span="10">
|
|
|
|
|
<el-col :offset="1" :span="9">
|
|
|
|
|
<canvas :id="'qrcode-' + index" class="qrcode"></canvas>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div style="clear: both; margin-bottom: 30px;"></div>
|
|
|
|
|
<div style="margin-top: 10px;">
|
|
|
|
|
<table align="center" border="1" cellpadding="0" cellspacing="0" width="820">
|
|
|
|
|
<tr class="tr-row"><td class="tr-row-1"></td><td class="tr-row-2"></td></tr>
|
|
|
|
|
<tr class="tr-row"><td class="tr-row-1"></td><td class="tr-row-2"></td></tr>
|
|
|
|
|
<tr class="tr-row"><td class="tr-row-1"></td><td class="tr-row-2"></td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="(index + 1) % 1 === 0" class="print-page"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -53,6 +83,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
getIdCardList,
|
|
|
|
|
getBatchCode,
|
|
|
|
|
} from '@/api/plan/workorder';
|
|
|
|
|
import QRCode from 'qrcode';
|
|
|
|
|
|
|
|
|
@ -62,7 +93,10 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
idCardsNum: null,
|
|
|
|
|
idCardsNum: null,//板次
|
|
|
|
|
idCardsNumAdd: null,//增打板次
|
|
|
|
|
batchCode: null,//批次
|
|
|
|
|
batchQuantity: null,//数量
|
|
|
|
|
optType: undefined,
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
@ -88,6 +122,8 @@ export default {
|
|
|
|
|
//gridStyle:'border: 1px solid lightgray; margin-bottom: -1px;'
|
|
|
|
|
},
|
|
|
|
|
workorderCode: '',
|
|
|
|
|
workorderId: '',
|
|
|
|
|
batchCodeOption: [],
|
|
|
|
|
//工单重新渲染表格
|
|
|
|
|
refreshWorkerTable: true,
|
|
|
|
|
// 表单校验
|
|
|
|
@ -104,11 +140,24 @@ export default {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
init(workorderCode){
|
|
|
|
|
init(workorderCode,workorderId){
|
|
|
|
|
this.workorderCode = workorderCode;
|
|
|
|
|
this.showPrint();
|
|
|
|
|
this.workorderId = workorderId;
|
|
|
|
|
this.idCardsNum = null;
|
|
|
|
|
this.idCardsNumAdd = null;
|
|
|
|
|
this.batchCode = null;
|
|
|
|
|
this.batchQuantity = null;
|
|
|
|
|
this.initBatchCodeselection(this.workorderId);
|
|
|
|
|
this.showSupplementPrint();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//初始化批次号选择框
|
|
|
|
|
initBatchCodeselection(workorderId){
|
|
|
|
|
getBatchCode(workorderId).then((response) => {
|
|
|
|
|
this.batchCodeOption = response;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 打印预览-浏览器打印
|
|
|
|
|
handlePrint(params) {
|
|
|
|
|
printJS({
|
|
|
|
@ -124,26 +173,62 @@ export default {
|
|
|
|
|
`,
|
|
|
|
|
ignoreElements: params.ignore || [],
|
|
|
|
|
});
|
|
|
|
|
//打印完成后 版次变为空
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 打印预览-点击打印预览按钮
|
|
|
|
|
async showPrint() {
|
|
|
|
|
console.log('执行了打印预览');
|
|
|
|
|
let params = {
|
|
|
|
|
};
|
|
|
|
|
// 打印预览-点击打印预览按钮-补打
|
|
|
|
|
async showSupplementPrint() {
|
|
|
|
|
console.log('执行了补充打印预览');
|
|
|
|
|
let params = {};
|
|
|
|
|
params.addFlag = '0'; //增打标志
|
|
|
|
|
if(this.idCardsNum!=null){
|
|
|
|
|
params.palletNo=this.idCardsNum;
|
|
|
|
|
params.palletNo = this.idCardsNum;
|
|
|
|
|
}
|
|
|
|
|
let response = await getIdCardList({workorderCode:this.workorderCode,...params});
|
|
|
|
|
this.printData.idCardList = response;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.printData.idCardList.forEach((item, index) => {
|
|
|
|
|
const canvas = document.getElementById('qrcode-' + index);
|
|
|
|
|
QRCode.toCanvas(canvas, item.palletCode, { width: 350,margin:1 }, function (error) {
|
|
|
|
|
QRCode.toCanvas(canvas, item.palletCode, { width: 300 , margin:1 }, function (error) {
|
|
|
|
|
if (error) console.error(error);
|
|
|
|
|
console.log('success!');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 打印预览-增打
|
|
|
|
|
async showAddPrint() {
|
|
|
|
|
console.log('执行了新增打印预览');
|
|
|
|
|
let params = {};
|
|
|
|
|
if(this.idCardsNumAdd == null || this.batchCode == null || this.batchQuantity == null
|
|
|
|
|
||this.idCardsNumAdd == '' || this.batchCode == '' || this.batchQuantity == ''
|
|
|
|
|
){
|
|
|
|
|
this.$modal.msg("您填入的增打信息存在空值!");
|
|
|
|
|
return;
|
|
|
|
|
}else{
|
|
|
|
|
//产品名称 后台返回
|
|
|
|
|
//生产日期 后台返回
|
|
|
|
|
params.batchCode = this.batchCode;//批次号 需要选择
|
|
|
|
|
params.palletNo = this.idCardsNumAdd;//板次
|
|
|
|
|
params.batchQuantity = this.batchQuantity;//数量
|
|
|
|
|
params.addFlag = '1';//增打标志
|
|
|
|
|
}
|
|
|
|
|
let response = await getIdCardList({workorderCode:this.workorderCode,...params});
|
|
|
|
|
this.printData.idCardList = response;
|
|
|
|
|
if(this.printData.idCardList.length == 0){
|
|
|
|
|
this.$modal.msg("该板次已被正常打印,请填入正确板次!");
|
|
|
|
|
}else{
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.printData.idCardList.forEach((item, index) => {
|
|
|
|
|
const canvas = document.getElementById('qrcode-' + index);
|
|
|
|
|
QRCode.toCanvas(canvas, item.palletCode, { width: 300 , margin:1 }, function (error) {
|
|
|
|
|
if (error) console.error(error);
|
|
|
|
|
console.log('success!');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
@ -156,7 +241,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
.center-text {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 63px;
|
|
|
|
|
font-size: 50px;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
color: black;
|
|
|
|
|
}
|
|
|
|
@ -213,8 +298,18 @@ export default {
|
|
|
|
|
padding-top: 14px;
|
|
|
|
|
}
|
|
|
|
|
.card-div2{
|
|
|
|
|
font-size: 22px;
|
|
|
|
|
font-size: 25px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
padding-top: 14px;
|
|
|
|
|
padding-top: 2px;
|
|
|
|
|
margin-left: 35px;
|
|
|
|
|
}
|
|
|
|
|
.tr-row {
|
|
|
|
|
height: 35px;
|
|
|
|
|
}
|
|
|
|
|
.tr-row-1 {
|
|
|
|
|
width: 246px;
|
|
|
|
|
}
|
|
|
|
|
.tr-row-2 {
|
|
|
|
|
width: 574px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|