From e49d6f1841cf33eeb0515504449960d4e7ca3280 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期一, 23 十二月 2024 20:26:06 +0800
Subject: [PATCH] 钢化模块打印更改方式,打印完整版

---
 UI-Project/src/views/PurchaseReturn/purchaseReturn.vue |   78 +++++++++++---------------------------
 1 files changed, 23 insertions(+), 55 deletions(-)

diff --git a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
index c70f264..1692170 100644
--- a/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
+++ b/UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -6,7 +6,6 @@
 import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
 import {useI18n} from 'vue-i18n'
 import {useRouter} from 'vue-router'
-
 const {t} = useI18n()
 let language = ref(localStorage.getItem('lang') || 'zh')
 const dialogFormVisible = ref(false)
@@ -17,7 +16,6 @@
 const blind2 = ref(false)
 const blinda = ref(false)
 const blindb = ref(false)
-const dialogVisible = ref(false)
 const width = ref();
 const height = ref();
 const currentRect = ref(null);
@@ -68,32 +66,6 @@
     ElMessage.error(response.message);
   }
 };
-const printing = async () => {
-  let postData = {  
-    type: 9,  
-    workingProcedure: '閽㈠寲',  
-    ...(engineerId.value !== '' && { engineerId: engineerId.value }),  
-  };  
-  console.log(engineerId.value);
-  
-  const response = await request.post("/loadGlass/damage/selectDamagePrintDetails", postData)
-  if (response.code === 200) {
-  dialogVisible.value = true;
-    tableData.value = response.data; 
-    await nextTick(); 
-    // 寤舵椂 2 绉掑悗鎵撳嵃锛堟椂闂村彲浠ユ牴鎹渶瑕佽皟鏁达級  
-    setTimeout(() => {  
-      window.print();  
-    }, 2000);
-} else {
-    ElMessage.error(response.message);
-  }
-};
-const printTable = () => {  
-  // 杩欓噷鍙互娣诲姞涓�浜汣SS鏍峰紡鏉ヤ紭鍖栨墦鍗版晥鏋�  
-  // 渚嬪锛屽彲浠ユ坊鍔犱竴涓殣钘忕殑鎵撳嵃鏍峰紡琛�  
-  window.print();  
-};  
 const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`;
 const handleMessage = (data) => {  
   // 杩涚倝涓彸
@@ -466,6 +438,11 @@
       return '#4682B4'; 
   }  
 }
+// 瀹氫箟瀵艰埅鍒版柊椤甸潰鐨勬柟娉�
+const navigateToPrintPage = () => {
+  // 浣跨敤璺敱瀹炰緥鐨� push 鏂规硶瀵艰埅鍒版柊椤甸潰
+  router.push('/PurchaseReturn/purchaseprint');
+};
 function showDialog1(rect) {
   const index = adjustedRects1.value.findIndex(r => r.glassId === rect.glassId);  
   if (index !== -1) {  
@@ -957,9 +934,8 @@
     <div style="display: flex; flex-direction: row; align-items: center; margin-top: 5px;margin-left: 10px;">  
     <el-input :placeholder="$t('processCard.projectnumber')" v-model="engineerId" autocomplete="off" style="width: 300px;"/>
     <el-button type="primary" style="margin-left: 10px;" @click="selectReportData()">{{ $t('processCard.inquire') }}</el-button>
-    <el-button type="info" style="margin-left: 10px;" @click="printing()">{{ $t('processCard.printing') }}</el-button>
+    <el-button type="info" style="margin-left: 10px;" @click="navigateToPrintPage">{{ $t('processCard.printing') }}</el-button>
   </div>
- 
     <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading">
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
     <el-table
@@ -1025,30 +1001,6 @@
           {{ $t('order.takeon') }}
         </el-button> -->
   </el-dialog> 
-  <el-dialog  
-      v-model="dialogVisible"
-      width="100%" 
-      top="0vh"
-      :show-close="false"
-      >  
-      <div class="custom-title" style="text-align: center; margin-bottom: 20px;">  
-      {{ $t('processCard.glasstakeout') }}  
-    </div>  
-      <el-table  
-        :data="tableData"  
-        style="width: 100%;height: 760px"  
-      >
-        <el-table-column prop="flowCardId" :label="$t('processCard.flowcard')" width="140" align="center"/>
-        <el-table-column prop="layer" :label="$t('processCard.layer')" align="center" width="52"/>
-        <el-table-column prop="engineerId" :label="$t('processCard.project')" align="center" width="110"/>
-        <el-table-column prop="temperingLayoutId" :label="$t('processCard.temperinglayout')" align="center" width="52"/>
-        <el-table-column prop="temperingFeedSequence" :label="$t('processCard.temperingfeed')" align="center"
-                         width="52"/>
-        <el-table-column prop="width" :label="$t('processCard.width')" align="center" width="80"/>
-        <el-table-column prop="height" :label="$t('processCard.height')" align="center" width="80"/>
-        <el-table-column prop="thickness" :label="$t('processCard.thickness')" align="center" width="52"/>
-      </el-table>
-  </el-dialog>
     </div>
   </div>
 </template>
@@ -1135,5 +1087,21 @@
 .custom-title {  
   font-size: 20px;
   font-weight: bold;
-} 
+}
+/* @media print {
+  .el-table {
+    page-break-inside: avoid;
+  }
+} */
+@media print {
+    body {
+        margin: 0;
+        padding: 0;
+    }
+    .el-table {
+        width: 100%;
+        break-inside: avoid; /* 閬垮厤琛ㄦ牸鍦ㄦ墦鍗版椂琚媶鍒� */
+    }
+    /* 鏍规嵁闇�瑕佹坊鍔犳洿澶氭牱寮� */
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0