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('小片标签')
@@ -456,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': {
@@ -673,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,6 +683,22 @@
    }
  })
}
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>
@@ -709,35 +722,16 @@
      </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>
        标签模板:
        <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
@@ -802,24 +796,6 @@
                     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>
    <!--   小片标签 -->
    <el-dialog
        id="sizeCustomSemi"
@@ -848,7 +824,26 @@
      <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>