From 073b17307feef4f9a3a269459446e6b25324e039 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期五, 17 五月 2024 16:26:34 +0800 Subject: [PATCH] - --- jcdm-ui/src/views/main/om/productionOrde/index.vue | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 3 deletions(-) diff --git a/jcdm-ui/src/views/main/om/productionOrde/index.vue b/jcdm-ui/src/views/main/om/productionOrde/index.vue index ade8ab0..ddb4020 100644 --- a/jcdm-ui/src/views/main/om/productionOrde/index.vue +++ b/jcdm-ui/src/views/main/om/productionOrde/index.vue @@ -28,6 +28,14 @@ /> </el-select> </el-form-item> + <div style="display: none"> + <div id="printMe" style="width: 500px;"> + <div ref="canvasWrapper" id="canvasWrapper" style="display: flex;justify-content: center;"></div> + <p style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;">{{packCode}}</p> + </div> + <el-button @click="print">鎵撳嵃</el-button> + <el-button @click="test1">鐢熸垚浜岀淮鐮�</el-button> + </div> <el-form-item style="float: right"> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">楂樼骇鏌ヨ</el-button> @@ -283,6 +291,7 @@ updateProductionOrde, receivingWorkOrders } from "@/api/main/om/productionOrde/productionOrde"; +import QRCode from "qrcodejs2"; export default { name: "ProductionOrde", @@ -292,6 +301,8 @@ }, data() { return { + // packCode: '0RSPB001139E3AE4X0000011', + packCode: 'test111', titleName: '', options: [], lineOptions: [], @@ -383,12 +394,52 @@ this.getList(); this.initWorkshop(); }, + mounted() { + this.test1() + }, methods: { - getWorkOrders(){ - receivingWorkOrders().then(response => { - this.$modal.msgSuccess(response.msg); + async getWorkOrders(){ + await receivingWorkOrders().then(response => { this.getList() + this.packCode = response.msg; + this.test1() }); + setTimeout(() => { + this.print() + },50) + }, + print() { + // 鏈〉闈㈢洿鎺ユ墦鍗帮紙鏈塨ug鍗曞瞾鍏堜笉瑕佸垹锛� + // let oldStr = window.document.body.innerHTML; + // let newStr = document.getElementById('printMe').innerHTML; + // document.body.innerHTML = newStr; + // window.print(); + // document.body.innerHTML = oldStr; + // return false; + + // 鏂板紑椤甸潰鎵撳嵃 + // document.getElementById('canvasWrapper').innerHTML = ''; + let newStr = document.getElementById('printMe').innerHTML; + let newWin = window.open('', '_blank'); + newWin.document.body.innerHTML = newStr; + newWin.print(); + return false; + }, + test1(){ + document.getElementById('canvasWrapper').innerHTML = '' + this.$nextTick(() => { + let qrCode = new QRCode('canvasWrapper',{ + width: 80, + height: 80, + padding: 0, + margin: 0, + text: this.packCode, + colorDark: '#000', + colorLight: '#fff' + }) + }) + // console.log(this.packCode) + // this.print() }, /** 瀵煎叆鎸夐挳鎿嶄綔 */ handleImport() { -- Gitblit v1.9.3