From 25cc86fd8a2fb3b2bb6b385cba0adaf89ff3dcdc Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 18 十二月 2025 16:39:32 +0800
Subject: [PATCH] 流程卡进度打印部分代码

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetails.vue |  103 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 87 insertions(+), 16 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetails.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetails.vue
index b250c7e..2297eb0 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetails.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetails.vue
@@ -24,6 +24,7 @@
 import {hiprint} from "vue-plugin-hiprint";
 import QueuePrinter from "@/hook/queue"
 import TagStyleSet from "@/hook/tagStyleSet";
+import {createTemplate} from "@/hook/createTemplateTag";
 
 const company = companyInfo()
 
@@ -48,7 +49,7 @@
 const xGrid = ref(null)
 const xGridDetail = ref(null)
 
-const tags = ref([])
+
 
 const tagType = ref()
 
@@ -80,15 +81,14 @@
 onMounted(async () => {
   await getTags();
   await hiprint.init();
+
 })
 let hiprintTemplate = ref()
 
 
-const changeTag = () => {
-  hiprintTemplate.value = new hiprint.PrintTemplate({});
-  const json = JSON.parse(tag.value.value)
-  hiprintTemplate.value.update(json)
-}
+
+
+const tags = ref([])
 
 const tag = ref({
   id: null,
@@ -100,6 +100,12 @@
   size: null
 })
 
+const changeTag = () => {
+  hiprintTemplate.value = new hiprint.PrintTemplate({});
+  hiprintTemplate.value.design("#hiprint-printTemplate2",{grid:true});
+  const json = tag.value.value
+  hiprintTemplate.value.update(json)
+}
 //鏍囩绫诲瀷
 const lableType = ref('1')
 
@@ -129,6 +135,9 @@
 
 const getTags = () => {
   request.get('tagStyle/getTagList').then(res => {
+    res.data.forEach(item => {
+      item.value = JSON.parse(item.value)
+    })
     tags.value = res.data
   })
 }
@@ -142,7 +151,7 @@
 request.post(`/processCard/selectPrintProjectDetails/${projectNo}`).then((res) => {
 
   if (res.code == 200) {
-    xGrid.value.loadData(res.data.data)
+    xGrid.value.reloadData(res.data.data)
     gridOptions.loading = false
   } else {
     ElMessage.warning(res.msg)
@@ -209,7 +218,7 @@
     },
     {
       field: 'stock_id',
-      title: '鐗堝浘鍙�',
+      title: t('processCard.layoutNumber'),
       filters: [{data: ''}],
       slots: {filter: 'num1_filter'},
       filterMethod: filterChanged
@@ -226,6 +235,7 @@
   toolbarConfig: {
     buttons: [
       {code: 'printLabel3', name: t('basicData.print'), status: 'primary'},
+      {code: 'printSmallPiece', name: t('灏忕墖鎵撳嵃'), status: 'primary'},
     ],
     zoom: true,
     custom: true
@@ -260,11 +270,11 @@
       switch (code) {
         case 'printLabel3': {
           if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
-            ElMessage.warning(t('璇烽�夋嫨宸ョ▼瀵瑰簲鐨勭増鍥惧彿'))
+            ElMessage.warning(t('processCard.projectMsg1'))
             return
           }
           if (tag.value.name == null || tag.value.name == '') {
-            ElMessage.warning(t('璇烽�夋嫨鏍囩妯℃澘'))
+            ElMessage.warning(t('processCard.projectMsg2'))
             return
           }
           let name = company.companyName
@@ -283,14 +293,57 @@
           }
           break
         }
+        case 'printSmallPiece': {
+          if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
+            ElMessage.warning(t('processCard.projectMsg1'))
+            return
+          }
+          let stock_id=[]
+          for (let i=0;i<selectRecords.length;i++){
+              stock_id.push(selectRecords[i].stock_id)
+          }
+          console.log(stock_id)
+          router.push({path: '/main/processCard/printProjectDetailSmallPiece', query: {projectNo: projectNo,stockId:JSON.stringify(stock_id)}})
+          break
+        }
       }
     }
   },
 }
 
 
-const printObjectProcess = () => {
-  hiprintTemplate.value.print(lastList.value)
+const printObjectProcess = (type) => {
+  const list = tag.value.value
+  list.panels[0].printElements.forEach(element => {
+    element.options.fontFamily = 'Arial'
+    if( element.options.field !== undefined){
+      if(type===3 ){
+        element.options.hideTitle = true
+      }
+    }
+    if(type!==3){
+      element.options.hideTitle = false
+      if( element.options.field === undefined){
+        element.options.hideTitle = true
+      }
+    }
+  })
+
+  //hiprintTemplate.value.update(list)
+  let object =  JSON.parse(JSON.stringify(lastList.value))
+  //鍒ゆ柇鏄惁涓鸿〃鏍�
+  let columnsNum = null
+  if(list.panels[0].printElements[0].options.field==='table'){
+    object = {table:lastList.value}
+    columnsNum = (list.panels[0].printElements[0].options.gridColumns || 1)
+  }
+  //鍒ゆ柇鏄惁鏈� 宓屽鑷畾涔夌焊寮�
+  if(tag.value.tagHeight && tag.value.tagWidth){
+    const print =createTemplate(list,object,tag.value.tagWidth,tag.value.tagHeight)
+    hiprintTemplate.value.update(print.template)
+    object = print.printData
+  }
+  hiprintTemplate.value.print(object)
 }
 
 </script>
@@ -298,8 +351,8 @@
 <template>
   <div class="main-div-customer">
     <div>
-      鏍囩妯℃澘锛�
-      <el-select v-model="tag" placeholder="鏍囩妯℃澘鍒楄〃" style="width: 140px" @change="changeTag">
+      <label>{{ $t('processCard.labelStyle') }}锛�</label>
+      <el-select v-model="tag" :placeholder="$t('processCard.pleaseSelect')" style="width: 140px" @change="changeTag">
         <el-option
             v-for="(tag,index) in tags"
             :key="index"
@@ -371,10 +424,28 @@
         destroy-on-close
         style="width: 80%;height:75% ">
       <template #header="{ close, titleId, titleClass }">
-        <el-button :icon="Printer" circle @click="printObjectProcess"/>
+<!--        <el-button :icon="Printer" circle @click="printObjectProcess(1)"/>-->
+<!--        <el-button @click="printObjectProcess(3)"  >{{ $t('processCard.noTitle') }}</el-button>-->
+        <el-tooltip
+            class="box-item"
+            effect="dark"
+            :content="$t('processCard.yesTitle')"
+            placement="top"
+        >
+          <el-button :icon="Printer" circle @click="printObjectProcess(1)"/>
+        </el-tooltip>
+        <el-tooltip
+            class="box-item"
+            effect="dark"
+            :content="$t('processCard.noTitle')"
+            placement="top"
+        >
+          <el-button @click="printObjectProcess(3)">
+            <i class="vxe-icon-print"></i>
+          </el-button>
+        </el-tooltip>
       </template>
       <print-custom-label-project id="childLabel"
-
                                   :detailType="labelRow.detailType"
                                   :faceOrientation="labelRow.faceOrientation"
                                   :lableType="labelRow.lableType"

--
Gitblit v1.8.0