| | |
| | | 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"; |
| | | |
| | | const company = companyInfo() |
| | | |
| | |
| | | }, |
| | | ] |
| | | let hidePrintLabels = company.printLabel.hideButton; |
| | | let btnType = company.printBtn; |
| | | |
| | | if (hidePrintLabels == 'true') { |
| | | filteredOptions = lableTypeOptions.filter((option, index) => index !== 2); |
| | |
| | | printList: [] |
| | | }) |
| | | |
| | | 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({}); |
| | | const json = JSON.parse(tag.value.value) |
| | | hiprintTemplate.value.update(json) |
| | | } |
| | | |
| | | const getTags = () => { |
| | | request.get('tagStyle/getTagList').then(res => { |
| | | tags.value = res.data |
| | | }) |
| | | } |
| | | const printObjectProcess = () => { |
| | | hiprintTemplate.value.print(lastList.value) |
| | | } |
| | | |
| | | const {currentRoute} = useRouter() |
| | | const route = currentRoute.value |
| | | |
| | |
| | | request.post(`/processCard/selectPrintDetails/${inquiryMode}/${type}`, data.value).then((res) => { |
| | | |
| | | if (res.code == 200) { |
| | | console.log(res.data.data) |
| | | let newDataCollection = []; |
| | | for (let i = 0; i < res.data.data.length; i++) { |
| | | res.data.data[i].detail.forEach((item) => { |
| | |
| | | filterMethod: filterChanged, width: 100 |
| | | }, |
| | | { |
| | | field: 'width', |
| | | title: t('order.width'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged, width: 100 |
| | | }, |
| | | { |
| | | field: 'height', |
| | | title: t('order.height'), |
| | | filters: [{data: ''}], |
| | | slots: {filter: 'num1_filter'}, |
| | | filterMethod: filterChanged, width: 100 |
| | | }, |
| | | { |
| | | field: 'glassNumber', |
| | | title: t('reportingWorks.glassNumber'), |
| | | filters: [{data: ''}], |
| | |
| | | // selectRecords.forEach(obj => { |
| | | // delete obj.print_status; |
| | | // }); |
| | | let type = printType.value |
| | | let type = tag.value.name |
| | | let faceOrientation = stateValue.value |
| | | let lableTypes = lableType.value |
| | | let lableTitle = lableType.text |
| | |
| | | } |
| | | } |
| | | if (lableTypes == 1) { |
| | | console.log(company.label) |
| | | labelRow.value.list = JSON.stringify(selectRecords) |
| | | labelRow.value.faceOrientation = faceOrientation |
| | | labelRow.value.type = type |
| | |
| | | ElMessage.warning(t('searchOrder.msgList.checkOrder')) |
| | | return |
| | | } |
| | | if (type === null || type === '' || type === undefined) { |
| | | if (tag.value.name === null || tag.value.name === '' || tag.value.name === undefined) { |
| | | ElMessage.warning(t('processCard.pleaseSelectCustomPrintLabelStyle')) |
| | | return |
| | | } |
| | |
| | | |
| | | labelRow.value.list = JSON.stringify(selectRecords) |
| | | labelRow.value.faceOrientation = faceOrientation |
| | | labelRow.value.type = type |
| | | labelRow.value.type = tag.value.name |
| | | labelRow.value.lableType = lableTypes |
| | | labelRow.value.dataType = 1 |
| | | let columnsLabel = company.printLabel.columnsLabel |
| | |
| | | } |
| | | |
| | | const hideButton = () => { |
| | | // 根据条件值 hidePrintLabels 过滤按钮数组 |
| | | gridOptions.toolbarConfig.buttons = gridOptions.toolbarConfig.buttons.filter(button => { |
| | | // 这里根据 hidePrintLabels 的值决定是否隐藏 printLabel 和 printLabel2 |
| | | if (hidePrintLabels == 'true') { |
| | | return button.code !== 'printLabel' && button.code !== 'printLabel2'; |
| | | } else { |
| | | return true && button.code !== 'printLike' && button.code !== 'printLabel3' && button.code !== 'printTest'; // 显示该按钮 |
| | | // 如果 type 不为空时,隐藏 print 按钮 |
| | | if (btnType == 1 && button.code === 'print') { |
| | | return false; // 隐藏 print 按钮 |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 根据 hidePrintLabels 的值判断是否隐藏 printLabel、printLabel2 和 customLabel |
| | | if (hidePrintLabels == 'true') { |
| | | return button.code !== 'printLabel' && button.code !== 'printLabel2' && button.code !== 'customLabel'; |
| | | } else { |
| | | // 如果 hidePrintLabels 不是 'true',则隐藏 printLike、printLabel3 和 printTest |
| | | return button.code !== 'printLike' && button.code !== 'printLabel3' && button.code !== 'printTest'; |
| | | } |
| | | |
| | | // 默认返回 true,表示保留按钮 |
| | | return true; |
| | | }); |
| | | }; |
| | | |
| | | |
| | | // 监听打印完成事件 |
| | | |
| | | // 监听打印次数事件 |
| | | const printNumber = () => { |
| | | |
| | | selectRecordsData.value.printList = selectRecords |
| | | let printState = 0 |
| | | request.post(`/processCard/updatePrintState/${printState}`, selectRecordsData.value).then((res) => { |
| | | request.post(`/processCard/updatePrintNumber`, selectRecordsData.value).then((res) => { |
| | | if (res.code == 200 && res.data === true) { |
| | | } else { |
| | | |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | style="width: 90px"></el-input> |
| | | |
| | | <label>{{ $t('processCard.labelStyle') }}:</label> |
| | | <el-select v-model="printType" :placeholder="$t('processCard.pleaseSelect')" clearable default-value="default_city" |
| | | style="width: 120px"> |
| | | <el-select v-model="tag" :placeholder="$t('processCard.pleaseSelect')" style="width: 140px" @change="changeTag"> |
| | | <el-option |
| | | v-for="item in titleSelectJson['dataType']" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | v-for="(tag,index) in tags" |
| | | :key="index" |
| | | :label="tag.name" |
| | | :value="tag" |
| | | /> |
| | | </el-select> |
| | | |
| | |
| | | destroy-on-close |
| | | style="width: 80%;height:75% "> |
| | | <template #header="{ close, titleId, titleClass }"> |
| | | <el-button v-print="printContentLabel" :icon="Printer" circle/> |
| | | <el-button v-print="printContentLabel" :icon="Printer" circle @click="printNumber"/> |
| | | </template> |
| | | <print-custom-label id="childLabel" |
| | | :faceOrientation="labelRow.faceOrientation" |
| | |
| | | destroy-on-close |
| | | style="width: 80%;height:75% "> |
| | | <template #header="{ close, titleId, titleClass }"> |
| | | <el-button v-print="printContentLabel" :icon="Printer" circle/> |
| | | <el-button :icon="Printer" circle @click="printObjectProcess"/> |
| | | </template> |
| | | <print-custom-label-x-j id="childLabel" |
| | | :faceOrientation="labelRow.faceOrientation" |
| | | :lableType="labelRow.lableType" |
| | | :list="labelRow.list" |
| | | :lastList='lastList' |
| | | :type="labelRow.type" |
| | | style="width: 100%;height: 100%"/> |
| | | </el-dialog> |