From 391e58167e9145526926bd3cc8f84df99600ff6c Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Fri, 27 Jun 2025 16:10:15 +0800 Subject: [PATCH] 盒型展示问题修复 --- src/components/Common/BoxDesignCompontent/svg.js | 19 +++++++++++++++---- src/components/Common/Typesetting/typesetting.js | 26 +++++++++++++++----------- src/components/QuickQuote/index.jsx | 4 ++-- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js index b120d7c..06666f5 100644 --- a/src/components/Common/BoxDesignCompontent/svg.js +++ b/src/components/Common/BoxDesignCompontent/svg.js @@ -192,6 +192,9 @@ const SvgBox = props => { } else if (Number(svgType) === 6) { viewBoxWidth = boxWidth + 2; viewBoxHeight = boxLength + 2; + } else if (Number(svgType) === 7) { + viewBoxWidth = boxWidth + dZTBW + dYTBW; + viewBoxHeight = boxLength + dZSCW + dYXCW; } // 计算缩放比例 let scale = 1; @@ -371,6 +374,7 @@ const SvgBox = props => { pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); } // 右边贴边 + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); if (ybtb?.type && dYTBW) { pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); @@ -1066,8 +1070,9 @@ const SvgBox = props => { } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW; const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW; + const max = Math.max(z, y); - if (max > sfhs?.value) { + if (max > (sfhs?.value || 0)) { top = max; } else { top = sfhs?.value; @@ -1075,12 +1080,15 @@ const SvgBox = props => { } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW; const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW; + const max = Math.max(z, y); - if (max > sfhs?.value) { + + if (max > ((sfhs?.value || 0))) { top = max; } else { top = sfhs?.value; } + } else { top = max; } @@ -1133,6 +1141,8 @@ const SvgBox = props => { } else { top = sfhs?.value; } + + // 处理天地盒默认加上高 if (Number(svgType) === 4) { top = top + height; @@ -1168,7 +1178,7 @@ const SvgBox = props => { const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW; const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW; const max = Math.max(z, y); - if (max > sfhs?.value) { + if (max > (sfhs?.value || 0)) { top = max; } else { top = sfhs?.value; @@ -1177,7 +1187,7 @@ const SvgBox = props => { const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW; const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW; const max = Math.max(z, y); - if (max > sfhs?.value) { + if (max > (sfhs?.value || 0)) { top = max; } else { top = sfhs?.value; @@ -1185,6 +1195,7 @@ const SvgBox = props => { } else { top = max; } + } else if (yscw?.type) { const max = dYSCW; if ( diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index 655c7cb..e071556 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -84,12 +84,12 @@ const Typesetting = props => { let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 // dHorizontal = 1; // 如果需要自定义排版数 - // 确认是竖向排列还是横向排列 + const L = masterData?.dLength; - const W = masterData?.dWidth; - const H = masterData?.dWidth; - const D = masterData?.dHeight; + const W = masterData?.dWidth ; + const H = masterData?.dWidth || 0; + const D = masterData?.dHeight || 0; // 动态计算公式值 const evaluateFormula = (formula, variables) => { @@ -186,7 +186,6 @@ const Typesetting = props => { ...props.slaveRowData, ...result, }; - console.log(variabless, "variabless"); const evaluateFormulas = (formula, variables) => { if (!formula) return ""; // 如果公式为空,返回空字符串 @@ -207,7 +206,6 @@ const Typesetting = props => { // ? (dSFHS >= dZSCW ? -(dYXCW + D - dSFHS) * 2 : -((dYXCW + D) - dZSCW)) * 2 // : dSFHS >= dZSCW ? (dYXCW + D >= dZSCW) ? -(dSFHS - (dYXCW + D)) * 2 : -(dSFHS - dZXCW) * 2 : (dYXCW + D >= dSFHS) ? -(dZSCW - (dYXCW + D)) * 2 : -(dZXCW - dSFHS) * 2` // const ddd = evaluateFormula(s, variabless); - // console.log("🚀 ~ ddd:", ddd); let DisableMateriallIcon = L ? sPackDetailPath : null; // 盒子展长展开公式计算 const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); @@ -464,7 +462,7 @@ const Typesetting = props => { if (reference) { return row === 0 ? 0 : topPosition + boxWidthOffset * row; } else { - return row === 0 ? 0 : topPosition + (dSWidthOffset + boxWidthOffset) * row; + return row === 0 ? topPosition : topPosition + (dSWidthOffset + boxWidthOffset) * row; } } }; @@ -493,7 +491,6 @@ const Typesetting = props => { // rows = 1 // } // } - console.log(cols, rows, "rows"); for (let col = 0; col < cols; col++) { for (let row = 0; row < rows; row++) { @@ -539,6 +536,7 @@ const Typesetting = props => { if (maxLength > innerWidth) { let leftPosition = 0; let topPosition = 0; + innerDivs.push(createBoxOne(0, rows, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); } } @@ -560,7 +558,6 @@ const Typesetting = props => { // 判断列是否是单独的 const newMaterialLength = propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) - dYBJJ; // 原纸长 const newMaterialWidth = propsDataTop + propsDataHeight - dSBLB; - console.log("🚀 ~ newMaterialWidth:", propsData, propsDataTop, propsDataHeight, newMaterialWidth, newMaterialLength); // 计算开数 const dSinglePQty = isVertical @@ -645,7 +642,14 @@ const Typesetting = props => { typesettingBox.current.style.width = newMaterialLength + dYBLB + "px"; typesettingBox.current.style.height = newMaterialWidth + dXBLB + "px"; } - }, 0); // 使用 0 延迟,将任务放入事件队列 + if (typesettingBoxs.current) { + typesettingBoxs.current.style.backgroundColor = "#b7e0ff"; + typesettingBoxs.current.style.marginTop = dSBLB + "px"; + typesettingBoxs.current.style.marginLeft = dZBLB + "px"; + typesettingBoxs.current.style.width = newMaterialLength + dYBLB + "px"; + typesettingBoxs.current.style.height = newMaterialWidth + dXBLB + "px"; + } + }, 100); // 使用 0 延迟,将任务放入事件队列 } const isMax = slaveDataDetail?.dMaxLength && @@ -1027,7 +1031,7 @@ const Typesetting = props => {