From 3bfff48245e0eb8affcbf2a16fb2c75eb1cff8bb Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 14 四月 2025 11:10:40 +0800
Subject: [PATCH] 模拟计算发送数据处理

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue |  126 ++++++++++++++++++++++++++++++++---------
 1 files changed, 97 insertions(+), 29 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
index 6c189d8..6d5c173 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCardDetails.vue
@@ -20,6 +20,7 @@
 import companyInfo from "@/stores/sd/companyInfo"
 import {CircleCheck, Download, Printer} from "@element-plus/icons-vue/global";
 import TagStyleDesigner from "@/components/pp/TagStyleDesigner.vue";
+import {hiprint} from "vue-plugin-hiprint";
 
 const company = companyInfo()
 
@@ -140,6 +141,7 @@
   },
 ]
 let hidePrintLabels = company.printLabel.hideButton;
+let btnType = company.printBtn;
 
 if (hidePrintLabels == 'true') {
   filteredOptions = lableTypeOptions.filter((option, index) => index !== 2);
@@ -177,6 +179,39 @@
   printList: []
 })
 
+onMounted(async () => {
+  await getTags();
+  await hiprint.init();
+})
+let hiprintTemplate = ref()
+
+const tags = ref([])
+
+const tag = ref({
+  id: null,
+  name: null,
+  type: 1,
+  tagWidth: null,
+  tagHeight: null,
+  value: null,
+  size: null
+})
+
+const changeTag = () => {
+  hiprintTemplate.value = new hiprint.PrintTemplate({});
+  const json = JSON.parse(tag.value.value)
+  hiprintTemplate.value.update(json)
+}
+
+const getTags = () => {
+  request.get('tagStyle/getTagList').then(res => {
+    tags.value = res.data
+  })
+}
+const printObjectProcess = () => {
+  hiprintTemplate.value.print(lastList.value)
+}
+
 const {currentRoute} = useRouter()
 const route = currentRoute.value
 
@@ -188,6 +223,7 @@
 request.post(`/processCard/selectPrintDetails/${inquiryMode}/${type}`, data.value).then((res) => {
 
   if (res.code == 200) {
+    console.log(res.data.data)
     let newDataCollection = [];
     for (let i = 0; i < res.data.data.length; i++) {
       res.data.data[i].detail.forEach((item) => {
@@ -301,6 +337,20 @@
       filterMethod: filterChanged, width: 100
     },
     {
+      field: 'width',
+      title: t('order.width'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged, width: 100
+    },
+    {
+      field: 'height',
+      title: t('order.height'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged, width: 100
+    },
+    {
       field: 'glassNumber',
       title: t('reportingWorks.glassNumber'),
       filters: [{data: ''}],
@@ -403,12 +453,13 @@
     // selectRecords.forEach(obj => {
     //   delete obj.print_status;
     // });
-    let type = printType.value
+    let type = tag.value.name
     let faceOrientation = stateValue.value
     let lableTypes = lableType.value
     let lableTitle = lableType.text
     if ($grid) {
       switch (code) {
+        //鎵撳嵃娴佺▼鍗�
         case 'print': {
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
@@ -430,7 +481,7 @@
           dialogTableVisible.value = true
           break
         }
-
+        //鏍囩鎵撳嵃 甯稿窞
         case 'printLabel': {
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
@@ -452,6 +503,7 @@
 
           break
         }
+        //鏍囩鎵撳嵃2 甯稿窞
         case 'printLabel2': {
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
@@ -501,6 +553,7 @@
           })
           break
         }
+        //鑷畾涔夋垚鍝佹爣绛炬墦鍗�
         case 'customLabel': {
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
@@ -519,8 +572,8 @@
               id += selectRecords[i].id + "|"
             }
           }
+          //鎴愬搧鏍囩1
           if (lableTypes == 1) {
-            console.log(company.label)
             labelRow.value.list = JSON.stringify(selectRecords)
             labelRow.value.faceOrientation = faceOrientation
             labelRow.value.type = type
@@ -528,7 +581,9 @@
             lastList.value = []
             if (company.label === 1) {
               dialogTableVisibleLabel.value = true
-            } else if (company.label === 2) {
+            }
+            //甯稿窞椤圭洰
+            else if (company.label === 2) {
               router.push({
                 path: '/main/processCard/PrintCustomLabelCZ',
                 query: {
@@ -541,7 +596,9 @@
               })
             }
 
-          } else if (lableTypes == 2) {
+          }
+          //鎴愬搧鏍囩2
+          else if (lableTypes == 2) {
             labelRow.value.list = JSON.stringify(selectRecords)
             labelRow.value.faceOrientation = faceOrientation
             labelRow.value.type = type
@@ -549,7 +606,9 @@
             lastList.value = []
             if (company.label === 1) {
               dialogTableVisibleCustomLabel.value = true
-            } else if (company.label === 2) {
+            }
+            //甯稿窞椤圭洰
+            else if (company.label === 2) {
               router.push({
                 path: '/main/processCard/PrintCustomLabelSemiCZ',
                 query: {
@@ -561,7 +620,9 @@
                 }
               })
             }
-          } else if (lableTypes == 3) {
+          }
+          //鎴愬搧鏍囩3
+          else if (lableTypes == 3) {
             router.push({
               path: '/main/processCard/PrintLabel1',
               query: {
@@ -639,7 +700,7 @@
             ElMessage.warning(t('searchOrder.msgList.checkOrder'))
             return
           }
-          if (type === null || type === '' || type === undefined) {
+          if (tag.value.name === null || tag.value.name === '' || tag.value.name === undefined) {
             ElMessage.warning(t('processCard.pleaseSelectCustomPrintLabelStyle'))
             return
           }
@@ -655,7 +716,7 @@
 
           labelRow.value.list = JSON.stringify(selectRecords)
           labelRow.value.faceOrientation = faceOrientation
-          labelRow.value.type = type
+          labelRow.value.type = tag.value.name
           labelRow.value.lableType = lableTypes
           labelRow.value.dataType = 1
           let columnsLabel = company.printLabel.columnsLabel
@@ -697,24 +758,32 @@
 }
 
 const hideButton = () => {
-  // 鏍规嵁鏉′欢鍊� hidePrintLabels 杩囨护鎸夐挳鏁扮粍
   gridOptions.toolbarConfig.buttons = gridOptions.toolbarConfig.buttons.filter(button => {
-    // 杩欓噷鏍规嵁 hidePrintLabels 鐨勫�煎喅瀹氭槸鍚﹂殣钘� printLabel 鍜� printLabel2
-    if (hidePrintLabels == 'true') {
-      return button.code !== 'printLabel' && button.code !== 'printLabel2';
-    } else {
-      return true && button.code !== 'printLike' && button.code !== 'printLabel3' && button.code !== 'printTest'; // 鏄剧ず璇ユ寜閽�
+    // 濡傛灉 type 涓嶄负绌烘椂锛岄殣钘� print 鎸夐挳
+    if (btnType == 1 && button.code === 'print') {
+      return false;  // 闅愯棌 print 鎸夐挳
     }
-  })
-}
+
+    // 鏍规嵁 hidePrintLabels 鐨勫�煎垽鏂槸鍚﹂殣钘� printLabel銆乸rintLabel2 鍜� customLabel
+    if (hidePrintLabels == 'true') {
+      return button.code !== 'printLabel' && button.code !== 'printLabel2' && button.code !== 'customLabel';
+    } else {
+      // 濡傛灉 hidePrintLabels 涓嶆槸 'true'锛屽垯闅愯棌 printLike銆乸rintLabel3 鍜� printTest
+      return button.code !== 'printLike' && button.code !== 'printLabel3' && button.code !== 'printTest';
+    }
+
+    // 榛樿杩斿洖 true锛岃〃绀轰繚鐣欐寜閽�
+    return true;
+  });
+};
 
 
-// 鐩戝惉鎵撳嵃瀹屾垚浜嬩欢
+
+// 鐩戝惉鎵撳嵃娆℃暟浜嬩欢
 const printNumber = () => {
 
   selectRecordsData.value.printList = selectRecords
-  let printState = 0
-  request.post(`/processCard/updatePrintState/${printState}`, selectRecordsData.value).then((res) => {
+  request.post(`/processCard/updatePrintNumber`, selectRecordsData.value).then((res) => {
     if (res.code == 200 && res.data === true) {
     } else {
 
@@ -723,7 +792,6 @@
     }
   })
 }
-
 </script>
 
 <template>
@@ -733,13 +801,12 @@
                 style="width: 90px"></el-input>
       &nbsp;
       <label>{{ $t('processCard.labelStyle') }}锛�</label>
-      <el-select v-model="printType" :placeholder="$t('processCard.pleaseSelect')" clearable default-value="default_city"
-                 style="width: 120px">
+      <el-select v-model="tag" :placeholder="$t('processCard.pleaseSelect')" style="width: 140px" @change="changeTag">
         <el-option
-            v-for="item in titleSelectJson['dataType']"
-            :key="item.id"
-            :label="item.name"
-            :value="item.name"
+            v-for="(tag,index) in tags"
+            :key="index"
+            :label="tag.name"
+            :value="tag"
         />
       </el-select>
       &nbsp;
@@ -842,7 +909,7 @@
         destroy-on-close
         style="width: 80%;height:75% ">
       <template #header="{ close, titleId, titleClass }">
-        <el-button v-print="printContentLabel" :icon="Printer" circle/>
+        <el-button v-print="printContentLabel" :icon="Printer" circle @click="printNumber"/>
       </template>
       <print-custom-label id="childLabel"
                           :faceOrientation="labelRow.faceOrientation"
@@ -907,12 +974,13 @@
         destroy-on-close
         style="width: 80%;height:75% ">
       <template #header="{ close, titleId, titleClass }">
-        <el-button v-print="printContentLabel" :icon="Printer" circle/>
+        <el-button :icon="Printer" circle @click="printObjectProcess"/>
       </template>
       <print-custom-label-x-j id="childLabel"
                               :faceOrientation="labelRow.faceOrientation"
                               :lableType="labelRow.lableType"
                               :list="labelRow.list"
+                              :lastList='lastList'
                               :type="labelRow.type"
                               style="width: 100%;height: 100%"/>
     </el-dialog>

--
Gitblit v1.8.0