From fe87f8fe2250e1ffc7d1474fb97cc0ceb89ae55e Mon Sep 17 00:00:00 2001
From: cuijian <cuijian@xalxzn.com>
Date: 星期三, 06 八月 2025 14:13:18 +0800
Subject: [PATCH] 量具检定

---
 src/views/tms/modules/inbound/InboundListRight.vue |   96 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 68 insertions(+), 28 deletions(-)

diff --git a/src/views/tms/modules/inbound/InboundListRight.vue b/src/views/tms/modules/inbound/InboundListRight.vue
index 87a962c..c08e06e 100644
--- a/src/views/tms/modules/inbound/InboundListRight.vue
+++ b/src/views/tms/modules/inbound/InboundListRight.vue
@@ -99,23 +99,14 @@
           </a-button>
         </template>
 
-        <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
-
-          <a-divider type="vertical" />
-          <a-dropdown>
-            <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
-            <a-menu slot="overlay">
-              <a-menu-item>
-                <a @click="handleDetail(record)">璇︽儏</a>
-              </a-menu-item>
-              <a-menu-item>
-                <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
-                  <a>鍒犻櫎</a>
-                </a-popconfirm>
-              </a-menu-item>
-            </a-menu>
-          </a-dropdown>
+       <span
+          slot="action"
+          slot-scope="text, record"
+        >
+          <a
+            href="javascript:;"
+            @click="handlePrint(record)"
+          >鎵撳嵃浜岀淮鐮�</a>
         </span>
 
       </a-table>
@@ -147,6 +138,13 @@
 
     <inbound-model ref="modalForm" @ok="modalFormOk" :nodeSelected="nodeSelected"></inbound-model>
     <inbound-apply-model-list ref="inboundApplyModelList"></inbound-apply-model-list>
+    <div id="printArea" style="display: block;">
+      <div v-for="(item, index) in qrList" :key="index" class="qrcode-item">
+        <p>{{ item.onlyCode }}</p>
+        <p>{{ item.toolName }}</p>
+        <img :src="item.base64" alt="QR Code">
+      </div>
+    </div>
   </a-card>
 </template>
 
@@ -166,6 +164,7 @@
   import ParaBladeList from '.././baseTools/ParaBladeList'
   import InboundModel from './InboundModel'
   import InboundApplyModelList from './InboundApplyModelList.vue'
+  import printJS from 'print-js';
 
   export default {
     name: 'InboundListRight',
@@ -258,14 +257,14 @@
               return !text?"":(text.length>10?text.substr(0,10):text)
             }
           },
-          // {
-          //   title: '鎿嶄綔',
-          //   dataIndex: 'action',
-          //   align:"center",
-          //   fixed:"right",
-          //   width:147,
-          //   scopedSlots: { customRender: 'action' }
-          // }
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' }
+          }
         ],
         url: {
           list: "/tms/inStoreDetail/list",
@@ -281,13 +280,15 @@
           exportXlsUrl: "/tms/baseTools/exportXls",
           importExcelUrl: "tms/baseTools/importExcel",
           queryParaByToolCode:"/tms/baseTools/queryByToolCode",
-          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode"
+          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode",
+          print:'/tms/inStoreDetail/print'
         },
         dictOptions:{},
         superFieldList:[],
         nodeSelected: {}, // 褰撳墠閫変腑鐨勮妭鐐规暟鎹�
         paraTypeFlag:'',
-        disableMixinCreated:true
+        disableMixinCreated:true,
+        qrList: []
       }
     },
     created() {
@@ -527,7 +528,46 @@
         this.$refs.paraTurningToolsList.visable = false
         this.$refs.paraBladeList.visable = false
         this.$refs.toolsConfigPropertyList.visable = false
-      }
+      },
+      handlePrint(record){
+          this.loading = true
+          getAction(this.url.print, {onlyCode:record.onlyCode})
+            .then((res) => {
+              if (res.success) {
+                this.qrList = res.result.map((content, i) => ({
+                  onlyCode:res.result[i].onlyCode,
+                  toolName:res.result[i].toolName,
+                  base64: res.result[i].image
+                  }));
+                  this.handleBacthPrint();
+                this.$emit('ok', new Date())
+              } else {
+                this.$message.warning(res.message)
+              }
+            })
+            .finally(() => {
+              this.loading = false
+              this.close()
+            })
+    },
+    // 鎵ц鎵撳嵃
+    handleBacthPrint() {
+      this.$nextTick(() => {
+        printJS({
+          printable: 'printArea',
+          type: 'html',
+          style: `
+            .qrcode-item { 
+              page-break-inside: avoid;
+              margin: 10px; 
+              text-align: center;
+            }
+            img { width: 100px; height: 100px; }
+          `,
+          scanStyles: false
+        });
+      });
+    }
       
     },
   }

--
Gitblit v1.9.3