Commit 391e58167e9145526926bd3cc8f84df99600ff6c
1 parent
f6f1ee09
盒型展示问题修复
Showing
3 changed files
with
32 additions
and
17 deletions
src/components/Common/BoxDesignCompontent/svg.js
| ... | ... | @@ -192,6 +192,9 @@ const SvgBox = props => { |
| 192 | 192 | } else if (Number(svgType) === 6) { |
| 193 | 193 | viewBoxWidth = boxWidth + 2; |
| 194 | 194 | viewBoxHeight = boxLength + 2; |
| 195 | + } else if (Number(svgType) === 7) { | |
| 196 | + viewBoxWidth = boxWidth + dZTBW + dYTBW; | |
| 197 | + viewBoxHeight = boxLength + dZSCW + dYXCW; | |
| 195 | 198 | } |
| 196 | 199 | // 计算缩放比例 |
| 197 | 200 | let scale = 1; |
| ... | ... | @@ -371,6 +374,7 @@ const SvgBox = props => { |
| 371 | 374 | pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); |
| 372 | 375 | } |
| 373 | 376 | // 右边贴边 |
| 377 | + | |
| 374 | 378 | pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); |
| 375 | 379 | if (ybtb?.type && dYTBW) { |
| 376 | 380 | pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); |
| ... | ... | @@ -1066,8 +1070,9 @@ const SvgBox = props => { |
| 1066 | 1070 | } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) { |
| 1067 | 1071 | const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW; |
| 1068 | 1072 | const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW; |
| 1073 | + | |
| 1069 | 1074 | const max = Math.max(z, y); |
| 1070 | - if (max > sfhs?.value) { | |
| 1075 | + if (max > (sfhs?.value || 0)) { | |
| 1071 | 1076 | top = max; |
| 1072 | 1077 | } else { |
| 1073 | 1078 | top = sfhs?.value; |
| ... | ... | @@ -1075,12 +1080,15 @@ const SvgBox = props => { |
| 1075 | 1080 | } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) { |
| 1076 | 1081 | const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW; |
| 1077 | 1082 | const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW; |
| 1083 | + | |
| 1078 | 1084 | const max = Math.max(z, y); |
| 1079 | - if (max > sfhs?.value) { | |
| 1085 | + | |
| 1086 | + if (max > ((sfhs?.value || 0))) { | |
| 1080 | 1087 | top = max; |
| 1081 | 1088 | } else { |
| 1082 | 1089 | top = sfhs?.value; |
| 1083 | 1090 | } |
| 1091 | + | |
| 1084 | 1092 | } else { |
| 1085 | 1093 | top = max; |
| 1086 | 1094 | } |
| ... | ... | @@ -1133,6 +1141,8 @@ const SvgBox = props => { |
| 1133 | 1141 | } else { |
| 1134 | 1142 | top = sfhs?.value; |
| 1135 | 1143 | } |
| 1144 | + | |
| 1145 | + | |
| 1136 | 1146 | // 处理天地盒默认加上高 |
| 1137 | 1147 | if (Number(svgType) === 4) { |
| 1138 | 1148 | top = top + height; |
| ... | ... | @@ -1168,7 +1178,7 @@ const SvgBox = props => { |
| 1168 | 1178 | const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW; |
| 1169 | 1179 | const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW; |
| 1170 | 1180 | const max = Math.max(z, y); |
| 1171 | - if (max > sfhs?.value) { | |
| 1181 | + if (max > (sfhs?.value || 0)) { | |
| 1172 | 1182 | top = max; |
| 1173 | 1183 | } else { |
| 1174 | 1184 | top = sfhs?.value; |
| ... | ... | @@ -1177,7 +1187,7 @@ const SvgBox = props => { |
| 1177 | 1187 | const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW; |
| 1178 | 1188 | const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW; |
| 1179 | 1189 | const max = Math.max(z, y); |
| 1180 | - if (max > sfhs?.value) { | |
| 1190 | + if (max > (sfhs?.value || 0)) { | |
| 1181 | 1191 | top = max; |
| 1182 | 1192 | } else { |
| 1183 | 1193 | top = sfhs?.value; |
| ... | ... | @@ -1185,6 +1195,7 @@ const SvgBox = props => { |
| 1185 | 1195 | } else { |
| 1186 | 1196 | top = max; |
| 1187 | 1197 | } |
| 1198 | + | |
| 1188 | 1199 | } else if (yscw?.type) { |
| 1189 | 1200 | const max = dYSCW; |
| 1190 | 1201 | if ( | ... | ... |
src/components/Common/Typesetting/typesetting.js
| ... | ... | @@ -84,12 +84,12 @@ const Typesetting = props => { |
| 84 | 84 | let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 |
| 85 | 85 | // dHorizontal = 1; |
| 86 | 86 | // 如果需要自定义排版数 |
| 87 | - | |
| 88 | 87 | // 确认是竖向排列还是横向排列 |
| 88 | + | |
| 89 | 89 | const L = masterData?.dLength; |
| 90 | - const W = masterData?.dWidth; | |
| 91 | - const H = masterData?.dWidth; | |
| 92 | - const D = masterData?.dHeight; | |
| 90 | + const W = masterData?.dWidth ; | |
| 91 | + const H = masterData?.dWidth || 0; | |
| 92 | + const D = masterData?.dHeight || 0; | |
| 93 | 93 | |
| 94 | 94 | // 动态计算公式值 |
| 95 | 95 | const evaluateFormula = (formula, variables) => { |
| ... | ... | @@ -186,7 +186,6 @@ const Typesetting = props => { |
| 186 | 186 | ...props.slaveRowData, |
| 187 | 187 | ...result, |
| 188 | 188 | }; |
| 189 | - console.log(variabless, "variabless"); | |
| 190 | 189 | const evaluateFormulas = (formula, variables) => { |
| 191 | 190 | if (!formula) return ""; // 如果公式为空,返回空字符串 |
| 192 | 191 | |
| ... | ... | @@ -207,7 +206,6 @@ const Typesetting = props => { |
| 207 | 206 | // ? (dSFHS >= dZSCW ? -(dYXCW + D - dSFHS) * 2 : -((dYXCW + D) - dZSCW)) * 2 |
| 208 | 207 | // : dSFHS >= dZSCW ? (dYXCW + D >= dZSCW) ? -(dSFHS - (dYXCW + D)) * 2 : -(dSFHS - dZXCW) * 2 : (dYXCW + D >= dSFHS) ? -(dZSCW - (dYXCW + D)) * 2 : -(dZXCW - dSFHS) * 2` |
| 209 | 208 | // const ddd = evaluateFormula(s, variabless); |
| 210 | - // console.log("🚀 ~ ddd:", ddd); | |
| 211 | 209 | let DisableMateriallIcon = L ? sPackDetailPath : null; |
| 212 | 210 | // 盒子展长展开公式计算 |
| 213 | 211 | const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); |
| ... | ... | @@ -464,7 +462,7 @@ const Typesetting = props => { |
| 464 | 462 | if (reference) { |
| 465 | 463 | return row === 0 ? 0 : topPosition + boxWidthOffset * row; |
| 466 | 464 | } else { |
| 467 | - return row === 0 ? 0 : topPosition + (dSWidthOffset + boxWidthOffset) * row; | |
| 465 | + return row === 0 ? topPosition : topPosition + (dSWidthOffset + boxWidthOffset) * row; | |
| 468 | 466 | } |
| 469 | 467 | } |
| 470 | 468 | }; |
| ... | ... | @@ -493,7 +491,6 @@ const Typesetting = props => { |
| 493 | 491 | // rows = 1 |
| 494 | 492 | // } |
| 495 | 493 | // } |
| 496 | - console.log(cols, rows, "rows"); | |
| 497 | 494 | |
| 498 | 495 | for (let col = 0; col < cols; col++) { |
| 499 | 496 | for (let row = 0; row < rows; row++) { |
| ... | ... | @@ -539,6 +536,7 @@ const Typesetting = props => { |
| 539 | 536 | if (maxLength > innerWidth) { |
| 540 | 537 | let leftPosition = 0; |
| 541 | 538 | let topPosition = 0; |
| 539 | + | |
| 542 | 540 | innerDivs.push(createBoxOne(0, rows, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); |
| 543 | 541 | } |
| 544 | 542 | } |
| ... | ... | @@ -560,7 +558,6 @@ const Typesetting = props => { |
| 560 | 558 | // 判断列是否是单独的 |
| 561 | 559 | const newMaterialLength = propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) - dYBJJ; // 原纸长 |
| 562 | 560 | const newMaterialWidth = propsDataTop + propsDataHeight - dSBLB; |
| 563 | - console.log("🚀 ~ newMaterialWidth:", propsData, propsDataTop, propsDataHeight, newMaterialWidth, newMaterialLength); | |
| 564 | 561 | |
| 565 | 562 | // 计算开数 |
| 566 | 563 | const dSinglePQty = isVertical |
| ... | ... | @@ -645,7 +642,14 @@ const Typesetting = props => { |
| 645 | 642 | typesettingBox.current.style.width = newMaterialLength + dYBLB + "px"; |
| 646 | 643 | typesettingBox.current.style.height = newMaterialWidth + dXBLB + "px"; |
| 647 | 644 | } |
| 648 | - }, 0); // 使用 0 延迟,将任务放入事件队列 | |
| 645 | + if (typesettingBoxs.current) { | |
| 646 | + typesettingBoxs.current.style.backgroundColor = "#b7e0ff"; | |
| 647 | + typesettingBoxs.current.style.marginTop = dSBLB + "px"; | |
| 648 | + typesettingBoxs.current.style.marginLeft = dZBLB + "px"; | |
| 649 | + typesettingBoxs.current.style.width = newMaterialLength + dYBLB + "px"; | |
| 650 | + typesettingBoxs.current.style.height = newMaterialWidth + dXBLB + "px"; | |
| 651 | + } | |
| 652 | + }, 100); // 使用 0 延迟,将任务放入事件队列 | |
| 649 | 653 | } |
| 650 | 654 | const isMax = |
| 651 | 655 | slaveDataDetail?.dMaxLength && |
| ... | ... | @@ -1027,7 +1031,7 @@ const Typesetting = props => { |
| 1027 | 1031 | <div style={{ ...style, position: "absolute", left: "50%" }} ref={boxsRef}> |
| 1028 | 1032 | {boxList.length ? innerDivs : []} |
| 1029 | 1033 | <div |
| 1030 | - ref={typesettingBox} | |
| 1034 | + ref={typesettingBoxs} | |
| 1031 | 1035 | style={{ |
| 1032 | 1036 | position: "absolute", |
| 1033 | 1037 | top: 0, | ... | ... |
src/components/QuickQuote/index.jsx
| ... | ... | @@ -1876,10 +1876,10 @@ const BoxComponent = props => { |
| 1876 | 1876 | }; |
| 1877 | 1877 | |
| 1878 | 1878 | let boxList = []; |
| 1879 | + const {sStripType = 0} = selectedNode; | |
| 1879 | 1880 | if ( |
| 1880 | 1881 | (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) || |
| 1881 | - (selectedNode.sTypeKey === "kapai" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) || | |
| 1882 | - (selectedNode.sProductType === "不干胶" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) | |
| 1882 | + (Number(sStripType) === 1 && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) | |
| 1883 | 1883 | ) { |
| 1884 | 1884 | const slaveNewData = JSON.parse(slaveRowData.sColumnNameConfig); |
| 1885 | 1885 | const tables = [ | ... | ... |