From 1c13bd7a2cd2c8ba69a185da69344c8b59f4e561 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期四, 04 七月 2024 09:29:15 +0800
Subject: [PATCH] 选中求和功能以及还原双击回车才能点击单元格

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProcess.vue |  219 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 121 insertions(+), 98 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProcess.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProcess.vue
index a804c53..37c7ca6 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProcess.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProcess.vue
@@ -8,7 +8,9 @@
 import {useI18n} from 'vue-i18n'
 import deepClone from "@/utils/deepClone";
 import QRCode from "qrcode";
+import companyInfo from "@/stores/sd/companyInfo";
 //璇█鑾峰彇
+const company = companyInfo()
 const {t} = useI18n()
 let router = useRouter()
 let produceList = ref([])
@@ -22,6 +24,7 @@
 
 const {currentRoute} = useRouter()
 const route = currentRoute.value
+const printMerge = route.query.printMerge
 data.value.printList = JSON.parse(route.query.printList)
 let flowCardCount = data.value.printList.length
 onMounted(() => {
@@ -33,7 +36,46 @@
         if (res.code == 200) {
 
           produceList.value = deepClone(res.data.data)
-          console.log(produceList.value)
+          if (printMerge !== null && printMerge !== undefined && printMerge !== "") {
+
+            produceList.value.forEach(item => {
+              item.detail[0].technologyNumber = printMerge;
+            });
+          }
+          let technologyNumberMerge = printMerge.split('').join(',');
+          console.log(technologyNumberMerge)
+          produceList.value[0].detail[0].technologyNumberMerge = technologyNumberMerge
+          console.log(produceList.value[0].detail[0])
+          const s01Values = [];
+          // 閬嶅巻 res.data.numberList 鏁扮粍锛岃幏鍙栨瘡涓厓绱犵殑 S01 鍊煎苟瀛樺偍鍒� s01Values 鏁扮粍涓�
+          produceList.value[0].detailList.forEach(element => {
+            try {
+              const otherColumnsObject = JSON.parse(element.other_columns);
+              const s01Value = otherColumnsObject.S01;
+              if (s01Value) {
+                s01Values.push(s01Value);
+              } else {
+                // 濡傛灉 S01 鍊间负绌猴紝鍙互閫夋嫨娣诲姞榛樿鍊兼垨鑰呭拷鐣ヨ繖涓厓绱�
+                s01Values.push(''); // 渚嬪娣诲姞绌哄瓧绗︿覆
+              }
+            } catch (error) {
+              // console.error('Error parsing JSON or accessing S01 value:', error);
+              // 澶勭悊 JSON 瑙f瀽閿欒鎴栧叾浠栧紓甯告儏鍐�
+            }
+          });
+          // 閬嶅巻 res.data.Detail 鏁扮粍锛屽皢 s01Values 涓殑鍊艰祴缁欐瘡涓鍗曡鎯呭璞$殑 s01Value 灞炴��
+          produceList.value[0].detailList.forEach((detail, index) => {
+            if (index < s01Values.length) {
+              detail.s01Value = s01Values[index]; // 娣诲姞涓�涓悕涓� s01Value 鐨勬柊灞炴�э紝瀛樺偍瀵瑰簲鐨� S01 鍊�
+            } else {
+              detail.s01Value = ''; // 濡傛灉 s01Values 涓殑鍊间笉瓒筹紝鍙互娣诲姞榛樿鍊兼垨鑰呬笉杩涜璧嬪�煎鐞�
+            }
+          });
+
+
+
+
+
           handleGetQRCode()
         } else {
           ElMessage.warning(res.msg)
@@ -42,60 +84,66 @@
       })
 
     }
-
 )
 
 
 const handleGetQRCode = async () => {
   for (let i = 0; i < produceList.value.length; i++) {
-    list= produceList.value[i].detail[0].processIdNumber;
-    const url = `${list}`;
-    // 鐢熸垚 QR Code 骞跺瓨鍌ㄥ埌鍙橀噺涓�
-    const qrcode = ref('');
-    qrcode.value =  await QRCode.toDataURL(url);
-    produceList.value[i].detail[0]["qrcode"]=qrcode.value
+    const technologyNumber = produceList.value[i].detail[0].technologyNumber.toString(); // 杞崲涓哄瓧绗︿覆浠ヤ究澶勭悊姣忎釜瀛楃
+    produceList.value[i].detail[0]["qrcodeList"] = []; // 鍒濆鍖栦竴涓┖鏁扮粍鐢ㄦ潵瀛樺偍 QR Code
+
+    for (let j = 0; j < technologyNumber.length; j++) {
+      const processId = produceList.value[i].detail[0].process_id;
+      const url = `${processId}/${technologyNumber[j]}`;
+
+      // 鐢熸垚 QR Code 骞跺瓨鍌ㄥ埌鏁扮粍涓�
+      const qrcodeData = await QRCode.toDataURL(url);
+      produceList.value[i].detail[0]["qrcodeList"].push({
+        qrcode: qrcodeData,
+        technologyNumber: technologyNumber[j]
+      });
+
+    }
   }
 };
 
 
-
-
 // 鎵撳嵃鏂规硶
-  const printFlowCard = () => {
-    // 闇�瑕佹墦鍗扮殑灞�閮ㄥ尯鍩熻祴浜�"print-wrap"鐨刬d
-    let el = document.getElementById("printFlowCard");
-    let doc = document;
-    let body = doc.body || doc.getElementsByTagName("body")[0];
-    let printId = "print-" + Date.now();
+const printFlowCard = () => {
+  // 闇�瑕佹墦鍗扮殑灞�閮ㄥ尯鍩熻祴浜�"print-wrap"鐨刬d
+  let el = document.getElementById("printFlowCard");
+  let doc = document;
+  let body = doc.body || doc.getElementsByTagName("body")[0];
+  let printId = "print-" + Date.now();
 
-    // 鍒涘缓鏃犲壇浣滅敤鐨勬墦鍗板鍣�(鍥犱笉纭畾椤甸潰鐨勬墦鍗板厓绱犳湁鏃犲叾瀹冩牱寮�)
-    let content = doc.createElement("div");
-    content.id = printId;
+  // 鍒涘缓鏃犲壇浣滅敤鐨勬墦鍗板鍣�(鍥犱笉纭畾椤甸潰鐨勬墦鍗板厓绱犳湁鏃犲叾瀹冩牱寮�)
+  let content = doc.createElement("div");
+  content.id = printId;
 
-    // 鏍峰紡鎺у埗涓庢墦鍗版棤鍏崇殑鍏冪礌闅愯棌
-    let style = doc.createElement("style");
-    style.innerHTML =
-        "body>#" +
-        printId +
-        "{display:none}@media print{body>:not(#" +
-        printId +
-        "){display:none !important}body>#" +
-        printId +
-        "{display:block;padding-top:1px}}";
-    //
-    content.innerHTML = el.outerHTML;
-    // // console.log("el.outerHTML", el.outerHTML);
-    body.appendChild(style);
+  // 鏍峰紡鎺у埗涓庢墦鍗版棤鍏崇殑鍏冪礌闅愯棌
+  let style = doc.createElement("style");
+  style.innerHTML =
+      "body>#" +
+      printId +
+      "{display:none}@media print{body>:not(#" +
+      printId +
+      "){display:none !important}body>#" +
+      printId +
+      "{display:block;padding-top:1px}}";
+  //
+  content.innerHTML = el.outerHTML;
+  // // console.log("el.outerHTML", el.outerHTML);
+  body.appendChild(style);
 
-    // 涓巗tyle鍏冪礌璁剧疆鐨勬牱寮忕浉閰嶅悎
-    // 鎶婃墦鍗板唴瀹圭殑鍏冪礌娣诲姞鍒癰ody(浣滀负body鐨勫瓙鍏冪礌锛屽彲鐢╞ody鐨勫瓙閫夋嫨鍣� '>' 鎺у埗鎵撳嵃鏍峰紡)
-    body.appendChild(content);
-    setTimeout(() => {
-      window.print();
-      body.removeChild(content);
-      body.removeChild(style);
-    }, 20);
-  }
+  // 涓巗tyle鍏冪礌璁剧疆鐨勬牱寮忕浉閰嶅悎
+  // 鎶婃墦鍗板唴瀹圭殑鍏冪礌娣诲姞鍒癰ody(浣滀负body鐨勫瓙鍏冪礌锛屽彲鐢╞ody鐨勫瓙閫夋嫨鍣� '>' 鎺у埗鎵撳嵃鏍峰紡)
+  body.appendChild(content);
+  setTimeout(() => {
+    window.print();
+    body.removeChild(content);
+    body.removeChild(style);
+  }, 20);
+}
 </script>
 
 <template>
@@ -106,9 +154,13 @@
       <tr v-for="(itemFlow,index) in item.detail" :key="index">
         <td colspan="24">
           <div id="bj" style="float: right;font-size: 28px">{{ id + 1 }}</div>
-          <div>甯稿窞甯傚悏鍒╃幓鐠冩湁闄愬叕鍙�</div>
+          <div>{{company.companyName}}</div>
           <div>鐢熶骇娴佺▼鍗�</div>
-          <div style="text-align: right;font-weight: bolder">娴佺▼鍗″彿锛� {{
+          <div v-if="itemFlow.technologyNumberMerge!=''" style="text-align: right;font-weight: bolder">娴佺▼鍗″彿锛� {{
+              itemFlow.process_id
+            }}/{{ itemFlow.technologyNumberMerge }} 鍏� {{ flowCardCount }} 鏋�
+          </div>
+          <div v-else style="text-align: right;font-weight: bolder">娴佺▼鍗″彿锛� {{
               itemFlow.process_id
             }}/{{ itemFlow.technologyNumber }} 鍏� {{ flowCardCount }} 鏋�
           </div>
@@ -120,7 +172,7 @@
         <td class="tdNowrap">椤圭洰鍚嶇О锛�</td>
         <td colspan="2">{{ items.project }}</td>
         <td class="tdNowrap">宸ヨ壓娴佺▼锛�</td>
-        <td colspan="16">{{ items.process }}</td>
+        <td colspan="17">{{ items.process }}</td>
       </tr>
       <tr v-for="(itemTr,index) in item.detail" :key="index">
         <td class="tdNowrap">纾ㄨ竟绫诲瀷锛�</td>
@@ -128,10 +180,11 @@
         <td class="tdNowrap">鍗曠墖鍚嶇О锛�</td>
         <td colspan="2">{{ itemTr.glass_child }}</td>
         <td class="tdNowrap">浜у搧鍚嶇О锛�</td>
-        <td colspan="16">{{ itemTr.product_name }}</td>
+        <td colspan="17">{{ itemTr.product_name }}</td>
       </tr>
       <tr>
         <td rowspan='2'>搴忓彿</td>
+        <td rowspan='2'>缂栧彿</td>
         <td rowspan='2'>瀹�*楂�</td>
         <td rowspan='2'>鏁伴噺</td>
         <td rowspan='2'>闈㈢Н</td>
@@ -171,6 +224,7 @@
 
       <tr v-for="(itemDatile,index) in item.detailList" :key="index">
         <td>{{ itemDatile.order_number }}</td>
+        <td>{{itemDatile.s01Value}}</td>
         <td>{{ itemDatile.child_width }}</td>
         <td class="item">{{ itemDatile.quantity }}</td>
         <td>{{ itemDatile.total_area }}</td>
@@ -201,9 +255,9 @@
           鏁伴噺锛�
           <label>{{ itemsum.quantity }}</label>
           闈㈢Н锛�
-          <label>{{ parseFloat(itemsum.gross_area,2) }}</label>
+          <label>{{ parseFloat(itemsum.gross_area.toFixed(2)) }}</label>
           閲嶉噺锛�
-          <label>{{ itemsum.weight }}</label>
+          <label>{{ parseFloat(itemsum.weight.toFixed(2)) }}</label>
         </td>
       </tr>
       <tr v-for="(itemtextarea,index) in item.detail" :key="index">
@@ -227,28 +281,12 @@
         <td></td>
         <td></td>
         <td></td>
+        <td></td>
+        <td></td>
       </tr>
-<!--      <tr>-->
-<!--        <td>鎺ュ彈绛惧悕</td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--        <td></td>-->
-<!--      </tr>-->
       <tr>
         <td>鐢熶骇鏃ユ湡</td>
+        <td></td>
         <td></td>
         <td></td>
         <td></td>
@@ -284,39 +322,20 @@
         <td></td>
         <td></td>
         <td></td>
+        <td></td>
       </tr>
-      <!--      <tr>-->
-      <!--        <td>鏋跺瓙缂栧彿</td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--        <td></td>-->
-      <!--      </tr>-->
       <tr v-for="(qrCodeItem,index) in item.detail" :key="index">
-        <td rowspan="2">
-          <div class='qrCode' style="width: 80px;height: 80px;">
-            <img :src= qrCodeItem.qrcode>
-<!--            {{-->
-<!--              getUrl(qrCodeItem.process_id)-->
-<!--            }}-->
-
+        <td colspan="19">
+          <span style="display: flex;">
+            <span v-for="(qrCodeItems,index) in qrCodeItem.qrcodeList" :key="index" style="display: flex;width: 35%">
+            <div class='qrCode' style="width: 80px;height: 80px;">
+            <img :src=qrCodeItems.qrcode>
           </div>
-
-        </td>
-        <td colspan="16">
-          <span style="float: left;font-weight: bolder">{{ qrCodeItem.processIdNumber }}</span>
+          <span style="float: left;font-weight: bolder">{{
+              qrCodeItem.process_id + "/" + qrCodeItems.technologyNumber
+            }}</span>
+          </span>
+          </span>
         </td>
 
       </tr>
@@ -338,7 +357,6 @@
 }
 
 #printFlowCard {
-  margin-top: -40px;
   text-align: center;
 //font-weight: bolder; height: 600px;
 }
@@ -381,6 +399,11 @@
   font-weight: bolder;
 }
 
+@page {
+  size: auto;  /* auto is the initial value */
+  margin: 13mm 6mm 0mm 6mm  /* this affects the margin in the printer settings */
+
+}
 
 @media print {
 

--
Gitblit v1.8.0