Commit c0d9a47f49a017f40755bdea90e32eb1a2744664

Authored by 陈鑫涛
1 parent 89f2e12c

排版

src/components/Common/Typesetting/typesetting.js
@@ -87,11 +87,10 @@ const Typesetting = props => { @@ -87,11 +87,10 @@ const Typesetting = props => {
87 // 如果需要自定义排版数 87 // 如果需要自定义排版数
88 // 确认是竖向排列还是横向排列 88 // 确认是竖向排列还是横向排列
89 89
90 - const L = masterData?.dLength || 0;  
91 - const W = masterData?.dWidth || 0 ; 90 + const L = Number(masterData?.dLength) || 0;
  91 + const W = masterData?.dWidth || 0;
92 const H = masterData?.dWidth || 0; 92 const H = masterData?.dWidth || 0;
93 const D = masterData?.dHeight || 0; 93 const D = masterData?.dHeight || 0;
94 -  
95 // 动态计算公式值 94 // 动态计算公式值
96 const evaluateFormula = (formula, variables) => { 95 const evaluateFormula = (formula, variables) => {
97 if (!formula) return 0; // 如果公式为空,返回0 96 if (!formula) return 0; // 如果公式为空,返回0
@@ -118,8 +117,9 @@ const Typesetting = props => { @@ -118,8 +117,9 @@ const Typesetting = props => {
118 D, 117 D,
119 ...props.slaveRowData, 118 ...props.slaveRowData,
120 }; 119 };
  120 + const { sStripType = 0 } = props.state.selectedNode;
121 let boxList = []; 121 let boxList = [];
122 - if (sColumnNameConfig) { 122 + if (sColumnNameConfig ) {
123 const slaveNewData = JSON.parse(sColumnNameConfig); 123 const slaveNewData = JSON.parse(sColumnNameConfig);
124 const tables = [ 124 const tables = [
125 { name: "盒型类别", value: slaveRowData.sBoxType, type: null }, 125 { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
@@ -142,7 +142,7 @@ const Typesetting = props => { @@ -142,7 +142,7 @@ const Typesetting = props => {
142 slaveNewData.forEach(x => { 142 slaveNewData.forEach(x => {
143 let key = 0; 143 let key = 0;
144 if (x.sAssignFormula) { 144 if (x.sAssignFormula) {
145 - key = evaluateFormula(x.sAssignFormula, variables); 145 + key = parseFloat(evaluateFormula(x.sAssignFormula, variables)).toFixed(2) || 0;
146 } else { 146 } else {
147 key = slaveRowData[x.sName]; 147 key = slaveRowData[x.sName];
148 } 148 }
@@ -176,7 +176,7 @@ const Typesetting = props => { @@ -176,7 +176,7 @@ const Typesetting = props => {
176 }); 176 });
177 } 177 }
178 178
179 - const result = boxList.reduce((acc, { sCode, value }) => ({ ...acc, [sCode]: value }), {}); 179 + const result = boxList?.reduce((acc, { sCode, value }) => ({ ...acc, [sCode]: value }), {});
180 180
181 // 计算表达式结果 181 // 计算表达式结果
182 const variabless = { 182 const variabless = {
@@ -187,26 +187,6 @@ const Typesetting = props => { @@ -187,26 +187,6 @@ const Typesetting = props => {
187 ...props.slaveRowData, 187 ...props.slaveRowData,
188 ...result, 188 ...result,
189 }; 189 };
190 - const evaluateFormulas = (formula, variables) => {  
191 - if (!formula) return ""; // 如果公式为空,返回空字符串  
192 -  
193 - 提; //取公式中的变量名  
194 - const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];  
195 -  
196 - // 替换公式中的变量为实际值  
197 - let modifiedFormula = formula;  
198 - variableNames.forEach(name => {  
199 - if (variables[name] !== undefined) {  
200 - modifiedFormula = modifiedFormula.replace(new RegExp(`\\b${name}\\b`, "g"), variables[name]);  
201 - }  
202 - });  
203 -  
204 - return modifiedFormula;  
205 - };  
206 - // const s = `((dYXCW + D) >= dSFHS) && ((dYXCW + D) >= dZSCW)  
207 - // ? (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`  
209 - // const ddd = evaluateFormula(s, variabless);  
210 let DisableMateriallIcon = L ? sPackDetailPath : null; 190 let DisableMateriallIcon = L ? sPackDetailPath : null;
211 // 盒子展长展开公式计算 191 // 盒子展长展开公式计算
212 const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); 192 const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless);
@@ -220,15 +200,16 @@ const Typesetting = props => { @@ -220,15 +200,16 @@ const Typesetting = props => {
220 const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移 200 const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移
221 const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下' 201 const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下'
222 const reference = sSGroupOffset === "首盒"; // 第三列参考 202 const reference = sSGroupOffset === "首盒"; // 第三列参考
223 - 203 + console.log(innerWidth,innerHeight,dFWidthOffset,dFLengthOffset,dSWidthOffset,dSLengthOffset,boxLengthOffset,boxWidthOffset,'typeSetting');
  204 +
224 // 计算内层盒子尺寸 加上间距 205 // 计算内层盒子尺寸 加上间距
225 - let jInnerHeight = innerHeight + dXBJJ * 2;  
226 - let jInnerWidth = innerWidth + dYBJJ * 2; 206 + let jInnerHeight = innerHeight;
  207 + let jInnerWidth = innerWidth;
227 let dSvgBoxWidth = innerWidth; 208 let dSvgBoxWidth = innerWidth;
228 let dSvgBoxHeight = innerHeight; 209 let dSvgBoxHeight = innerHeight;
229 if (iFAngle === 90 || iFAngle === 270 || iSAngle === 90 || iSAngle === 270) { 210 if (iFAngle === 90 || iFAngle === 270 || iSAngle === 90 || iSAngle === 270) {
230 - jInnerHeight = innerWidth + dYBJJ + dYBJJ;  
231 - jInnerWidth = innerHeight + dXBJJ + dXBJJ; 211 + jInnerHeight = innerWidth;
  212 + jInnerWidth = innerHeight;
232 // dSvgBoxHeight = jInnerHeight; 213 // dSvgBoxHeight = jInnerHeight;
233 // dSvgBoxWidth = jInnerWidth; 214 // dSvgBoxWidth = jInnerWidth;
234 } 215 }
@@ -301,11 +282,6 @@ const Typesetting = props => { @@ -301,11 +282,6 @@ const Typesetting = props => {
301 } 282 }
302 } 283 }
303 } 284 }
304 -  
305 - // 抵扣盒默认展示 svg  
306 - // const isSvg = props.slaveRowData.sName === "扣抵盒";  
307 - // 组装svg数据  
308 -  
309 const svgProps = { 285 const svgProps = {
310 ...props, 286 ...props,
311 boxList, 287 boxList,
@@ -340,7 +316,7 @@ const Typesetting = props => { @@ -340,7 +316,7 @@ const Typesetting = props => {
340 </div> 316 </div>
341 </div> 317 </div>
342 ); 318 );
343 - 319 +
344 const createBox = (col, row, index, leftPosition, topPosition, offsetZ, icon) => ( 320 const createBox = (col, row, index, leftPosition, topPosition, offsetZ, icon) => (
345 <div 321 <div
346 key={`${col}-${row}-${index}`} 322 key={`${col}-${row}-${index}`}
@@ -369,14 +345,23 @@ const Typesetting = props =&gt; { @@ -369,14 +345,23 @@ const Typesetting = props =&gt; {
369 justifyContent: "center", 345 justifyContent: "center",
370 alignItems: "center", 346 alignItems: "center",
371 position: "absolute", 347 position: "absolute",
372 - left: `${dFLengthOffset + dYBJJ}px`,  
373 - top: `${iFAngle === 90 || iFAngle === 270 ? dFLengthOffset : dFWidthOffset + dXBJJ}px`, 348 + left: `${dFLengthOffset}px`,
  349 + top: `${iFAngle === 90 || iFAngle === 270 ? dFLengthOffset : dFWidthOffset}px`,
374 }} 350 }}
375 > 351 >
376 <div style={{ transform: `rotateZ(${iFAngle}deg)` }}> 352 <div style={{ transform: `rotateZ(${iFAngle}deg)` }}>
377 - {!sSvgPath ? <DynamicSVG {...svgProps} /> : <img src={sSvgPath} width={ `${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`} height={ `${iFAngle === 90 || iFAngle === 270 ? jInnerHeight : innerHeight}px`} />} 353 + {!sSvgPath ? (
  354 + <DynamicSVG {...svgProps} />
  355 + ) : (
  356 + <img
  357 + src={sSvgPath}
  358 + width={`${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`}
  359 + height={`${iFAngle === 90 || iFAngle === 270 ? jInnerHeight : innerHeight}px`}
  360 + />
  361 + )}
378 </div> 362 </div>
379 </div> 363 </div>
  364 + {/* 次盒 */}
380 <div 365 <div
381 key={`${col}-${row}-${index}-1`} 366 key={`${col}-${row}-${index}-1`}
382 style={{ 367 style={{
@@ -386,14 +371,24 @@ const Typesetting = props =&gt; { @@ -386,14 +371,24 @@ const Typesetting = props =&gt; {
386 justifyContent: "center", 371 justifyContent: "center",
387 alignItems: "center", 372 alignItems: "center",
388 position: "absolute", 373 position: "absolute",
389 - left: `${isVertical ? dSLengthOffset :iSAngle === 90 || iSAngle === 270 ? innerHeight + dFLengthOffset + dSLengthOffset + dYBJJ * 2: innerWidth + dFLengthOffset + dSLengthOffset + dYBJJ * 2}px`,  
390 - top: `${  
391 - isVertical ? jInnerHeight + dXBJJ + dFWidthOffset + dSWidthOffset : iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset + dXBJJ 374 + left: `${
  375 + isVertical ? dSLengthOffset : iSAngle === 90 || iSAngle === 270
  376 + ? innerHeight + dFLengthOffset + dSLengthOffset + dYBJJ
  377 + : innerWidth + dFLengthOffset + dSLengthOffset + dYBJJ
392 }px`, 378 }px`,
  379 + top: `${isVertical ? jInnerHeight + dFWidthOffset + dSWidthOffset + dXBJJ: iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset}px`,
393 }} 380 }}
394 > 381 >
395 <div style={{ transform: `rotateZ(${iSAngle}deg)` }}> 382 <div style={{ transform: `rotateZ(${iSAngle}deg)` }}>
396 - {!sSvgPath ? <DynamicSVG {...svgProps} /> : <img src={sSvgPath} width={ `${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`} height={`${iSAngle === 90 || iSAngle === 270 ? jInnerHeight : innerHeight}px`} />} 383 + {!sSvgPath ? (
  384 + <DynamicSVG {...svgProps} />
  385 + ) : (
  386 + <img
  387 + src={sSvgPath}
  388 + width={`${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`}
  389 + height={`${iSAngle === 90 || iSAngle === 270 ? jInnerHeight : innerHeight}px`}
  390 + />
  391 + )}
397 </div> 392 </div>
398 </div> 393 </div>
399 </div> 394 </div>
@@ -426,8 +421,8 @@ const Typesetting = props =&gt; { @@ -426,8 +421,8 @@ const Typesetting = props =&gt; {
426 justifyContent: "center", 421 justifyContent: "center",
427 alignItems: "center", 422 alignItems: "center",
428 position: "absolute", 423 position: "absolute",
429 - left: `${dFLengthOffset + dYBJJ}px`,  
430 - top: `${dFWidthOffset + dXBJJ}px`, 424 + left: `${dFLengthOffset}px`,
  425 + top: `${dFWidthOffset}px`,
431 }} 426 }}
432 > 427 >
433 {/* <img src={icon} width="100%" height="100%" /> */} 428 {/* <img src={icon} width="100%" height="100%" /> */}
@@ -486,14 +481,13 @@ const Typesetting = props =&gt; { @@ -486,14 +481,13 @@ const Typesetting = props =&gt; {
486 }, [radioValue, slaveRowData, masterData, selectedNode, slaveData]); 481 }, [radioValue, slaveRowData, masterData, selectedNode, slaveData]);
487 // 生成里层 div 的数组 482 // 生成里层 div 的数组
488 const innerDivs = []; 483 const innerDivs = [];
489 -  
490 - console.log(cols,rows,'cols');  
491 - 484 + console.log("🚀 ~ typeSetting:",cols, rows,dZBLB,dSBLB)
  485 +
492 for (let col = 0; col < cols; col++) { 486 for (let col = 0; col < cols; col++) {
493 for (let row = 0; row < rows; row++) { 487 for (let row = 0; row < rows; row++) {
494 - const leftPosition = col * innerWidthCombined;  
495 - const topPosition = row * innerHeightCombined;  
496 - innerDivs.push(createBox(col, row, 1, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); 488 + const leftPosition = col * (innerWidthCombined + dYBJJ);
  489 + const topPosition = row * (innerHeightCombined + dXBJJ);
  490 + innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
497 } 491 }
498 // 如果可以放下首盒 492 // 如果可以放下首盒
499 if (remaining) { 493 if (remaining) {
@@ -506,10 +500,10 @@ const Typesetting = props =&gt; { @@ -506,10 +500,10 @@ const Typesetting = props =&gt; {
506 leftPosition = col * innerWidthCombined; 500 leftPosition = col * innerWidthCombined;
507 topPosition = rows * innerHeightCombined; 501 topPosition = rows * innerHeightCombined;
508 } else { 502 } else {
509 - leftPosition = col * innerWidthCombined;  
510 - topPosition = rows * innerHeightCombined; 503 + leftPosition = col * (innerWidthCombined + dYBJJ); ;
  504 + topPosition = rows *( innerHeightCombined + dXBJJ);
511 } 505 }
512 - innerDivs.push(createBoxOne(col, rows, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); 506 + innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
513 } else { 507 } else {
514 for (let index = 0; index < rows; index++) { 508 for (let index = 0; index < rows; index++) {
515 // 先默认为首盒参考 509 // 先默认为首盒参考
@@ -522,7 +516,7 @@ const Typesetting = props =&gt; { @@ -522,7 +516,7 @@ const Typesetting = props =&gt; {
522 topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset); 516 topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset);
523 leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset); 517 leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset);
524 } 518 }
525 - innerDivs.push(createDiv(col, index, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); 519 + innerDivs.push(createDiv(col, index, 3, leftPosition + (col * dYBJJ), topPosition + (index * dXBJJ), iFAngle, DisableMateriallIcon));
526 } 520 }
527 } 521 }
528 } 522 }
@@ -533,20 +527,19 @@ const Typesetting = props =&gt; { @@ -533,20 +527,19 @@ const Typesetting = props =&gt; {
533 if (maxLength > innerWidth) { 527 if (maxLength > innerWidth) {
534 let leftPosition = 0; 528 let leftPosition = 0;
535 let topPosition = 0; 529 let topPosition = 0;
536 -  
537 - innerDivs.push(createBoxOne(0, rows, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); 530 + innerDivs.push(createBoxOne(0, rows, 3, leftPosition , topPosition , iFAngle, DisableMateriallIcon));
538 } 531 }
539 } 532 }
540 - // 如果第一列 533 + // 如果第一列
541 if (rows === 0) { 534 if (rows === 0) {
542 - const maxWidth = Number(slaveDataDetail?.dMaxWidth) 535 + const maxWidth = Number(slaveDataDetail?.dMaxWidth);
543 if (maxWidth > innerHeight) { 536 if (maxWidth > innerHeight) {
544 - let leftPosition = 0; 537 + let leftPosition = 0;
545 let topPosition = 0; 538 let topPosition = 0;
546 - innerDivs.push(createBoxOne(cols, 0, 3, leftPosition + dZBLB, topPosition + dSBLB, iFAngle, DisableMateriallIcon)); 539 + innerDivs.push(createBoxOne(cols, 0, 3, leftPosition , topPosition, iFAngle, DisableMateriallIcon));
547 } 540 }
548 } 541 }
549 - console.log(cols, '列数', rows, '行数'); 542 +
550 // 判断展开长展开宽是否变化 543 // 判断展开长展开宽是否变化
551 if (dPartsLength !== innerWidth && !innerDivs.length) { 544 if (dPartsLength !== innerWidth && !innerDivs.length) {
552 setDPartsLength(innerWidth); 545 setDPartsLength(innerWidth);
@@ -562,11 +555,11 @@ const Typesetting = props =&gt; { @@ -562,11 +555,11 @@ const Typesetting = props =&gt; {
562 const propsDataHeight = Number(propsData.props.style.height.slice(0, -2)); 555 const propsDataHeight = Number(propsData.props.style.height.slice(0, -2));
563 const propsDataTop = Number(propsData.props.style.top.slice(0, -2)); 556 const propsDataTop = Number(propsData.props.style.top.slice(0, -2));
564 // 判断列是否是单独的 557 // 判断列是否是单独的
565 - const newMaterialLength = propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) - dYBJJ; // 原纸长  
566 - const newMaterialWidth = propsDataTop + propsDataHeight - dSBLB; 558 + const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dSBLB + dXBLB).toFixed(2); // 原纸长
  559 + const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dZBLB + dYBLB).toFixed(2);
567 560
568 // 计算开数 561 // 计算开数
569 - const dSinglePQty = isVertical 562 + let dSinglePQty = isVertical
570 ? remaining 563 ? remaining
571 ? cols + cols * (rows * 2) 564 ? cols + cols * (rows * 2)
572 : cols * (rows * 2) 565 : cols * (rows * 2)
@@ -574,6 +567,10 @@ const Typesetting = props =&gt; { @@ -574,6 +567,10 @@ const Typesetting = props =&gt; {
574 ? rows + rows * (cols * 2) 567 ? rows + rows * (cols * 2)
575 : rows * (cols * 2); 568 : rows * (cols * 2);
576 // 计算竖版数量 569 // 计算竖版数量
  570 + if ((cols === 1 && rows === 0 )|| (cols === 0 && rows === 1 )) {
  571 + dSinglePQty = 1
  572 + }
  573 +
577 const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; 574 const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2;
578 const dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows; 575 const dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows;
579 576
@@ -643,15 +640,15 @@ const Typesetting = props =&gt; { @@ -643,15 +640,15 @@ const Typesetting = props =&gt; {
643 setTimeout(() => { 640 setTimeout(() => {
644 if (typesettingBox.current) { 641 if (typesettingBox.current) {
645 typesettingBox.current.style.backgroundColor = "#b7e0ff"; 642 typesettingBox.current.style.backgroundColor = "#b7e0ff";
646 - typesettingBox.current.style.marginTop = dSBLB + "px";  
647 - typesettingBox.current.style.marginLeft = dZBLB + "px"; 643 + // typesettingBox.current.style.margin = [dSBLB, dYBLB, dXBLB, dZBLB].map(item => item + "px").join(" ");
648 typesettingBox.current.style.width = newMaterialLength + dYBLB + "px"; 644 typesettingBox.current.style.width = newMaterialLength + dYBLB + "px";
649 typesettingBox.current.style.height = newMaterialWidth + dXBLB + "px"; 645 typesettingBox.current.style.height = newMaterialWidth + dXBLB + "px";
  646 + // typesettingBox.current.style.top = dSBLB + "px";
  647 + // typesettingBox.current.style.left = dZBLB + "px";
650 } 648 }
651 if (typesettingBoxs.current) { 649 if (typesettingBoxs.current) {
652 - typesettingBoxs.current.style.backgroundColor = "#b7e0ff";  
653 - typesettingBoxs.current.style.marginTop = dSBLB + "px";  
654 - typesettingBoxs.current.style.marginLeft = dZBLB + "px"; 650 + typesettingBoxs.current.style.backgroundColor = "#b7e0ff";
  651 + // typesettingBox.current.style.margin = [dSBLB, dYBLB, dXBLB, dZBLB].map(item => item + "px").join(" ");
655 typesettingBoxs.current.style.width = newMaterialLength + dYBLB + "px"; 652 typesettingBoxs.current.style.width = newMaterialLength + dYBLB + "px";
656 typesettingBoxs.current.style.height = newMaterialWidth + dXBLB + "px"; 653 typesettingBoxs.current.style.height = newMaterialWidth + dXBLB + "px";
657 } 654 }
@@ -673,11 +670,11 @@ const Typesetting = props =&gt; { @@ -673,11 +670,11 @@ const Typesetting = props =&gt; {
673 isShow, 670 isShow,
674 "isMax" 671 "isMax"
675 ); 672 );
676 - const confirmParam = commonFunc.showLocalMessage(props, 'confirmParam', '排版尺寸大于上机尺寸,请确认参数!'); 673 + const confirmParam = commonFunc.showLocalMessage(props, "confirmParam", "排版尺寸大于上机尺寸,请确认参数!");
677 674
678 if (isCustomized && !isShow) { 675 if (isCustomized && !isShow) {
679 if (isMobile) return; 676 if (isMobile) return;
680 - message.error( confirmParam); 677 + message.error(confirmParam);
681 } 678 }
682 const onClick = () => { 679 const onClick = () => {
683 if (isMobile) return; 680 if (isMobile) return;
@@ -716,11 +713,13 @@ const Typesetting = props =&gt; { @@ -716,11 +713,13 @@ const Typesetting = props =&gt; {
716 right: 0, 713 right: 0,
717 zIndex: 10, 714 zIndex: 10,
718 maxHeight: `${clientHeight}`, 715 maxHeight: `${clientHeight}`,
719 - padding: `${dSBLB}px ${dYBLB}px ${dXBLB}px ${dZBLB}px`, 716 + // padding: `${dSBLB}px ${dYBLB}px ${dXBLB}px ${dZBLB}px`,
720 }} 717 }}
721 > 718 >
722 <div style={style} ref={boxRef}> 719 <div style={style} ref={boxRef}>
723 - {boxList.length ? innerDivs : []} 720 + <div style={{ position: "absolute", width: `${materialLength}px`, height: `${materialWidth}px`, marginLeft:`${dZBLB}px`, marginTop:`${dSBLB}px`,marginRight:`${dYBLB}px`, marginBottom:`${dXBLB}px` }}>
  721 + {boxList.length ? innerDivs : []}
  722 + </div>
724 <div 723 <div
725 ref={typesettingBox} 724 ref={typesettingBox}
726 style={{ 725 style={{
@@ -745,7 +744,7 @@ const Typesetting = props =&gt; { @@ -745,7 +744,7 @@ const Typesetting = props =&gt; {
745 transformOrigin: "top left", 744 transformOrigin: "top left",
746 }} 745 }}
747 > 746 >
748 - <span style={{ color: "red", display: "inline-block", width: "50px" }}>{materialLength}</span> 747 + <span style={{ color: "red", display: "inline-block", width: "100px" }}>{materialLength}</span>
749 <div className={styles.maxWidthLeft}> 748 <div className={styles.maxWidthLeft}>
750 <VerticalRightOutlined /> 749 <VerticalRightOutlined />
751 <div 750 <div
@@ -1004,7 +1003,7 @@ const Typesetting = props =&gt; { @@ -1004,7 +1003,7 @@ const Typesetting = props =&gt; {
1004 wordBreak: "break-all", // 确保长单词换行 1003 wordBreak: "break-all", // 确保长单词换行
1005 }} 1004 }}
1006 > 1005 >
1007 - {confirmParam} 1006 + {confirmParam}
1008 </span> 1007 </span>
1009 </div> 1008 </div>
1010 )} 1009 )}
@@ -1037,7 +1036,9 @@ const Typesetting = props =&gt; { @@ -1037,7 +1036,9 @@ const Typesetting = props =&gt; {
1037 }} 1036 }}
1038 > 1037 >
1039 <div style={{ ...style, position: "absolute", left: "50%" }} ref={boxsRef}> 1038 <div style={{ ...style, position: "absolute", left: "50%" }} ref={boxsRef}>
1040 - {boxList.length ? innerDivs : []} 1039 + <div style={{ position: "absolute", width: `${materialLength}px`, height: `${materialWidth}px`, marginLeft:`${dZBLB}px`, marginTop:`${dSBLB}px`,marginRight:`${dYBLB}px`, marginBottom:`${dXBLB}px`}}>
  1040 + {boxList.length ? innerDivs : []}
  1041 + </div>
1041 <div 1042 <div
1042 ref={typesettingBoxs} 1043 ref={typesettingBoxs}
1043 style={{ 1044 style={{
@@ -1060,7 +1061,7 @@ const Typesetting = props =&gt; { @@ -1060,7 +1061,7 @@ const Typesetting = props =&gt; {
1060 color: "#333", 1061 color: "#333",
1061 }} 1062 }}
1062 > 1063 >
1063 - <span style={{ color: "red", display: "inline-block", width: "50px" }}>{materialLength}</span> 1064 + <span style={{ color: "red", display: "inline-block", width: "100px" }}>{materialLength}</span>
1064 <div className={styles.maxWidthLeft}> 1065 <div className={styles.maxWidthLeft}>
1065 <LeftOutlined style={{ fontSize: "20px" }} /> 1066 <LeftOutlined style={{ fontSize: "20px" }} />
1066 <div 1067 <div
@@ -1120,11 +1121,11 @@ const Typesetting = props =&gt; { @@ -1120,11 +1121,11 @@ const Typesetting = props =&gt; {
1120 color: "#333", 1121 color: "#333",
1121 }} 1122 }}
1122 > 1123 >
1123 - <span style={{ color: "red", display: "inline-block", width: "50px" }}>{materialWidth}</span> 1124 + <span style={{ color: "red", display: "inline-block", width: "100px" }}>{materialWidth}</span>
1124 <div 1125 <div
1125 style={{ 1126 style={{
1126 position: "absolute", 1127 position: "absolute",
1127 - top: `-${materialWidth / 2 - dSBLB}px`, 1128 + top: `-${materialWidth / 2 }px`,
1128 left: "14px", 1129 left: "14px",
1129 width: "20px", 1130 width: "20px",
1130 }} 1131 }}
@@ -1135,7 +1136,7 @@ const Typesetting = props =&gt; { @@ -1135,7 +1136,7 @@ const Typesetting = props =&gt; {
1135 height: `${materialWidth * 0.3}px`, 1136 height: `${materialWidth * 0.3}px`,
1136 position: "absolute", 1137 position: "absolute",
1137 right: "10px", 1138 right: "10px",
1138 - top: `${materialWidth / 2 - dSBLB + 8}px`, 1139 + top: `${materialWidth / 2 + 8}px`,
1139 width: "2px", 1140 width: "2px",
1140 backgroundColor: "#333", 1141 backgroundColor: "#333",
1141 }} 1142 }}
@@ -1146,7 +1147,7 @@ const Typesetting = props =&gt; { @@ -1146,7 +1147,7 @@ const Typesetting = props =&gt; {
1146 width: "30px", 1147 width: "30px",
1147 backgroundColor: "#333", 1148 backgroundColor: "#333",
1148 position: "absolute", 1149 position: "absolute",
1149 - top: `${materialWidth / 2 - dSBLB}px`, 1150 + top: `${materialWidth / 2 }px`,
1150 right: "-4.5px", 1151 right: "-4.5px",
1151 }} 1152 }}
1152 /> 1153 />
src/components/QuickQuote/index.jsx
@@ -215,6 +215,7 @@ const QuickQuoteEvent = props =&gt; { @@ -215,6 +215,7 @@ const QuickQuoteEvent = props =&gt; {
215 upAbleConfigsExtra: sColumnNameConfig, 215 upAbleConfigsExtra: sColumnNameConfig,
216 }; 216 };
217 } else { 217 } else {
  218 + if(!slaveData[0]) return
218 const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[0].sColumnNameConfig, []).map(item => ({ 219 const sColumnNameConfig = commonUtils.convertStrToObj(slaveData[0].sColumnNameConfig, []).map(item => ({
219 ...item, 220 ...item,
220 iColValue: item.iColValue || 6, 221 iColValue: item.iColValue || 6,
@@ -2004,7 +2005,7 @@ const BoxComponent = props =&gt; { @@ -2004,7 +2005,7 @@ const BoxComponent = props =&gt; {
2004 slaveNewData.forEach(x => { 2005 slaveNewData.forEach(x => {
2005 let key = 0; 2006 let key = 0;
2006 if (x.sAssignFormula) { 2007 if (x.sAssignFormula) {
2007 - key = evaluateFormula(x.sAssignFormula, variables); 2008 + key = parseFloat(evaluateFormula(x.sAssignFormula, variables)).toFixed(2);
2008 slaveRowData[x.sName] = key; 2009 slaveRowData[x.sName] = key;
2009 } else { 2010 } else {
2010 key = slaveRowData[x.sName]; 2011 key = slaveRowData[x.sName];