From 4e91ae3c1ff41d0bf9f65d444c90c2583e69cdb7 Mon Sep 17 00:00:00 2001
From: admin <15939171744@163.com>
Date: 星期五, 27 九月 2024 17:16:10 +0800
Subject: [PATCH] 下线打印报告优化

---
 jcdm-ui/src/views/main/cfkb/Instructions/index.vue |  417 ++++++++---------------------------------------------------
 1 files changed, 58 insertions(+), 359 deletions(-)

diff --git a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
index bfb7891..81f23b2 100644
--- a/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
+++ b/jcdm-ui/src/views/main/cfkb/Instructions/index.vue
@@ -3,293 +3,43 @@
     <el-row :gutter="5">
       <el-col :span="7">
         <el-card shadow="never">
-          <span class="head-font">宸ヤ綅缂栧彿 : {{headContent.processesCode}}</span>
+          <span class="head-font">宸ヤ綅缂栧彿锛歿{headContent.processesCode}}</span>
         </el-card>
       </el-col>
       <el-col :span="7">
         <el-card shadow="never">
-          <span class="head-font">宸ヤ綅鍚嶇О : {{headContent.processesName}}</span>
+          <span class="head-font">宸ヤ綅鍚嶇О锛歿{headContent.processesName}}</span>
         </el-card>
       </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>
+        <el-card shadow="never" body-style="padding: 10px;">
+          <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'" style="display: none;">鎵撳嵃</el-button>
+<!--          <el-button id="print" @click="print1" type="primary">鎵撳嵃</el-button>-->
+          <el-button type="primary" @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>-->
-<!--&lt;!&ndash;                      <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>&ndash;&gt;-->
-<!--                    </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>-->
-<!--                      &lt;!&ndash;                      <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>&ndash;&gt;-->
-<!--                    </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>
+                  <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>
@@ -304,19 +54,23 @@
 import USBDevice from "@/utils/usb.json";
 import {addPassingStationCollection} from "@/api/main/da/passingStationCollection/passingStationCollection";
 import {
-  addTighteningParameters, enterWeighing,
+  addTighteningParameters, enterWeighing, getPrintOfflineReportInfo, listParamCollection,
   replaceAssemblyCode,
   saveCampaignTimeParameters,
   yzAddBasicParameters,
 } from "@/api/main/da/paramCollection/paramCollection";
 import QRCode from "qrcodejs2";
 import OfflineQualificationReport from "@/views/components/offlineQualificationReport.vue";
+import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde";
 
 export default {
   name: "stationTerminal",
   components: {OfflineQualificationReport},
   data() {
     return {
+      printParam: {
+
+      },
       weightValue: '',
       showInput: true,
       serialPortContent: '',
@@ -398,9 +152,6 @@
       text1: '',
     }
   },
-  beforeDestroy() {
-    this.exit();
-  },
   created() {
     this.initStation();
     // this.getStationConfList();
@@ -408,43 +159,7 @@
     //   this.connectWebsocket();
     // }, 3000);
   },
-  mounted() {
-    if ("serial" in navigator) {
-      this.myserialport = new MySerialPort();
-      this.getPorts();
-      navigator.serial.addEventListener("connect", (e) => {
-        this.$message.success("璁惧宸茶繛鎺�");
-        this.getPorts();
-      });
-      navigator.serial.addEventListener("disconnect", (e) => {
-        this.$message.error("璁惧宸叉柇寮�");
-      });
-      this.restaurants = this.loadAll();
-    } else {
-      this.$message.error(
-        "褰撳墠涓篐TTP妯″紡鎴栬�呮祻瑙堝櫒鐗堟湰杩囦綆锛屼笉鏀寔缃戦〉杩炴帴涓插彛"
-      );
-    }
-  },
-  computed: {
-    isDisable() {
-      return this.btnType === "danger";
-    },
-  },
   methods: {
-    enterWeighing(){
-      if(this.headContent.sfcCode ==='' || this.weightValue === '' ){
-        this.$message.error('鍙傛暟涓嶅叏锛�');
-      }else {
-        let param = {
-          sfcCode: this.headContent.sfcCode,
-          weightValue: this.weightValue,
-        }
-        enterWeighing(param).then(response => {
-          this.$message('褰曞叆瀹屾垚锛�');
-        });
-      }
-    },
     serialLink() {
       this.open1 = true
     },
@@ -462,17 +177,6 @@
       }
     },
 
-    Release(){
-      // this.$message('portsList锛�'+this.portsList.length);
-      if(this.btnType === "danger"){
-        this.$message('杩炴帴浜�!锛�');
-
-      }else {
-        this.$message('mei杩炴帴浜嗭紒');
-
-      }
-
-    },
     serialPortMethod(value){
       let formulaChildParams = {
         scanBarcode: value,
@@ -548,41 +252,38 @@
       // 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 !== '') {
+        listProductionOrde({productNum: this.headContent.sfcCode}).then(response => {
+          let rowsData = response.rows[0];
+          if(rowsData){
+            getPrintOfflineReportInfo({productNum: this.headContent.sfcCode}).then(response => {
+              this.printParam = response.data
+              document.getElementById('print').click();
+            });
+          }else {
+            this.$message.error('绯荤粺娌℃湁姝ゅ伐鍗曪紝璇烽噸鏂版壂鐮侊紒');
+          }
+        });
+      } else {
+        this.$message.error('璇峰厛鎵爜!');
       }
-      )
-    },
-    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 +299,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 +626,7 @@
 }
 
 </script>
+
 <style scoped>
 .div1, .div2 {
   flex: 1; /* 涓や釜div骞冲垎瀹瑰櫒瀹藉害 */
@@ -988,5 +676,16 @@
 .el-table .success-row {
   background: #f0f9eb;
 }
+
+/*闅愯棌鎵撳嵃鍖哄煙*/
+/*#printMe {*/
+/*  display: none;*/
+/*}*/
+/*!*鎵撳嵃鏃舵樉绀烘墦鍗板尯鍩�*!*/
+/*@media print {*/
+/*  #printMe {*/
+/*    display: block;*/
+/*  }*/
+/*}*/
 </style>
 

--
Gitblit v1.9.3