Commit 391e58167e9145526926bd3cc8f84df99600ff6c

Authored by 陈鑫涛
1 parent f6f1ee09

盒型展示问题修复

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