Merge remote-tracking branch 'origin/master'

yangwl
mengjiao 3 months ago
commit 0aaf20ff7a

@ -188,3 +188,10 @@ export function getIdCardList(data){
data:data
})
}
export function getBatchCode(workorderId){
return request({
url:'/plan/pro/workorder/getBatchCode/'+ workorderId,
method: 'get'
})
}

@ -1987,7 +1987,6 @@ export default {
/**打印标识卡弹出框**/
printIdCard() {
//var statusesArray = this.statuses;
//for (var i = 0; i < statusesArray.length; i++) {
// if (statusesArray[i] == 'w0') {//
@ -1996,7 +1995,7 @@ export default {
// }
//}
this.$refs.printID.init(this.selectWork.workorderCode);
this.$refs.printID.init(this.selectWork.workorderCode,this.selectWork.workorderId);
this.$refs.printID.printDialogVisible = true;
},
//

@ -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-form>
<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>

Loading…
Cancel
Save