guoyuji
2025-02-07 82685a4ec94db01c564561582141c03054012ea3
north-glass-erp/northglass-erp/src/views/pp/replenish/PrintReplenishFlowCard.vue
@@ -14,11 +14,14 @@
import PrintCustomLabel from '@/components/pp/PrintRepairCustomLabel.vue'
import PrintCustomLabelSemi from '@/components/pp/PrintRepairCustomLabelSemi.vue'
import footSum from "@/hook/footSum"
import {Search} from "@element-plus/icons-vue";
import {Search, View} from "@element-plus/icons-vue";
import companyInfo from "@/stores/sd/companyInfo"
import {CircleCheck, Download, Printer} from "@element-plus/icons-vue/global";
import SortDetail from "@/components/pp/SelectSortDetailProcessCard.vue";
import {hiprint} from "vue-plugin-hiprint";
//import PrintCustomLabel from '@/components/pp/PrintCustomLabelDetails.vue'
import QueuePrinter from "@/hook/queue";
import PrintCustomLabelProject from "@/components/pp/PrintCustomLabelProject.vue";
const company = companyInfo()
//语言获取
const {t} = useI18n()
@@ -32,8 +35,18 @@
const xGrid = ref(null)
const xGridDetail =ref(null)
const tags = ref([])
const tag = ref({
  id: null,
  name: null,
  type: 1,
  tagWidth: null,
  tagHeight: null,
  value: null,
  size: null
})
let lastList = ref([])
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' : {
@@ -159,6 +172,9 @@
  id: 'childLabelSemi',
})
onMounted(async () => {
  await getTags();
})
//打印类型
const printType = ref('小片标签')
@@ -274,6 +290,8 @@
    // {title: t('basicData.operate'), width: 55, slots: { default: 'button_slot' },fixed:"left"},
    {type: 'checkbox', fixed: "left", title: t('basicData.check'), width: 80},
    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
    {field: 'patch_id', width: 120, title: t('replenish.patchNumber'),filterMethod: filterChanged, filters: [{data: ''}], slots: {filter: 'num1_filter'}},
    {
      field: 'order_id',
      title: t('order.orderId'),
@@ -454,48 +472,17 @@
          break
        }
        case 'customLabel': {
          if(selectRecords===null ||selectRecords===''||selectRecords.length===0){
            ElMessage.warning(t('searchOrder.msgList.checkOrder'))
          if (tag.value.name == null || tag.value.name == '') {
            ElMessage.warning(t('请选择标签模板'))
            return
          }
          if (type===null||type===''||type===undefined){
            ElMessage.warning(t('processCard.pleaseSelectCustomPrintLabelStyle'))
            return
          }
          let id = ""
          for (let i = 0; i < selectRecords.length; i++) {
            if (i + 1 === selectRecords.length) {
              id += selectRecords[i].id
            } else {
              id += selectRecords[i].id + "|"
            }
          }
          if (lableTypes==1){
            labelRow.value.list=JSON.stringify(selectRecords)
            labelRow.value.faceOrientation=faceOrientation
            labelRow.value.type=type
            labelRow.value.lableType= lableTypes
            dialogTableVisibleLabel.value=true
            //router.push({path: '/main/processCard/PrintCustomLabel', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }
          else if (lableTypes==2) {
            labelRow.value.list=JSON.stringify(selectRecords)
            labelRow.value.faceOrientation=faceOrientation
            labelRow.value.type=type
            labelRow.value.lableType= lableTypes
            dialogTableVisibleCustomLabel.value=true
            //router.push({path: '/main/processCard/PrintCustomLabelSemi', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }else
          if (lableTypes==3) {
            router.push({path: '/main/processCard/PrintLabel1', query: {type:type,faceOrientation:faceOrientation,lableType:lableTypes,  printList: JSON.stringify(selectRecords)}})
          }
          labelRow.value.list = JSON.stringify(selectRecords)
          labelRow.value.type = tag.value.name
          labelRow.value.dataType = 3
          labelRow.value.lableType = 2
          labelRow.value.switch = true
          lastList.value = []
          dialogTableVisibleLabel.value = true
          break
        }
        case 'printLike': {
@@ -671,6 +658,18 @@
  })
}
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.update(json)
}
// 监听打印完成事件
const printNumber = () =>{
@@ -686,101 +685,103 @@
  })
}
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)
  }
  hiprintTemplate.value.print(object)
}
</script>
<template>
  <div class="main-div-customer">
    <el-date-picker
        v-model="form.date1"
        :end-placeholder="$t('basicData.endDate')"
        :start-placeholder="$t('basicData.startDate')"
        format="YYYY/MM/DD"
        type="daterange"
        value-format="YYYY-MM-DD"
  <div  style="width: 100%;height: 100%">
    <div class="head">
      <el-date-picker
          v-model="form.date1"
          :end-placeholder="$t('basicData.endDate')"
          :start-placeholder="$t('basicData.startDate')"
          format="YYYY/MM/DD"
          type="daterange"
          value-format="YYYY-MM-DD"
    />
    <el-button
        id="select"
        :icon="Search"
        type="primary" @click="getWorkOrder">{{ $t('basicData.search') }}
    </el-button>
    &nbsp;&nbsp;
<!--    <el-input clearable :placeholder="$t('processCard.mergePrinting')" v-model="printMerge" style="width: 90px"></el-input>-->
<!--    &nbsp;-->
    <label>{{$t('processCard.labelStyle')}}:</label>
    <el-select v-model="printType" clearable default-value="default_city" :placeholder="$t('processCard.pleaseSelect')" style="width: 120px">
      <el-option
          v-for="item in titleSelectJson['dataType']"
          :key="item.id"
          :label="item.name"
          :value="item.name"
      />
    </el-select>
    &nbsp;
    <el-select v-model="lableType" class="m-2" :placeholder="lableTypeOptions[0].label" style="width: 140px">
      <el-option
          v-for="item in filteredOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
      />
    </el-select>
    &nbsp;
    <el-select v-model="stateValue" class="m-2" :placeholder="$t('processCard.pleaseSelect')" clearable allow-create filterable style="width: 140px">
      <el-option
          v-for="item in stateOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
      />
    </el-select>
    <vxe-grid
        ref="xGrid"
        class="mytable-scrollbar"
        height="100%"
        v-bind="gridOptions"
        v-on="gridEvents"
      <el-button
          id="select"
          :icon="Search"
          type="primary" @click="getWorkOrder">{{ $t('basicData.search') }}
      </el-button>
      &nbsp;&nbsp;
        标签模板:
        <el-select v-model="tag" placeholder="标签模板列表" style="width: 140px" @change="changeTag">
          <el-option
              v-for="(tag,index) in tags"
              :key="index"
              :label="tag.name"
              :value="tag"
          />
        </el-select>
    </div>
    <div class="main-table">
      <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>
      >
        <!--      @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>
            </li>
          </ul>
        </template>
      <!--左边固定显示的插槽-->
      <!--      v-if="userStore.user.permissions.indexOf('SelectProductionBasicData.edit') > -1"-->
      <template #button_slot="{ row }">
        <el-button @click="getTableRow(row,'edit')"
                   link
                   type="primary"
                   size="small">
          {{ $t('basicData.edit') }}
        </el-button>
        <!--左边固定显示的插槽-->
        <!--      v-if="userStore.user.permissions.indexOf('SelectProductionBasicData.edit') > -1"-->
        <template #button_slot="{ row }">
          <el-button @click="getTableRow(row,'edit')"
                     link
                     type="primary"
                     size="small">
            {{ $t('basicData.edit') }}
          </el-button>
      </template>
        </template>
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="text"
                   v-model="option.data"
                   @input="changeFilterEvent($event, option, $panel)"/>
        <template #num1_filter="{ column, $panel }">
          <div>
            <div v-for="(option, index) in column.filters" :key="index">
              <input type="text"
                     v-model="option.data"
                     @keyup.enter.native="$panel.confirmFilter()"
                     @input="changeFilterEvent($event, option, $panel)"/>
            </div>
          </div>
        </div>
      </template>
        </template>
    </vxe-grid>
      </vxe-grid>
    </div>
    <el-dialog
        id="sizePrintCalrd"
        v-model="dialogTableVisible"
@@ -793,24 +794,6 @@
      <print-process id="child" :printList="printRow.list" :printMerge="printRow.printMergeVal" :printLike="printRow.like"
                     :mergeTechnologyNumber="printRow.mergeTechnologyNumber"
                     style="width: 100%;height: 100%" />
    </el-dialog>
    <!--    成品标签-->
    <el-dialog
        id="sizeCustom"
        v-model="dialogTableVisibleLabel"
        destroy-on-close
        :title="$t('processCard.printLabel')"
        style="width: 80%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContentLabel"   :icon="Printer" circle />
      </template>
      <print-custom-label id="childLabel"
                          :list="labelRow.list"
                          :faceOrientation="labelRow.faceOrientation"
                          :type="labelRow.type"
                          :lableType="labelRow.lableType"
                          style="width: 100%;height: 100%" />
    </el-dialog>
    <!--   小片标签 -->
@@ -841,16 +824,40 @@
      <sort-detail id="child"  :processId="editRow.processId" :technologyNumber="editRow.technologyNumber" />
    </el-dialog>
    <el-dialog
        id="sizeCustom"
        v-model="dialogTableVisibleLabel"
        :title="$t('processCard.printLabel')"
        destroy-on-close
        style="width: 80%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-button :icon="Printer" circle @click="printOrder(1)"/>
      </template>
      <print-custom-label 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: 94%;
.head{
  width: 100%;
  height: 35px;
}
.main-table{
  width: 100%;
  height: calc(100% - 35px);
}
:deep(#sizeCheck .el-dialog__body){
  height: 90%;