| New file |
| | |
| | | <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 = /\./; // 定义正则表达式,查找小数点 |
| | | 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> |