标识卡打印

yangwl
zhaoxiaolin 4 months ago
parent fa17d4fc12
commit c8901fba0d

@ -180,4 +180,14 @@ export function getProdLineList() {
method: 'get',
params: {}
});
}
}
export function getIdCardList(workorderCode){
const data={
workorderCode
}
return request({
url:'/plan/pro/workorder/getIdCardList',
method:'post',
data:data
})
}

@ -313,14 +313,14 @@ export default {
setInterval(() => this.getAlarmData(), 1000 * 60);
this.poolNameList = JSON.parse(localStorage.getItem("POOL_NAME_LIST"));
this.poolName = localStorage.getItem("USER_POOL_NAME_CURRENT");
/**
//
this.getUnReadList();
//
this.timer = setInterval(() => {
setTimeout(this.getUnReadList(), 30000);
}, 30000);
**/
},
components: {
Breadcrumb,

@ -187,6 +187,18 @@
>批次编辑
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-printer"
size="mini"
:disabled="single"
@click="printIdCard"
v-hasPermi="['mes:pro:workorder:edit']"
>打印标识卡
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -719,6 +731,8 @@
<el-button @click="batchCancel"> </el-button>
</div>
</el-dialog>
<!--标识卡打印-->
<ItemPrintID ref="printID" @onSelected="printIdFunc"/>
</div>
</template>
@ -740,12 +754,16 @@ import {
getProdLineList
} from '@/api/plan/workorder'
import moment from 'moment';
import ItemPrintID from './printID.vue';
import { getProEquipment, getProRoutes, getProShifts,selectMaterielList} from '@/api/plan/order'
import {prototype} from "clipboard";
export default {
name: "Workorder",
dicts: ['product_type', 'workorder_type'],
components: {
ItemPrintID
},
data() {
return {
//
@ -1967,15 +1985,16 @@ export default {
}, 222);
},
// @expand-change="getOpenNextLevel"
//
//getOpenNextLevel(row, column, event) {
// alert("1755getOpenNextLevel")
// getNextLevelWorkOrderList(tree.workorderCode).then((data) => {
// return resolve(data);
// });
//}
/**打印标识卡弹出框**/
printIdCard() {
this.$refs.printID.printDialogVisible = true;
this.$refs.printID.init("20021221552");
},
//
printIdFunc(obj) {
this.form.userName = obj.code;
this.form.nickName = obj.name;
},
}
};
</script>

@ -0,0 +1,181 @@
<template>
<div class="app-container">
<!-- 打印预览弹出层 -->
<el-dialog title="" :visible.sync="printDialogVisible" width="990px">
<div>
<el-input v-model="idCardsNum" placeholder="请输入板次数量" style="width:100px"/>
<el-button type="primary" icon="el-icon-check" circle @click="showPrint()"/>
</div>
<div id="printFrom" class="my-print-box">
<div v-for="(item, index) in printData.idCardList" :key="index">
<el-form>
<!-- 表头-工单信息 -->
<el-row>
<el-col :span="7">
<img src="@/assets/logo/lanjv.png" class="report-logo" />
</el-col>
<el-col :span="10" class="center-text">
<span>产品标识卡</span>
</el-col>
</el-row>
<el-row class="my-print-head">
<el-col><el-divider/></el-col>
</el-row>
<el-row class="my-print-foot">
<el-col :offset="1" :span="10">
<div>产品名称:{{ printData.factory }}</div><br/>
<div>批次号:{{ printData.factory }}</div><br/>
<div>生产日期:{{ printData.factory }}</div><br/>
<div>板次:{{ printData.factory }}</div><br/>
<div>数量:{{ printData.factory }}</div>
</el-col>
<el-col :offset="1" :span="10">
<canvas ref="qrCanvas"></canvas>
</el-col>
</el-row>
</el-form>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handlePrint(printData)"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
getIdCardList,
} from '@/api/plan/workorder';
import QRCode from 'qrcode';
export default {
name: "printID",
components: {
},
data() {
return {
idCardsNum: 1,
optType: undefined,
//
loading: true,
//
ids: [],
selectRow: {},
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
printDialogVisible: false,
//
printData: {
printable: "printFrom",
ignore: ["no-print"],
workCenter: "暂无数据",
factory: null,
idCardList: []
},
workorderCode: '',
//
refreshWorkerTable: true,
//
rules: {
},
tableIndex: "tableIndex",
};
},
created() {
},
methods: {
init(workorderCode){
this.workorderCode = workorderCode;
},
// -
handlePrint(params) {
printJS({
printable: params.printable, // 'printFrom', // id
type: params.type || "html",
maxWidth: 1500, //
font_size: "", //
header: params.header, // '',
targetStyles: ["*"],
style: "@page {margin:0 10mm};", // -
ignoreElements: params.ignore || [], // ['no-print']
properties: params.properties || null,
});
},
// -
showPrint() {
//
//this.printData.workCenter = "";
getIdCardList(this.workorderCode,this.idCardNum).then((response) => {
debugger
//this.reset();
this.printData.idCardList = response.idCards;
// 使 Vue nextTick DOM
this.$nextTick(() => {
//for(var i=0;0<response.idCards.length;i++){
let qrCanvasIndex = "qrCanvas"+0;
const canvas = this.$refs.qrCanvas;
const options = {
width: 350, //
height: 350 //
};
QRCode.toCanvas(canvas,response.idCards[0], options, error => {
if (error) console.error(error);
});
//}
});
});
}
},
};
</script>
<style scoped>
.print-btn {
margin-bottom: 15px;
margin-left: 10px;
}
.center-text {
text-align: left;
font-size: 63px;
font-weight: 800;
}
.report-logo {
margin-top: 15px;
margin-left: 15px;
height: 70px;
}
.button-container {
text-align: right;
margin-top: 10px;
margin-right: 10px;
}
.my-print-table {
font-size: 20px;
}
.my-print-foot {
font-size: 17px;
}
.my-print-foot2 {
font-size: 19px;
}
.my-print-box{
width:100%
}
</style>
Loading…
Cancel
Save