chenlu
2024-10-11 82a5de6d2ec80b45660149c84be28734032562f6
north-glass-erp/northglass-erp/src/views/pp/processCard/PrintCustomLabel1.vue
@@ -33,33 +33,57 @@
const type = route.query.type
const faceOrientation = route.query.faceOrientation
const lableType = route.query.lableType
const printType=route.query.printType
onMounted(() => {
      request.post(`/processCard/getSelectPrintCustomLabel/${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}]`);
          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])
              }
  console.log(printType)
  if(printType==1){
    request.post(`/processCard/getSelectPrintCustomLabel/${type}/1`, 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}]`);
        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])
            }
          }
          console.log(lastList.value)
        } else {
          ElMessage.warning(res.msg)
          router.push("/login")
        }
      })
      } else {
        ElMessage.warning(res.msg)
        router.push("/login")
      }
    })
  }else if(printType==2){
    request.post(`/processCard/getSelectPrintCustomLabelDetails/${type}/1`, 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}]`);
    }
        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])
            }
          }
        }
      } else {
        ElMessage.warning(res.msg)
      }
    })
  }
})
// 打印方法
@@ -79,7 +103,11 @@
  style.innerHTML =
      "body>#" +
      printId +
      "{display:none}@media print{body>:not(#" +
      "{display:none}@media print{" +
      "@page {" +
      "    size: auto; " +
      "    margin: 12mm 4mm 2mm 6mm; " +
      "  }body>:not(#" +
      printId +
      "){display:none !important}body>#" +
      printId +
@@ -112,9 +140,10 @@
        <span>{{ item.project }}</span>&nbsp;
        <span>{{ item.buildingNumber }}</span>
      </div>
      <div class="row3">{{item.width}}*{{item.height}}={{item.quantity}}</div>
      <div class="row3" v-if="item.other_columns!=null&&(JSON.parse(item.other_columns).S02!=null)">{{JSON.parse(item.other_columns).S02}}={{item.quantity}}</div>
      <div class="row3" v-else>{{Math.round(item.width)}}x{{Math.round(item.height)}}={{item.quantity}}</div>
      <div class="row5">
        <span>{{item.remarks}}</span>&nbsp;
        <span>{{item.filmNumber}}</span>&nbsp;
        <span>{{ item.processingNote }}</span>
      </div>
    </div>
@@ -159,21 +188,34 @@
  height: 25px;
}
span {
  font-size: 12pt;
  font-size: 15pt;
  font-weight: bold;
}
.row3 {
  margin-top: -5px;
  height: 30px;
  font-size: 20pt;
  font-size: 22pt;
  font-weight: bolder;
}
.row5 {
  text-align: left;
  height: 25px;
  font-weight: bold;
  font-size: 12pt;
  font-size: 15pt;
  margin-left: 40px;
}
.row1 span{
  font-size: 17pt;
}
.row2 span{
  font-size: 17pt;
}
.row5 span{
  font-size: 17pt;
}
.row6 {
@@ -184,16 +226,17 @@
@page {
  size: auto;  /* auto is the initial value */
  margin: 12mm 4mm 2mm 6mm  /* this affects the margin in the printer settings */
}
@media print {
  div {
    page-break-inside: avoid;
  }
  @page {
    size: auto;  /* auto is the initial value */
    margin: 12mm 4mm 2mm 6mm;  /* this affects the margin in the printer settings */
  }
}
</style>