guoyujie
8 天以前 76746dcdb6f0572c4b3349056421369aa7a34b09
north-glass-erp/northglass-erp/src/components/pp/PrintCustomLabelTwo.vue
@@ -23,7 +23,8 @@
let filterData = ref({})
const data = ref({
  printList: []
  printList: [],
  isRepeat:false
})
let props = defineProps({
@@ -31,7 +32,8 @@
  faceOrientation:null,//内外面
  type:null,//标签模板
  lableType:null,//标签类型
  switch:null//判断是否为新打印
  switch:null,//判断是否为新打印
  lastList:[],
})
const {currentRoute} = useRouter()
@@ -74,11 +76,37 @@
            }
          })
          labelList = a
          for (let i = 0; i < list.value.length; i++) {
            let count = list.value[i].data.length
            for (let j = 0; j < count; j++) {
              for (let k = 0; k < list.value[i].data[j].quantity; k++) {
                lastList.value.push(list.value[i].data[j])
          props.lastList.length = 0;
          // 遍历列表(替换 i 为更语义化的变量名)
          for (const group of list.value) {
            // 遍历每组中的数据(替换 j)
            for (const item of group.data) {
              const { quantity, newList } = item;
              // 跳过 quantity 为 0 或无效的情况
              if (!quantity || quantity <= 0) continue;
              // 处理 newList:确保是数组,不足时用空对象兜底
              const safeNewList = Array.isArray(newList) ? newList : [];
              // 循环 quantity 次,添加数据到 lastList
              for (let k = 0; k < quantity; k++) {
                // 深拷贝 item,避免重复引用(关键!)
                const newItem = JSON.parse(JSON.stringify(item));
                // 若 newList 有对应索引数据,填充字段;否则置空
                const listItem = safeNewList[k];
                if (listItem) {
                  newItem.heat_layout_sort = listItem.glass_id || ''; // 兜底空字符串
                  newItem.stockPolysId = `${listItem.stock_id || ''}/${listItem.polys_id || ''}`; // 避免 undefined/
                } else {
                  // 无对应数据时,字段置空(避免保留原始值)
                  newItem.heat_layout_sort = '';
                  newItem.stockPolysId = '';
                }
                // 添加到目标列表
                props.lastList.push(newItem);
              }
            }
          }
@@ -115,11 +143,12 @@
  }
  // 遍历 lastList 并更新对应的属性
  lastList.value.forEach(obj => {
  props.lastList.forEach(obj => {
    // 获取前缀和 orderId
    const prefix = lastList.value[index].processId.substring(0, 11);
    console.log(index)
    const prefix = props.lastList[id].processId.substring(0, 11);
    const orderId = obj.orderId;
    const glassNumber=lastList.value[index].glassNumber
    const glassNumber=props.lastList[id].glassNumber
    // 根据 propertyName 更新属性
    if (propertyName === 'productAbbreviation' && prefix === obj.processId.substring(0, 11)) {
      obj.productAbbreviation = result;
@@ -134,22 +163,53 @@
    if (propertyName === 'customerName' && orderId === obj.orderId){
      obj.customerName = result;
    }
    if (propertyName === 'orderId' && orderId === obj.orderId){
      obj.orderId = result;
    }
    if (propertyName === 'glassNumber' && glassNumber === obj.glassNumber){
      obj.glassNumber = result;
    }
    if (propertyName === 'width' && glassNumber === obj.glassNumber){
      obj.width = result;
    }
    if (propertyName === 'height' && glassNumber === obj.glassNumber){
      obj.height = result;
    }
    if (propertyName === 'custom1' && orderId === obj.orderId){
      obj.custom1 = result;
    }
    if (propertyName === 'custom2' && orderId === obj.orderId){
      obj.custom2 = result;
    }
    if (propertyName === 'custom3' && orderId === obj.orderId){
      obj.custom3 = result;
    }
    if (propertyName === 'custom4' && orderId === obj.orderId){
      obj.custom4 = result;
    }
    if (propertyName === 'custom5' && orderId === obj.orderId){
      obj.custom5 = result;
    }
  });
}
</script>
<template>
  <div id="print" :class="company.printLabel.className.semi.printFlowCardName()">
    <div v-for="(item1,id) in lastList" :class="company.printLabel.className.semi.entiretyName()">
  <div id="print" class="printFlowCard_semi">
      <template v-for="(item1,index) in props.lastList">
        <div class="entirety_semi">
      <div class="row4">{{ faceOrientation }}</div>
      <div  v-for="(item,id) in labelList" :class="company.printLabel.className.semi.contentRowName()">
      <div  v-for="(item,id) in labelList" class="contentRow">
        <div contenteditable="true" v-if="item1[item.name] != null && item1[item.name] !== ''" class="row1" @input="updateProductName($event, id,index)">{{ item.title }}:{{ item1[item.name] }}</div>
        <!--        <div v-if="item1[item.name] != null && item1[item.name] !== ''" class="row2">{{ item1[item.name] }}</div>-->
      </div>
      <div v-html="company.printLabel.customSemi(item1)"></div>
      <div v-if="(id + 1) % 2 === 0" class="pagebreak"></div>
    </div>
        </div>
        <div v-if="(id + 1) % 2 === 0" class="pagebreak"></div>
      </template>
  </div>