| | |
| | | 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() |
| | |
| | | value: null, |
| | | size: null |
| | | }) |
| | | let hiprintTemplate = ref(null) |
| | | let lastList = ref([]) |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | |
| | | |
| | | onMounted(async () => { |
| | | await getTags(); |
| | | await hiprint.init(); |
| | | }) |
| | | |
| | | //打印类型 |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 |
| | | }) |
| | | } |
| | | |
| | | // 监听打印完成事件 |
| | |
| | | } |
| | | |
| | | 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) |
| | | |
| | |
| | | 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" |