廖井涛
5 天以前 a660db06773007b1be690e0674829c00a57aeb7b
north-glass-erp/northglass-erp/src/components/pp/PrintProcessReplenish.vue
@@ -55,19 +55,7 @@
let name=company.companyName
let replenishQRCode=company.replenishQRCode
//去除重复对象
// let uniqueObjects = {};
// // 遍历原始数据数组
// data.value.printList.forEach(obj => {
//   // 构建一个唯一键,例如 'NG24071502A001_1'
//   let key = `${obj.process_id}_${obj.technology_number}_${obj.order_number}`;
//
//   // 如果该键不存在于 uniqueObjects 中,则将该对象添加到 uniqueObjects 中
//   if (!uniqueObjects[key]) {
//     uniqueObjects[key] = obj;
//   }
// });
// data.value.printList = Object.values(uniqueObjects);
let flowCardCount = null
onMounted(() => {
  request.post(`/processCard/getSelectPrintingRefund/${merge}/${like}/${mergeTechnologyNumber}`, data.value).then((res) => {
@@ -95,43 +83,13 @@
            });
            produceList.value[j].detail[0].weight = sumWeight
          }
          //处理合并打印
          // if (printMerge !== null && printMerge !== undefined && printMerge !== "") {
          //
          //   produceList.value.forEach(item => {
          //     item.detail[0].technologyNumber = printMerge;
          //   });
          //
          //   //合并打印工艺流程处理
          //   if (like == null) {
          //     let process = produceList.value[0].detail[0].process
          //     console.log(process)
          //     let indexOfJiaJiao = process.indexOf('夹胶');
          //     if (indexOfJiaJiao !== -1) {
          //       // 使用 substring 截取 "夹胶" 后面的部分,包括 "夹胶" 本身
          //       let afterJiaJiao = process.substring(indexOfJiaJiao).trim();
          //       produceList.value.forEach(item => {
          //         item.detail[0].process = afterJiaJiao
          //       })
          //     }
          //
          //     let indexOfProceList = produceList.value[0].processList
          //     let getProceList = indexOfProceList.findIndex(item => item.process === '夹胶');
          //
          //     if (getProceList !== -1) {
          //       // 使用 filter 方法过滤出 "夹胶" 及其之后的对象
          //       produceList.value[0].processList = indexOfProceList.filter((item, index) => index >= getProceList);
          //     }
          //   }
          // }
          produceList.value.forEach(item => {
            let technologyNumberMerge = printMerge.split('').join(',');
            item.detail[0].technologyNumberMerge = technologyNumberMerge
          })
          //处理编号列
          //定义存放编号数组
          //定义存放编号数组 天津
          const s01Values = [];
          for (let i = 0; i < produceList.value.length; i++) {
            const s01Values = [];
@@ -152,28 +110,41 @@
          }
          // 使用一个对象来存储合并后的结果
          const mergedData = produceList.value.reduce((acc, item) => {
            const processId = item.detail[0].process_id;
            // detail 为空直接跳过
            const firstDetail = item?.detail?.[0]
            if (!firstDetail) return acc
            // 如果该 process_id 尚未在 acc 中,初始化其数组
            if (!acc[processId]) {
              acc[processId] = {
            const processId = firstDetail.process_id
            const technologyNumber = firstDetail.technologyNumber
            const key = company.printReplenishMerge
                ? processId
                : `${processId}_${technologyNumber}`
            // 初始化分组
            if (!acc[key]) {
              acc[key] = {
                processId,
                technologyNumber,
                processList: item.processList,
                detailList: [],
                detail: item.detail
              };
              }
            }
            // 合并 detailList
            acc[processId].detailList = acc[processId].detailList.concat(item.detailList);
            //  合并 detailList
            if (Array.isArray(item.detailList) && item.detailList.length) {
              acc[key].detailList.push(...item.detailList)
            }
            return acc;
          }, {});
            return acc
          }, {})
          // 将合并后的对象转换回数组
          produceList.value = Object.values(mergedData);
          //if (company.printReplenishMerge){
            produceList.value = Object.values(mergedData);
          //}
           flowCardCount=produceList.value.length
          handleSummary()
@@ -191,12 +162,15 @@
    }
)
const techNumberLength = ref()
const qrcodeLength =ref()
const handleGetQRCode = async () => {
  for (let i = 0; i < produceList.value.length; i++) {
    const detailItem = produceList.value[i].detail[0];
    const detailList = produceList.value[i].detailList;
    const mergeTechNumber = detailItem.mergeTechnologyNumber.toString();
    const processId = detailItem.process_id;
    detailItem.qrcodeList = [];
@@ -292,7 +266,7 @@
              <span v-if="name=='天津北玻玻璃工业技术有限公司(TJBB-QR7.1-01)'" style="font-size: 10px">{{itemFlow.otherRemarks}}</span>
              流程卡号: {{
                itemFlow.process_id
              }}/{{ itemFlow.technologyNumber }} 共 {{ item.count }} 架
              }}/{{ itemFlow.technologyNumber }}
            </div>
          </div>
        </td>
@@ -310,9 +284,11 @@
        <td class="tdNowrap">磨边类型:</td>
        <td colspan="3">{{ itemTr.edging_type }}</td>
        <td class="tdNowrap">单片名称:</td>
        <td colspan="8">{{ itemTr.glass_child }}</td>
        <td v-if="itemTr.qrcodeList.length*1>1" colspan="8">多层合并,详情见产品名称</td>
        <td v-else colspan="8">{{ itemTr.glass_child }}</td>
        <td class="tdNowrap">产品名称:</td>
        <td :colspan="2+item.processList.length*2">{{ itemTr.product_name }}</td>
        <td v-if="!company.processFontSize" :colspan="2+item.processList.length*2">{{ itemTr.product_name }}</td>
        <td v-else :colspan="2+item.processList.length*2" style="font-size: 18px;">{{ itemTr.product_name }}</td>
      </tr>
      <tr>
        <td rowspan='2'>序号</td>