chenlu
2025-09-15 7a128bd5a585fd007f75c135b3fe53d1d147748a
north-glass-erp/northglass-erp/src/views/pp/replenish/PrintReplenishFlowCard.vue
@@ -23,6 +23,7 @@
import QueuePrinter from "@/hook/queue";
import PrintCustomLabelProject from "@/components/pp/PrintCustomLabelProject.vue";
import PrintProcessConsolidated from '@/components/pp/PrintConsolidatedReplenish.vue'
import {createTemplate} from "@/hook/createTemplateTag";
const company = companyInfo()
//语言获取
const {t} = useI18n()
@@ -48,6 +49,7 @@
  value: null,
  size: null
})
let hiprintTemplate = ref(null)
let lastList = ref([])
const getTableRow = (row,type) =>{
  switch (type) {
@@ -176,6 +178,7 @@
onMounted(async () => {
  await getTags();
  await hiprint.init();
})
//打印类型
@@ -691,16 +694,20 @@
  })
}
const getTags = () => {
  request.get('tagStyle/getTagList').then(res => {
    tags.value = res.data
  })
}
let hiprintTemplate = ref()
const changeTag = () => {
  hiprintTemplate.value = new hiprint.PrintTemplate({});
  const json = JSON.parse(tag.value.value)
  hiprintTemplate.value.design("#hiprint-printTemplate1",{grid:true});
  const json = tag.value.value
  hiprintTemplate.value.update(json)
}
const getTags = () => {
  request.get('tagStyle/getTagList').then(res => {
    res.data.forEach(item => {
      item.value = JSON.parse(item.value)
    })
    tags.value = res.data
  })
}
// 监听打印完成事件
@@ -719,16 +726,35 @@
}
const printOrder = (type) => {
  const list = hiprintTemplate.value.getJson()
  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
      }
    }
  })
  let object =  lastList.value
  //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)
@@ -878,7 +904,24 @@
        destroy-on-close
        style="width: 80%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-tooltip
            class="box-item"
            effect="dark"
            :content="$t('processCard.yesTitle')"
            placement="top"
        >
        <el-button :icon="Printer" circle @click="printOrder(1)"/>
        </el-tooltip>
        <el-tooltip
            class="box-item"
            effect="dark"
            :content="$t('processCard.noTitle')"
            placement="top"
        >
          <el-button @click="printOrder(3)">
            <i class="vxe-icon-print"></i>
          </el-button>
        </el-tooltip>
      </template>
      <print-custom-label id="childLabel"
                                  :detailType="labelRow.detailType"