From 22260b8e7349fe03402529d4918739b276113340 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期五, 27 九月 2024 15:17:34 +0800 Subject: [PATCH] 下线打印报告优化 --- jcdm-ui/src/views/main/cfkb/Instructions/index.vue | 353 ++++++-------------------------------------------- jcdm-ui/src/views/components/offlineQualificationReport.vue | 29 +++- 2 files changed, 64 insertions(+), 318 deletions(-) diff --git a/jcdm-ui/src/views/components/offlineQualificationReport.vue b/jcdm-ui/src/views/components/offlineQualificationReport.vue index ea09fb0..7f969d6 100644 --- a/jcdm-ui/src/views/components/offlineQualificationReport.vue +++ b/jcdm-ui/src/views/components/offlineQualificationReport.vue @@ -1,15 +1,16 @@ <template> - <table class="yk-table" border="1px" cellspacing="0" align="center" width="900px" style="font-size: 11px;font-family: SimSun;word-wrap:break-word;word-break:break-all"> + <table class="yk-table" border="1px" cellspacing="0" align="center" width="900px" style="font-size: 11px;font-family: SimSun;word-wrap:break-word;word-break:break-all;border-collapse: collapse;border-color: #000"> <tr> - <td colspan="11"> - <img style="width: 140px;height: 20px;" :src="require('@/assets/images/a8963a24920640508e96150a053fc41.png')"> - <span style="text-decoration: underline;margin-left: 23%;font-size: 15px">婀栧窞鏅鸿姱鍔ㄥ姏绯荤粺鍙戝睍鏈夐檺鍏徃</span> - <div style="border-bottom: #181818 1px solid;"></div> + <td colspan="11" style="padding-top: 6px;"> + <img style="width: 140px;height: 20px;margin-left: 15px;" :src="require('@/assets/images/a8963a24920640508e96150a053fc41.png')"> + <span style="text-decoration: underline;margin-left: 23%;font-size: 15px;">婀栧窞鏅鸿姱鍔ㄥ姏绯荤粺鍙戝睍鏈夐檺鍏徃</span> + <div style="border-bottom: 1px solid #181818;margin: 5px 10px 2px 6px;"></div> + <div style="border-bottom: 1px solid #181818;margin: 0 10px 2px 6px;"></div> </td> </tr> <tr align="center"> - <td colspan="11"> - <span style="font-size: 15px">鍑鸿揣妫�鏌ユ姤鍛�</span> + <td colspan="11" style="padding: 2px 0;"> + <span style="font-size: 15px;font-weight: bold;">鍑鸿揣妫�鏌ユ姤鍛�</span> </td> </tr> <tr> @@ -582,7 +583,19 @@ <script> export default { - name: "offlineQualificationReport" + name: "offlineQualificationReport", + props: ['printParam'], + data() { + return { + printData: this.printParam + } + }, + created() { + console.log(this.printData) + }, + methods: { + } + } </script> diff --git a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue index bfb7891..7a7ae90 100644 --- a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue +++ b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue @@ -13,283 +13,33 @@ </el-col> <el-col :span="10"> <el-card shadow="never"> - <span class="head-font">浜у搧搴忓垪鍙� : {{headContent.sfcCode}}</span> -<!-- <el-button @click="print1">鎵撳嵃</el-button>--> - <el-button id="print" v-print="'#printMe'" type="primary">鎵撳嵃</el-button> - - - <el-button type="primary" style="float: right" icon="el-icon-search" size="mini" @click="serialLink">涓插彛杩炴帴</el-button> - <el-button @click="clearClick" style="float: right" type="danger" size="mini">娓呴櫎</el-button> + <span class="head-font">浜у搧搴忓垪鍙� :</span> + <el-input style="width: 50%;" v-model="headContent.sfcCode" placeholder="璇疯緭鍏ュ唴瀹�"></el-input> +<!-- <el-button type="primary" id="print" v-print="'#printMe'">鎵撳嵃</el-button>--> + <el-button type="primary" id="print" v-print="'#printMe'">鎵撳嵃</el-button> +<!-- <el-button id="print" @click="print1" type="primary">鎵撳嵃</el-button>--> + <el-button type="primary" style="margin-left: -70px;opacity: 0;" @click="printBefore">鎵撳嵃</el-button> + <el-button @click="clearClick" type="danger">娓呴櫎</el-button> </el-card> </el-col> </el-row> <el-row :gutter="5" style="margin-top: 5px"> - <el-col :span="12"> + <el-col :span="24"> <el-tabs type="border-card" style="height: 600px" v-model="activeName" @tab-click="changeMenu"> <el-tab-pane name="first"> <span slot="label"> <a class="el-icon-date"></a>棣栭〉</span> <el-col :span="24"> <div> -<!-- <div id="printMe">--> -<!-- <div style="font-size: 29px;text-align: center;margin-top: 64px">--> -<!-- <span>鐢甸┍绯荤粺鎬绘垚</span>--> -<!-- </div>--> -<!-- <div style="display: flex;margin-top: 2px;margin-left: 37px;font-size: 15px">--> -<!-- <div class="div1">--> -<!-- <div >--> -<!-- <span>鐢垫満鍨嬪彿锛�</span><span>TZ180XSDSZX01</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>棰濆畾鍔熺巼锛�</span><span>30KW</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>棰濆畾鎵煩锛�</span><span>70N.m</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>棰濆畾鐢靛帇锛�</span><span>336VDS</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>棰濆伐浣滃埗锛�</span><span>S9</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>鎸佺画宸ヤ綔鐢垫祦锛�</span><span>115A</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>鐩告暟锛�</span><span>3</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>闆朵欢鍙凤細</span><span>9900200461</span><br>--> -<!-- </div>--> -<!-- </div>--> - -<!-- <div class="div2" style="font-size: 15px;margin-left: 17px">--> -<!-- <div>--> -<!-- <span>鎺у埗鍣ㄥ瀷鍙凤細</span><span>KTZ34X23SZX07</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>宄板�煎姛鐜囷細</span><span>60KW</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>宄板�艰浆鐭╋細</span><span>175N.m</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>鏈�楂樿浆閫燂細</span><span>12000rpm</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>闃叉姢绛夌骇锛�</span><span>IP68</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>宄板�煎伐浣滅數娴侊細</span><span>230A</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>缁濈紭绛夌骇锛�</span><span>H</span><br>--> -<!-- </div>--> -<!-- <div style="margin-top: 4px">--> -<!-- <span>鍑哄巶缂栧彿锛�</span><span>2407190000002</span><br>--> -<!-- </div>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div style="font-size: 29px;margin-top: 2px;margin-left: 80px">--> -<!-- <span>婀栧窞鏅鸿姱鍔ㄥ姏鍙戝睍鏈夐檺鍏徃</span>--> -<!-- </div>--> - - -<!-- <div style="text-align: center;margin-top: 97px;font-size: 20px">--> -<!-- <span>TZ180XSDSZX01</span><br>--> -<!-- <span>KTZ34X23SZX07</span><br>--> -<!-- <span>993083</span><br>--> -<!-- <span>9900166410</span><br>--> -<!-- <span>2407190000002</span>--> -<!-- </div>--> - -<!-- <div style="margin-top: 76px;display: flex;margin-left: 32px">--> -<!-- <div ref="canvasWrapper" id="canvasWrapper1" style="width: 30%;flex: 1"></div>--> -<!-- <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 17px">--> -<!-- <span style="margin-left: -80px;font-size: 18px;font-family: FangSong">--> -<!-- P9900166410#T{{text1}}--> -<!-- </span><br>--> -<!-- <span style="margin-left: -80px;font-size: 18px;font-family: FangSong">--> -<!-- #V993983#SSW002.005#HHW001.001#NMCU#--> -<!-- </span>--> -<!--<!– <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>–>--> -<!-- </div>--> -<!-- </div>--> - -<!-- <div style="margin-top: 42px;display: flex;margin-left: 32px">--> -<!-- <div ref="canvasWrapper" id="canvasWrapper2" style="width: 30%;flex: 1"></div>--> -<!-- <div style="width: 70%;flex: 1;margin-top: 18px;margin-right: 17px">--> -<!-- <span style="margin-left: -80px;font-size: 18px;font-family: FangSong">--> -<!-- P9900166410#T{{text1}}--> -<!-- </span><br>--> -<!-- <span style="margin-left: -80px;font-size: 18px;font-family: FangSong">--> -<!-- #V993983#SSW002.005#HHW001.001#NMCU#--> -<!-- </span>--> -<!-- <!– <span style="font-size: 10px;word-break: break-all;display: flex;justify-content: center;width: 155px;margin-left: 9px">P9900166410#T{{text1}}#V993983#SSW002.005#HHW001.001#NBMS#</span>–>--> -<!-- </div>--> -<!-- </div>--> - -<!-- <div style="text-align: center;margin-left: -130px;margin-top: 42px">--> -<!-- <span>9900200461</span><br>--> -<!-- <span>MCU</span><br>--> -<!-- <span>HW 001.001</span><br>--> -<!-- <span>SW 001.001</span><br>--> -<!-- </div>--> - -<!-- </div>--> - <div id="printMe"> - <offline-qualification-report></offline-qualification-report> + <div id="printMe" class="print_hide"> + <offline-qualification-report :printParam="printParam"></offline-qualification-report> </div> - <el-button style="display: none" @click="test1">鐢熸垚浜岀淮鐮�</el-button> - <el-button style="display: none" @click="test2">鐢熸垚浜岀淮鐮�</el-button> - </div> </el-col> </el-tab-pane> </el-tabs> </el-col> - <el-col :span="12"> - <el-input v-model="weightValue" placeholder="璇疯緭鍏ョО閲嶆暟鎹�"></el-input> - <el-button @click="enterWeighing">褰曞叆</el-button> - </el-col> </el-row> - <el-dialog v-dialogpop-up :title="title" :visible.sync="open1" width="1000" append-to-body> - <el-row - type="flex" - class="row-bg" - justify="center" - v-show="portsList.length === 0" - > - <el-col :span="7"> - <div style="margin-top: 400px"> - <span style="display: block"> - 浠呮敮鎸丆hrome 89+鎴栬�匛dge 89+娴忚鍣�(瀹夊叏涓婁笅鏂囷紙HTTPS锛変腑鍙敤) - </span> - <el-button type="primary" @click="obtainAuthorization">鎺堟潈</el-button> - </div> - </el-col> - </el-row> - <el-form - v-show="portsList.length > 0" - ref="form1" - :model="form1" - label-width="100px"> - <el-row> - <el-col :span="24" - ><div> - <el-form-item label="涓插彛"> - <el-select - v-model="form1.port" - filterable - placeholder="璇烽�夋嫨涓插彛" - :disabled="isDisable" - > - <el-option - v-for="item in portsList" - :key="item.value" - :label="item.label" - :value="item.value" - > - </el-option> - </el-select> - </el-form-item> - <el-form-item label="娉㈢壒鐜�"> - <el-autocomplete - popper-class="my-autocomplete" - v-model="form1.baudRate" - :fetch-suggestions="querySearch" - placeholder="璇疯緭鍏ユ尝鐗圭巼" - :disabled="isDisable" - > - <i class="el-icon-edit el-input__icon" slot="suffix"> </i> - <template slot-scope="{ item }"> - <div class="name">{{ item.value }}</div> - <span class="addr">{{ item.address }}</span> - </template> - </el-autocomplete> - </el-form-item> - <el-form-item label="鏁版嵁浣�"> - <el-select - v-model="form1.dataBits" - placeholder="璇烽�夋嫨鏁版嵁浣�" - :disabled="isDisable" - > - <el-option label="7" value="7"></el-option> - <el-option label="8" value="8"></el-option> - </el-select> - </el-form-item> - <el-form-item label="鍋滄浣�"> - <el-select - v-model="form1.stopBits" - placeholder="璇烽�夋嫨鍋滄浣�" - :disabled="isDisable" - > - <el-option label="1" value="1"></el-option> - <el-option label="2" value="2"></el-option> - </el-select> - </el-form-item> - - <el-form-item label="鏍¢獙浣�"> - <el-select - v-model="form1.parity" - placeholder="璇烽�夋嫨鏍¢獙浣�" - :disabled="isDisable" - > - <el-option label="None" value="none"></el-option> - <el-option label="Even" value="even"></el-option> - <el-option label="Odd" value="odd"></el-option> - </el-select> - </el-form-item> - - <el-form-item label="娴佹帶鍒�"> - <el-select - v-model="form1.flowControl" - placeholder="璇烽�夋嫨娴佹帶鍒�" - :disabled="isDisable" - > - <el-option label="None" value="none"></el-option> - <el-option label="HardWare" value="hardware"></el-option> - </el-select> - </el-form-item> - <el-form-item label="鏄剧ず鍘嗗彶"> - <el-switch - v-model="form1.isShowHistory" - @change="loadHistory" - ></el-switch> - <el-button - type="danger" - icon="el-icon-delete" - circle - title="娓呯┖鍘嗗彶" - @click="clearHistory" - ></el-button> - </el-form-item> - <el-form-item label="鍙戦�佸尯璁剧疆" v-show="isShowSendArea"> - <el-form-item label="鍙戦�佹牸寮�"> - <el-radio-group v-model="form1.type"> - <el-radio label="1">ASCII</el-radio> - <el-radio label="2">HEX</el-radio> - </el-radio-group> - </el-form-item> - <el-form-item label="鍙戦�佷俊鎭�"> - <el-input type="textarea" v-model="form1.sendMsg"></el-input> - </el-form-item> - <el-button type="primary" @click="sendCommon">鍙戦��</el-button> - </el-form-item> - - <el-form-item> - <el-button :type="btnType" @click="connectBtn">{{ - btnText - }}</el-button> - <el-button type="info" @click="obtainAuthorization" - >鏂板鎺堟潈</el-button - > - </el-form-item> - </div> - </el-col> - </el-row> - </el-form> - </el-dialog> </div> </template> <script> @@ -317,6 +67,10 @@ components: {OfflineQualificationReport}, data() { return { + printParam: { + key: '閫夐」1', + label: '榛勯噾绯�' + }, weightValue: '', showInput: true, serialPortContent: '', @@ -398,9 +152,6 @@ text1: '', } }, - beforeDestroy() { - this.exit(); - }, created() { this.initStation(); // this.getStationConfList(); @@ -430,8 +181,17 @@ isDisable() { return this.btnType === "danger"; }, + printContent() { + return { + // id: '', + // id: '#printMe', + // preview: false, + } + } }, methods: { + + enterWeighing(){ if(this.headContent.sfcCode ==='' || this.weightValue === '' ){ this.$message.error('鍙傛暟涓嶅叏锛�'); @@ -548,41 +308,27 @@ // this.addOverStationCollection() this.print1() }, - print1() { - // 鏂板紑椤甸潰鎵撳嵃 - let newStr = document.getElementById('printMe').innerHTML; - let newWin = window.open('', '_blank'); - newWin.document.body.innerHTML = newStr; - newWin.print(); - return false; - }, - test1(){ - document.getElementById('canvasWrapper1').innerHTML = ''; - this.$nextTick(() => { - let qrCode = new QRCode('canvasWrapper1',{ - width: 83, - height: 83, - text: 'P9900166410#T'+ this.text1 +'#V993983#SSW002.005#HHW001.001#NMCU#', - colorDark: '#000', - colorLight: '#fff' - }) + printBefore() { + if (this.headContent.sfcCode !== '') { + document.getElementById('print').click(); + } else { + alert('璇峰厛鎵爜'); } - ) }, - test2(){ - document.getElementById('canvasWrapper2').innerHTML = ''; - this.$nextTick(() => { - let qrCode = new QRCode('canvasWrapper2',{ - width: 83, - height: 83, - text: 'P9900166410#T'+ this.text1 +'#V993983#SSW002.005#HHW001.001#NMCU#', - colorDark: '#000', - colorLight: '#fff' - }) - } - ) - }, - + // print1() { + // if(this.headContent.sfcCode !== ''){ + // // 鏂板紑椤甸潰鎵撳嵃 + // const value = 'Hello, Parent!'; + // this.$emit('value-sent', value); + // let newStr = document.getElementById('printMe').innerHTML; + // let newWin = window.open('', '_blank'); + // newWin.document.body.innerHTML = newStr; + // newWin.print(); + // return; + // }else { + // this.$message.error('璇峰厛鎵爜'); + // } + // }, /** 鍏ョ珯澧炲姞杩囩珯閲囬泦璁板綍 **/ addOverStationCollection(){ this.passingStationForm = { @@ -598,20 +344,6 @@ addPassingStationCollection(this.passingStationForm).then(response => {}); yzAddBasicParameters(this.passingStationForm).then(response => {}); }, - exit() { - if (this.ws) { - this.ws.close(); - this.ws = null; - } - }, - send() { - if (this.ws) { - this.ws.send(this.message); - } else { - alert("鏈繛鎺ュ埌鏈嶅姟鍣�"); - } - }, - initStation: async function () { await getIpv4().then(response => { this.StationConfQueryParams.ipAddress = response.msg @@ -939,6 +671,7 @@ } </script> + <style scoped> .div1, .div2 { flex: 1; /* 涓や釜div骞冲垎瀹瑰櫒瀹藉害 */ -- Gitblit v1.9.3