廖井涛
2025-03-25 768e16999a8ce4bb500490ee76c659aa61ea1783
north-glass-erp/northglass-erp/src/components/pp/PrintCustomLabelDetails.vue
@@ -18,7 +18,6 @@
let titleList = ref([])
let dataList = ref([])
let list = ref([])
let lastList = ref([])
let filterData = ref({})
@@ -30,7 +29,10 @@
  list:null,//勾选的数据
  faceOrientation:null,//内外面
  type:null,//标签模板
  lableType:null//标签类型
  lableType:null,//标签类型
  titleList:null,//标题
  switch:null,//判断是否为新打印,
  lastList:[]
})
const {currentRoute} = useRouter()
@@ -44,32 +46,33 @@
  faceOrientation='OUTSIDE'
}
let lableType = props.lableType
let switchType = props.switch
data.value.printList = JSON.parse(props.list)
onMounted(() => {
      request.post(`/processCard/getSelectPrintCustomLabelDetails/${type}/${lableType}`, data.value).then((res) => {
        if (res.code == 200) {
          produceList.value = deepClone(res.data.title)
          list.value = deepClone(res.data.data)
          const data = produceList.value[0].value
          dataList = JSON.parse(`[${data}]`);
    request.post(`/processCard/getSelectPrintCustomLabelDetails/${type}/${lableType}`, data.value).then((res) => {
      if (res.code == 200) {
        produceList.value = deepClone(res.data.title)
        list.value = deepClone(res.data.data)
        const data = produceList.value[0].value
        dataList = JSON.parse(`[${data}]`);
        if (switchType===true){
          labelList = props.titleList
        }else {
          labelList = dataList[0]
          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])
              }
        }
        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++) {
              props.lastList.push(list.value[i].data[j])
            }
          }
        } else {
          ElMessage.warning(res.msg)
          router.push("/login")
        }
      })
    }
      } else {
        ElMessage.warning(res.msg)
      }
    })
  }
)
@@ -87,13 +90,10 @@
  const newValue = event.target.innerText;
  const parts = newValue.split(':');
  const result = parts[1]; // 获取冒号后的部分
  // 获取映射中所有的键
  const keys = Object.keys(propertyMapping);
  // 根据 index 获取对应的属性名
  const propertyName = keys[index];
  // 如果映射中没有该 index,直接返回
  if (!propertyName) {
    console.warn('Unsupported index:', index);
@@ -101,11 +101,11 @@
  }
  // 遍历 lastList 并更新对应的属性
  lastList.value.forEach(obj => {
  props.lastList.forEach(obj => {
    // 获取前缀和 orderId
    const prefix = obj.processId.substring(0, 11);
    const prefix = props.lastList[id].processId.substring(0, 11);
    const orderId = obj.orderId;
    const glassNumber=lastList.value[id].glassNumber
    const glassNumber=props.lastList[id].glassNumber
    // 根据 propertyName 更新属性
    if (propertyName === 'productAbbreviation' && prefix === obj.processId.substring(0, 11)) {
      obj.productAbbreviation = result;
@@ -114,8 +114,38 @@
    if (propertyName === 'project' && orderId === obj.orderId) {
      obj.project = result;
    }
    if (propertyName === 'productName' && glassNumber === obj.glassNumber){
    if (propertyName === 'productName' && prefix === obj.processId.substring(0, 11)){
      obj.productName = result;
    }
    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;
    }
  });
}
@@ -126,10 +156,11 @@
<template>
    <div id="print" :class="company.printLabel.className.custom.printFlowCardName()">
      <div v-for="(item1,index) in lastList" :class="company.printLabel.className.custom.entiretyName()">
      <div v-for="(item1,index) in props.lastList" :class="company.printLabel.className.custom.entiretyName()">
        <div class="row4">{{ faceOrientation }}</div>
        <div v-for="(item,id) in labelList" :class="company.printLabel.className.custom.contentRowName()">
          <div v-if="item1[item.name] != null && item1[item.name] !== ''" class="row1"  contenteditable="true" @input="updateProductName($event, id,index)" v-text="item.title+':'+item1[item.name]"></div>
          <div v-else class="row1"  contenteditable="true" @input="updateProductName($event, id,index)" v-text="item.title+':'"></div>
<!--          <div class="row2" style="width: 100%;"><input class="contentRow2" v-model="item1[item.name]"  @keyup="updataProductName()" style="border: none;"/></div>-->
<!--          <div v-if="item1[item.name] != null && item1[item.name] !== ''" class="row2" style="width: 100%;" contenteditable="true" @input="updateProductName($event, id)" v-text="item1[item.name]"></div>-->
        </div>