From f791db88d83a7ed851b9412d9797ed16b345fe79 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 07 七月 2022 18:39:18 +0800
Subject: [PATCH] 1.项目页面修改2.生产管理工单页面开发

---
 src/views/scgl/gdpg.vue |  248 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 229 insertions(+), 19 deletions(-)

diff --git a/src/views/scgl/gdpg.vue b/src/views/scgl/gdpg.vue
index 620487b..565b40b 100644
--- a/src/views/scgl/gdpg.vue
+++ b/src/views/scgl/gdpg.vue
@@ -6,12 +6,12 @@
     <el-dialog
       title="棰勮"
       :visible.sync="dialogVisible"
-      width="70%"
+      width="1140"
     >
       <!-- 瑕佹墦鍗扮殑鍖哄煙 -->
-      <div id="printMe">
+      <div id="printMe" style="padding: 30px">
 
-        <div style="display: flex;justify-content: space-around">
+        <div style="display: flex;justify-content: space-around;">
           <!--          浜岀淮鐮侀儴鍒�-->
           <div>
             <div id="qrCode" ref="qrCodeDiv" />
@@ -28,30 +28,72 @@
           </div>
           <!--鍙充晶姘村嵃鍙婂鍚嶆棩鏈�-->
           <div>
-            <div ref="watermark" style="width: 100px;height:100px;" />
+            <!--            <div ref="watermark" style="width: 100px;height:100px;" />-->
+            <div style="color:#0f0f0f;;width: 100px;margin-top:40px;height: 50px;text-align: center">鍑开鍒堕��</div>
             <div style="font-weight: bolder">
               <div>濮撳悕锛氬紶涓�</div>
               <div>鏃ユ湡锛�2022-07-05</div>
             </div>
           </div>
         </div>
-        <el-divider />
+        <!--        <el-divider />-->
+        <div style="width:100%;height: 30px;border-bottom: 1px solid #eee;margin-bottom: 20px" />
         <el-table
+          id="table"
           :data="tableData"
           border
-          style="width: 100%"
+          class="elTable"
+          style="width: 100%;"
         >
           <el-table-column
+            id="column0"
             prop="date"
             label="鏃ユ湡"
-            width="180"
+            width="100"
           />
           <el-table-column
+            id="column1"
             prop="name"
             label="濮撳悕"
-            width="180"
+            width="100"
           />
           <el-table-column
+            id="column2"
+            prop="address"
+            label="鍦板潃"
+            width="150"
+          />
+          <el-table-column
+            id="column3"
+            prop="address"
+            label="鍦板潃"
+            width="150"
+          />
+          <el-table-column
+            id="column4"
+            prop="address"
+            width="150"
+
+            label="鍦板潃"
+          />
+          <el-table-column
+            id="column5"
+            width="150"
+
+            prop="address"
+            label="鍦板潃"
+          />
+          <el-table-column
+            id="column6"
+            prop="address"
+            width="120"
+
+            label="鍦板潃"
+          />
+          <el-table-column
+            id="column7"
+            width="119"
+
             prop="address"
             label="鍦板潃"
           />
@@ -71,20 +113,115 @@
         <el-button type="primary" @click="dialogVisible = false">纭� 瀹�</el-button>
       </span>
     </el-dialog>
+
+    <!--2222-->
+    <el-dialog
+      title="棰勮"
+      :visible.sync="dialogVisible2"
+      width="1140"
+    >
+      <!-- 瑕佹墦鍗扮殑鍖哄煙 -->
+      <div id="printMe2" style="padding: 30px;">
+        <!--        <div style="width: 500px; height: 300px;">-->
+
+        <div style="display: flex;width: 300px;height: 200px;border: 1px solid #000;text-align: center;font-size: 16px;">
+          <div style="width: 100px;display: flex;flex-direction: column;border-right: 1px solid #000">
+            <div style="display: flex;height: 75%;border-bottom:1px solid #000;justify-content: center;align-items: center ">
+              <div id="qrCode2" ref="qrCodeDiv2" />
+            </div>
+            <div style="display: flex;height: 25%;justify-content: center;align-items: center">
+              鏁伴噺锛�100
+            </div>
+          </div>
+          <div style="width:200px;display: flex;flex-direction: column">
+            <div style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: center;align-items: center ">
+              宸ュ崟缂栧彿锛�1403-001-0001
+            </div>
+            <div style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: center;align-items: center ">
+              宸ュ崟缂栧彿锛�1403-001-0001
+            </div>
+            <div style="display: flex;height: 25%;border-bottom:1px solid #000 ;justify-content: center;align-items: center">
+              宸ュ崟缂栧彿锛�1403-001-0001
+            </div>
+            <div style="display: flex;height: 25%;justify-content: center;align-items: center">
+              宸ュ崟缂栧彿锛�1403-001-0001
+            </div>
+
+          </div>
+
+        </div>
+
+        <!--        </div>-->
+      </div>
+
+      <!--      <vue-easy-print ref="printRef" :button-show="true">-->
+      <!--        x-->
+      <!--      </vue-easy-print>-->
+
+      <!-- 鎵撳嵃鐨勬寜閽紝鏄剧ず鎵撳嵃棰勮 -->
+      <!--    <el-button v-print="'#printMe'">鎵撳嵃</el-button>-->
+      <el-button v-print="printObj2">鎵撳嵃</el-button>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible2 = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="dialogVisible2 = false">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+
+    <el-button type="text" @click="outerVisible = true">鐐瑰嚮鎵撳紑澶栧眰 Dialog</el-button>
+
+    <el-dialog
+      title="澶栧眰 Dialog"
+      top="15vh"
+      :close-on-click-modal="false"
+      width="840"
+      :visible.sync="outerVisible"
+    >
+      <el-dialog
+        width="30%"
+        title="鍐呭眰 Dialog"
+        :visible.sync="innerVisible"
+        append-to-body
+      />
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="outerVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="innerVisible = true">鎵撳紑鍐呭眰 Dialog</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 <script>
-import vueEasyPrint from 'vue-easy-print'
+// import vueEasyPrint from 'vue-easy-print'
 import QRCode from 'qrcodejs2'
 // import QRCode from 'qrcode'
 
 export default {
   name: 'Gdpg',
-  components: {
-    vueEasyPrint
-  },
+  // components: {
+  //   vueEasyPrint
+  // },
   data() {
     return {
+      outerVisible: false,
+      innerVisible: false,
+      dialogVisible2: false,
+      printObj2: {
+        id: 'printMe2',
+        beforeOpenCallback(vue) {
+          vue.printLoading = true
+          console.log('鎵撳紑涔嬪墠')
+          console.log()
+        },
+        openCallback(vue) {
+          vue.printLoading = false
+          console.log('鎵ц浜嗘墦鍗�')
+        },
+        closeCallback(vue) {
+          console.log('鍏抽棴浜嗘墦鍗板伐鍏�')
+        }
+
+      },
       firstWatermark: true, // 绗竴娆℃樉绀烘按鍗�
       firstbindQRCode: true, // 绗竴娆℃樉绀轰簩缁寸爜
       form: {
@@ -96,7 +233,42 @@
       printObj: {
         id: 'printMe',
         popTitle: '鎵撳嵃妯℃澘',
-        extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>'
+        extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>',
+        previewBeforeOpenCallback() {
+        }, // 棰勮绐楀彛鎵撳紑涔嬪墠鐨刢allback锛堝紑鍚瑙堟ā寮忚皟鐢級
+        previewOpenCallback() {
+        }, // 棰勮绐楀彛鎵撳紑涔嬪悗鐨刢allback锛堝紑鍚瑙堟ā寮忚皟鐢級
+        beforeEntryIframe() {
+          const widthArr = ['10%', '10%', '15%', '15%', '15%', '15%', '10%', '10%']
+          // const tables = document.getElementById('table').getElementsByTagName('el-table') // 鑾峰彇鎵撳嵃鐨勮〃鏍�
+          const tables = document.getElementById('table') // 鑾峰彇鎵撳嵃鐨勮〃鏍�
+          // const headcolgroupCol0 = tables[0].getElementsByTagName('colgroup')[0].getElementsByTagName('col')
+          // const headcolgroupCol0 = document.getElementById('column0').style.width = '400px'
+          // const headcolgroupCol1 = document.getElementById('column1')
+          // const headcolgroupCol2 = document.getElementById('column2')
+          // const headcolgroupCol3 = document.getElementById('column3')
+          // const headcolgroupCol4 = document.getElementById('column4')
+          // const headcolgroupCol5 = document.getElementById('column5')
+          // const headcolgroupCol6 = document.getElementById('column6')
+          // const headcolgroupCol7 = document.getElementById('column7')
+          // const headcolgroupCol1 = tables[1].getElementsByTagName('colgroup')[0].getElementsByTagName('col')
+          // widthArr.forEach((val, index) => {
+          //   headcolgroupCol0[index].width = val
+          //   headcolgroupCol1[index].width = val
+          //   headcolgroupCol2[index].width = val
+          //   headcolgroupCol3[index].width = val
+          //   headcolgroupCol4[index].width = val
+          //   headcolgroupCol5[index].width = val
+          //   headcolgroupCol6[index].width = val
+          //   headcolgroupCol7[index].width = val
+          // })
+        },
+        openCallback() {
+
+        }, // 璋冪敤鎵撳嵃涔嬪悗鐨勫洖璋冧簨浠�
+        closeCallback() {
+        } // 鍏抽棴鎵撳嵃鐨勫洖璋冧簨浠讹紙鏃犳硶纭畾鐐瑰嚮鐨勬槸纭杩樻槸鍙栨秷锛�
+
         // id: 'printMe',
         // popTitle: '鎵撳嵃', // 鎵撳嵃閰嶇疆椤典笂鏂规爣棰�
         // extraHead: '', // 鏈�涓婃柟鐨勫ご閮ㄦ枃瀛楋紝闄勫姞鍦╤ead鏍囩涓婄殑棰濆鏍囩,浣跨敤閫楀彿鍒嗛殧
@@ -133,7 +305,9 @@
     }
   },
   mounted() {
-
+    this.$nextTick(() => {
+      this.bindQRCode()
+    })
   },
   methods: {
     addWatermark() {
@@ -148,15 +322,20 @@
       this.$nextTick(() => {
         this.bindQRCode()
         this.addWatermark()
+        console.log(document.getElementById('column0').style.width = '200px', 0)
+        console.log(document.getElementById('column7'), 7)
+        console.log(document.getElementById('table'), 2)
+        console.log(document.getElementById('table').getElementsByTagName('el-table'), 1)
       })
     },
     bindQRCode() {
       if (this.firstbindQRCode) {
-        new QRCode(this.$refs.qrCodeDiv, {
+        const text = 'PO202206280001;Step02'
+        new QRCode(this.$refs.qrCodeDiv2, {
           // text: 'Vue瀹炵幇鐢熸垚浜岀淮鐮侊紒',
-          text: 'Vue瀹炵幇鐢熸垚浜岀淮鐮侊紒',
-          width: 100,
-          height: 100,
+          text: text,
+          width: 80,
+          height: 80,
           colorDark: '#333333', // 浜岀淮鐮侀鑹�
           colorLight: '#ffffff', // 浜岀淮鐮佽儗鏅壊
           correctLevel: QRCode.CorrectLevel.L// 瀹归敊鐜囷紝L/M/H
@@ -189,7 +368,38 @@
 }
 </script>
 
-<style scoped>
+<style media="print">
+/*@media print {*/
+  @page {
+    /*size: auto;*/
+    size: auto;
+    margin: 3mm;
+    /*margin: 0mm;*/
+    /*padding: 0;*/
+  }
+/*}*/
+/*.elTable {*/
 
+/*::v-deep .el-table {*/
+/*  margin-top: 10px;*/
+/*}*/
+/*table {*/
+/*  width: 100% !important;*/
+/*}*/
+
+/*.el-table__body,*/
+/*.el-table__header {*/
+/*  width: 100% !important;*/
+/*}*/
+
+/*.el-table__body {*/
+/*  width: 100% !important;*/
+/*}*/
+
+/*}*/
+
+/*/deep/.el-table__body-wrapper::-webkit-scrollbar{*/
+/*  width: 0;*/
+/*}*/
 </style>
 

--
Gitblit v1.9.3