wu
2024-12-18 bd5e141e592cca806fad15adfc0c540db075b7e6
已出炉更改显示逻辑
1个文件已修改
75 ■■■■ 已修改文件
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/PurchaseReturn/purchaseReturn.vue
@@ -203,6 +203,7 @@
  else {
    adjustedRects1.value = []
  }
// 进炉前
  if (data.waitingGlass && data.waitingGlass.length > 0) {  
    const newGlassIds = new Set(data.waitingGlass[0].map(rect => rect.glassId));  
    const existingRects = adjustedRectsa.value.filter(rect => newGlassIds.has(rect.glassId));  
@@ -253,6 +254,7 @@
  else if (data.waitingGlass == null) {
    adjustedRectsa.value = []
  }
  // 已出炉
  if (data.outGlass && data.outGlass.length > 0) {  
    // 提取新的矩形ID  
    const newGlassIds = new Set(data.outGlass[0].map(rect => rect.glassId));  
@@ -261,8 +263,8 @@
    // 计算新的矩形  
    const newRects = data.outGlass[0].map(rect => {  
      const scaleFactor =  1390/5190; 
      const scaleFactory =  750/2800;
      let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta,newY;
      const scaleFactorY =  750/2800;
      let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta;;
  let newX = rect.yCoordinate; 
      if (rect.width < rect.height) {
        widtha = rect.height;
@@ -273,29 +275,64 @@
      }
  if (rect.angle === 0) {  
    adjustedWidth = widtha * scaleFactor;  
    adjustedHeight = heighta * scaleFactory;
    adjustedHeight = heighta * scaleFactorY;
    // adjustedWidtha = widtha;  
    // adjustedHeighta = heighta;  
    // newX = 5190 - (rect.yCoordinate + widtha);
    newY = 2800 - (rect.xCoordinate + heighta);
  } else {
    newX = 5190 - (rect.yCoordinate + widtha);
    } else {
    adjustedWidth = heighta * scaleFactor;  
    adjustedHeight = widtha * scaleFactory;
    // adjustedWidtha = heighta;
    // adjustedHeighta = widtha;
    // newX = 5190 - (rect.yCoordinate + heighta);
    newY = 2800 - (rect.xCoordinate + widtha);
    adjustedHeight = widtha * scaleFactorY;
    // adjustedWidtha = widtha;
    // adjustedHeighta = heighta;
    newX = 5190 - (rect.yCoordinate + heighta);
  }  
  return {  
        ...rect, // 复制原始对象的其他属性
        x: newX * scaleFactor,
        y: newY * scaleFactory,
        width: adjustedWidth,
        height: adjustedHeight,
        widtha: rect.width,
        heighta: rect.height,
    ...rect,
    x: newX * scaleFactor,
    y: rect.xCoordinate * scaleFactorY,
    width: adjustedWidth,
    height: adjustedHeight,
    widtha: rect.width,
    heighta: rect.height,
  }
    });
    });
  //   const newRects = data.outGlass[0].map(rect => {
  //     const scaleFactor =  1390/5190;
  //     const scaleFactory =  750/2800;
  //     let adjustedWidth, adjustedHeight, adjustedWidtha, adjustedHeighta,widtha,heighta,newY;
  // let newX = rect.yCoordinate;
  //     if (rect.width < rect.height) {
  //       widtha = rect.height;
  //       heighta = rect.width;
  //     }else {
  //       widtha = rect.width;
  //       heighta = rect.height;
  //     }
  // if (rect.angle === 0) {
  //   adjustedWidth = widtha * scaleFactor;
  //   adjustedHeight = heighta * scaleFactory;
  //   // adjustedWidtha = widtha;
  //   // adjustedHeighta = heighta;
  //   // newX = 5190 - (rect.yCoordinate + widtha);
  //   newY = 2800 - (rect.xCoordinate + heighta);
  // } else {
  //   adjustedWidth = heighta * scaleFactor;
  //   adjustedHeight = widtha * scaleFactory;
  //   // adjustedWidtha = heighta;
  //   // adjustedHeighta = widtha;
  //   // newX = 5190 - (rect.yCoordinate + heighta);
  //   newY = 2800 - (rect.xCoordinate + widtha);
  // }
  // return {
  //       ...rect, // 复制原始对象的其他属性
  //       x: newX * scaleFactor,
  //       y: newY * scaleFactory,
  //       width: adjustedWidth,
  //       height: adjustedHeight,
  //       widtha: rect.width,
  //       heighta: rect.height,
  // }
  //   });
  
    // 合并新旧矩形,并保留 isActive 状态  
    adjustedRectsb.value = existingRects.map(oldRect => {