| | |
| | | import companyInfo from "@/stores/sd/companyInfo" |
| | | import PrintCustomLabel from '@/components/pp/PrintCustomLabelDetails.vue' |
| | | import PrintCustomLabelSemi from '@/components/pp/PrintCustomLabelSemi.vue' |
| | | import {Printer} from "@element-plus/icons-vue/global"; |
| | | import {View} from "@element-plus/icons-vue"; |
| | | import {Printer} from "@element-plus/icons-vue/global" |
| | | import {View} from "@element-plus/icons-vue" |
| | | import QueuePrinter from "@/hook/queue" |
| | | |
| | | const { t } = useI18n() |
| | | const company = companyInfo() |
| | |
| | | await getTags() |
| | | |
| | | await hiprint.init({ |
| | | //host: 'http://10.153.19.26:17521', |
| | | providers: [new TagStyleSet(TgaStyleSet.value)] |
| | | }); |
| | | |
| | |
| | | |
| | | // 构建一个设计模板,指定容器,是否开启网格展示 |
| | | hiprintTemplate.value.design("#hiprint-printTemplate",{grid:true}); |
| | | |
| | | //document.querySelector(".hiprint-option-item-field .auto-submit").appendChild('<option value="Arial">Arial</option>') |
| | | //未连接 则进行连接打印服务器 |
| | | if (!hiprint.hiwebSocket.opened) { |
| | | hiprint.hiwebSocket.setHost("http://localhost:17521") |
| | | } |
| | | }; |
| | | |
| | | |
| | |
| | | }).then(({ value }) => { |
| | | tag.value.name = value |
| | | let json = $ref(hiprintTemplate.value.getJson()) |
| | | if(json.panels[0].printElements[0].options.field==='table' && json.panels[0].printElements.length===1){ |
| | | const tableFlag = json.panels[0].printElements.filter(item => item.options.field==='table') |
| | | |
| | | if(tableFlag.length===1 && json.panels[0].printElements.length===1){ |
| | | let funct = "function(value,row,index,options){return `" |
| | | json.panels[0].printElements[0].options.columns[0].forEach(item => { |
| | | if(item.field){ |
| | |
| | | }) |
| | | funct+='`}' |
| | | json.panels[0].printElements[0].options.columns[0][0].renderFormatter = funct |
| | | }else{ |
| | | }else if(json.panels[0].printElements.length>1 && tableFlag.length>0){ |
| | | ElMessage.warning('保存失败,请检查是否只有一个表格') |
| | | return |
| | | } |
| | |
| | | |
| | | const printOrder = (type) => { |
| | | const list = hiprintTemplate.value.getJson() |
| | | |
| | | list.panels[0].printElements.forEach(element => { |
| | | element.options.fontFamily = 'Arial' |
| | | }) |
| | | let object = 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(type===1){ |
| | | hiprintTemplate.value.print2(object) |
| | | const queuePrinter = new QueuePrinter( object,hiprintTemplate,columnsNum) |
| | | queuePrinter.tick |
| | | }else{ |
| | | hiprintTemplate.value.print(object) |
| | | } |
| | |
| | | destroy-on-close |
| | | style="width: 80%;height:75% "> |
| | | <template #header="{ close, titleId, titleClass }"> |
| | | <el-button @click="printOrder(1)" :icon="Printer" circle/> |
| | | <el-button @click="printOrder(2)" :icon="View" circle/> |
| | | <el-button @click="printOrder(1)" :icon="Printer" circle/> |
| | | |
| | | </template> |
| | | <print-custom-label id="childLabel" |
| | | destroy-on-close |