From fcbce36f8734813b13c8f9c5b26b4bd192274534 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 17 十一月 2025 16:30:28 +0800
Subject: [PATCH] 工程打印明细新增玻璃编号显示

---
 north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetailSmallPiece.vue |  515 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 515 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetailSmallPiece.vue b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetailSmallPiece.vue
new file mode 100644
index 0000000..50f20df
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/views/pp/processCard/PrintProjectDetailSmallPiece.vue
@@ -0,0 +1,515 @@
+<script setup>
+
+import request from "@/utils/request"
+import deepClone from "@/utils/deepClone"
+import {ElDatePicker, ElMessage} from "element-plus"
+import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
+import {useRouter} from 'vue-router'
+import {useI18n} from 'vue-i18n'
+import {changeFilterEvent, filterChanged} from "@/hook"
+import {VXETable} from "vxe-table";
+import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove";
+import PrintProcess from '@/components/pp/PrintProcess.vue'
+import PrintLabel from '@/views/pp/processCard/PrintLabel.vue'
+import PrintCustomLabel from '@/components/pp/PrintCustomLabelDetails.vue'
+import PrintCustomLabelSemi from '@/components/pp/PrintCustomLabelSemi.vue'
+import PrintCustomLabelXJ from '@/components/pp/PrintCustomLabelTwo.vue'
+import PrintCustomLabelXJTwo from '@/components/pp/PrintCustomLabelXJTwo.vue'
+import PrintCustomLabelProject from '@/components/pp/PrintCustomLabelProject.vue'
+import SortDetail from '@/components/pp/SelectSortDetailProcessCard.vue'
+import footSum from "@/hook/footSum"
+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";
+import QueuePrinter from "@/hook/queue"
+import TagStyleSet from "@/hook/tagStyleSet";
+import {createTemplate} from "@/hook/createTemplateTag";
+
+const company = companyInfo()
+
+
+//璇█鑾峰彇
+const {t} = useI18n()
+let router = useRouter()
+const dialogTableVisible = ref(false)
+const dialogTableVisibleLabel = ref(false)
+const dialogTableVisibleCustomLabel = ref(false)
+const dialogTableVisibleLabelXJ = ref(false)
+const dialogTableVisibleLabelXJTwo = ref(false)
+const dialogTableVisibleLabelProject = ref(false)
+const printVisible = ref(false)
+let selectRecords = ref(null)
+let titleStyleVisible = ref(false)
+let lastList = ref([])
+const selectRecordsData = ref({
+  printList: []
+})
+
+const xGrid = ref(null)
+const xGridDetail = ref(null)
+
+
+
+const tagType = ref()
+
+//鎺掑簭
+let editRow = ref({
+  processId: null,
+  technologyNumber: null,
+  process: null
+})
+
+//鎵撳嵃
+let printRow = ref({
+  list: null,
+  printMergeVal: null,
+  like: null
+})
+
+//鏍囩
+let labelRow = ref({
+  list: null,//鍕鹃�夌殑鏁版嵁
+  faceOrientation: null,//鍐呭闈�
+  type: null,//鏍囩妯℃澘
+  lableType: null,//鏍囩绫诲瀷
+  dataType: null,//鏍囩绫诲瀷
+  detailType: 0//鏄惁鏄伐绋嬫槑缁嗘墦鍗�
+})
+
+
+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({});
+  hiprintTemplate.value.design("#hiprint-printTemplate2",{grid:true});
+  const json = tag.value.value
+  hiprintTemplate.value.update(json)
+}
+//鏍囩绫诲瀷
+const lableType = ref('1')
+
+//鍚堢墖娴佺▼鍗℃墦鍗颁笅鎷夐�夐」
+
+const printContent = ref({
+  id: 'child',
+
+})
+
+const printContentLabel = ref({
+  id: 'childLabel',
+})
+
+
+//鎵撳嵃绫诲瀷
+const printType = ref()
+
+//瀹氫箟鎺ユ敹鍔犺浇琛ㄥご涓嬫媺鏁版嵁
+const titleSelectJson = ref({
+  dataType: [],
+})
+
+const data = ref({
+  printList: []
+})
+
+const getTags = () => {
+  request.get('tagStyle/getTagList').then(res => {
+    res.data.forEach(item => {
+      item.value = JSON.parse(item.value)
+    })
+    tags.value = res.data
+  })
+}
+
+const {currentRoute} = useRouter()
+const route = currentRoute.value
+
+let projectNo = route.query.projectNo
+let stockId = route.query.stockId
+let flowData=ref({
+  projectNo:projectNo,
+  stockId:stockId
+})
+
+// 绗竴娆″姞杞芥煡璇�
+request.post(`/processCard/selectPrintProjectDetailSmallPiece`,flowData.value).then((res) => {
+
+  if (res.code == 200) {
+    xGrid.value.reloadData(res.data.data)
+    gridOptions.loading = false
+  } else {
+    ElMessage.warning(res.msg)
+  }
+}).catch(err => {
+  console.log('璇锋眰鍦板潃閿欒锛�', err.config.url);
+  console.log('閿欒璇︽儏锛�', err);
+});
+
+
+//琛ㄥ熬姹傚拰
+const sumNum = (list, field) => {
+  let count = 0
+  list.forEach(item => {
+    count += Number(item[field])
+  })
+  return count.toFixed(2)
+}
+
+
+const hasDecimal = (value) => {
+  const regex = /\./; // 瀹氫箟姝e垯琛ㄨ揪寮忥紝鏌ユ壘灏忔暟鐐�
+  return regex.test(value); // 杩斿洖true/false
+}
+
+
+const gridOptions = reactive({
+  loading: true,
+  border: "full",//琛ㄦ牸鍔犺竟妗�
+  keepSource: true,//淇濇寔婧愭暟鎹�
+  align: 'center',//鏂囧瓧灞呬腑
+  stripe: true,//鏂戦┈绾�
+  rowConfig: {isCurrent: true, isHover: true, height: 30},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒
+  id: 'printFlowCard_1',
+  showFooter: true,//鏄剧ず鑴�
+  printConfig: {},
+  importConfig: {},
+  exportConfig: {},
+  scrollX: {enabled: true},
+  scrollY: {enabled: true, gt: 0},//寮�鍚櫄鎷熸粴鍔�
+  showOverflow: true,
+  columnConfig: {
+    resizable: true,
+    useKey: true
+  },
+  filterConfig: {   //绛涢�夐厤缃」
+                    // remote: true
+  },
+  customConfig: {
+    storage: true
+  },
+  editConfig: {
+    trigger: 'click',
+    mode: 'row',
+    showStatus: true
+  },//琛ㄥご鍙傛暟
+  columns: [
+    {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
+    {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
+    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
+    {
+      field: 'project_no',
+      title: t('ingredientsStock.projectNo'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'stock_id',
+      title: t('processCard.layoutNumber'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'polys_id',
+      title: t('灏忕墖搴忓彿'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'glass_id',
+      title: t('鐜荤拑缂栧彿'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'o_width',
+      title: t('order.width'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+    {
+      field: 'o_height',
+      title: t('order.height'),
+      filters: [{data: ''}],
+      slots: {filter: 'num1_filter'},
+      filterMethod: filterChanged
+    },
+  ],//琛ㄥご鎸夐挳
+
+  toolbarConfig: {
+    buttons: [
+      {code: 'printLabel3', name: t('basicData.print'), status: 'primary'},
+    ],
+    zoom: true,
+    custom: true
+  },
+  data: null,//琛ㄦ牸鏁版嵁
+  //鑴氶儴姹傚拰
+  footerMethod({columns, data}) {//椤佃剼鍑芥暟
+    return [
+      columns.map((column, columnIndex) => {
+        if (columnIndex === 0) {
+          return t('basicData.total')
+        }
+        const List = ["glass_count"]
+        if (List.includes(column.field)) {
+          return footSum(data, column.field)
+        }
+        return ''
+      })
+    ]
+  },
+})
+
+const gridEvents = {
+  toolbarButtonClick({code}) {
+    const $grid = xGrid.value
+    selectRecords = $grid.getCheckboxRecords()
+    let type = printType.value
+    let faceOrientation = ''
+    let lableTypes = lableType.value
+    let lableTitle = lableType.text
+    if ($grid) {
+      switch (code) {
+        case 'printLabel3': {
+          if (selectRecords === null || selectRecords === '' || selectRecords.length === 0) {
+            ElMessage.warning(t('processCard.projectMsg1'))
+            return
+          }
+          if (tag.value.name == null || tag.value.name == '') {
+            ElMessage.warning(t('processCard.projectMsg2'))
+            return
+          }
+          let name = company.companyName
+          labelRow.value.list = JSON.stringify(selectRecords)
+          if (name == '鏂扮枂鎭掗懌鐜荤拑绉戞妧鏈夐檺鍏徃') {
+            labelRow.value.type = '鎭掗懌甯︽暟閲�'
+            labelRow.value.dataType = 3
+            dialogTableVisibleLabelXJTwo.value = true
+          } else {
+            labelRow.value.type = tag.value.name
+            labelRow.value.dataType = 3
+            labelRow.value.lableType = lableTypes
+            labelRow.value.switch = true
+            lastList.value = []
+            dialogTableVisibleLabelProject.value = true
+          }
+          break
+        }
+      }
+    }
+  },
+}
+
+
+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>
+
+<template>
+  <div class="main-div-customer">
+    <div>
+      <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"
+            :label="tag.name"
+            :value="tag"
+        />
+      </el-select>
+    </div>
+    <vxe-grid
+        ref="xGrid"
+        class="mytable-scrollbar"
+        height="100%"
+        v-bind="gridOptions"
+        v-on="gridEvents"
+
+
+    >
+      <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
+      <!--      涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�-->
+      <template #content="{ row }">
+        <ul class="expand-wrapper">
+          <li v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
+            <span style="font-weight: bold">{{ item.title + ':  ' }}</span>
+            <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span>
+            <span v-else>{{ row[item.field] }}</span>
+
+          </li>
+        </ul>
+      </template>
+
+      <template #num1_filter="{ column, $panel }">
+        <div>
+          <div v-for="(option, index) in column.filters" :key="index">
+            <input v-model="option.data"
+                   type="text"
+                   @input="changeFilterEvent($event, option, $panel)"
+                   @keyup.enter.native="$panel.confirmFilter()"/>
+          </div>
+        </div>
+      </template>
+
+
+    </vxe-grid>
+
+    <!--    鎴愬搧鏍囩涓ゅ垪鏂扮枂-->
+    <el-dialog
+        id="sizeCustom"
+        v-model="dialogTableVisibleLabelXJTwo"
+        :title="$t('processCard.printLabel')"
+        destroy-on-close
+        style="width: 80%;height:75% ">
+      <template #header="{ close, titleId, titleClass }">
+        <el-button v-print="printContentLabel" :icon="Printer" circle/>
+      </template>
+      <print-custom-label-x-j-two id="childLabel"
+                                  :dataType="labelRow.dataType"
+                                  :faceOrientation="labelRow.faceOrientation"
+                                  :lableType="labelRow.lableType"
+                                  :list="labelRow.list"
+                                  :type="labelRow.type"
+                                  style="width: 100%;height: 100%"/>
+    </el-dialog>
+
+    <!--    鎴愬搧鏍囩宸ョ▼鎵撳嵃-->
+    <el-dialog
+        id="sizeCustom"
+        v-model="dialogTableVisibleLabelProject"
+        :title="$t('processCard.printLabel')"
+        destroy-on-close
+        style="width: 80%;height:75% ">
+      <template #header="{ close, titleId, titleClass }">
+<!--        <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"
+                                  :lastList='lastList'
+                                  :list="labelRow.list"
+                                  :switch="labelRow.switch"
+                                  :titleList="labelRow.titleList"
+                                  :type="labelRow.type"
+
+                                  style="width: 100%;height: 100%"/>
+    </el-dialog>
+  </div>
+</template>
+
+<style scoped>
+.main-div-customer {
+  width: 99%;
+  height: 92%;
+}
+
+
+:deep(#sizeCheck .el-dialog__body) {
+  height: 90%;
+  width: 100%;
+  overflow-y: auto;
+}
+
+:deep(#sizePrintCalrd .el-dialog__body) {
+  height: 85%;
+  width: 100%;
+  overflow-y: auto;
+}
+
+:deep(#sizeCustom .el-dialog__body) {
+  height: 85%;
+  width: 100%;
+  overflow-y: auto;
+}
+
+:deep(#sizeCustomSemi .el-dialog__body) {
+  height: 85%;
+  width: 100%;
+  overflow-y: auto;
+}
+
+:deep(#titleStyle .el-dialog__body) {
+  height: 85%;
+  width: 100%;
+  overflow-y: auto;
+}
+
+</style>
\ No newline at end of file

--
Gitblit v1.8.0