Commit 6aad692714b207c79a9913be48065bdf9fa6aa9c

Authored by 陈鑫涛
1 parent a9e11287

增加四舍五入计算

src/components/Common/CommonComponent/index.js
... ... @@ -2880,6 +2880,7 @@ export default class CommonComponent extends Component {
2880 2880 /* 如果是选择空值,则将特殊字符过滤为空值 */
2881 2881 value = "";
2882 2882 }
  2883 + console.log("🚀 ~ sAssignFieldObj:", 66666)
2883 2884  
2884 2885 /* 回带值声明 */
2885 2886 const returnValue = {};
... ... @@ -2923,6 +2924,7 @@ export default class CommonComponent extends Component {
2923 2924 const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString());
2924 2925 if (!commonUtils.isEmpty(sAssignField)) {
2925 2926 /* 赋值数组 */
  2927 +
2926 2928 const sAssignFieldObj = sAssignField.split(",");
2927 2929 if (commonUtils.isNotEmptyObject(changeData)) {
2928 2930 for (const child of sAssignFieldObj) {
... ...
src/components/Common/Typesetting/typesetting.js
... ... @@ -59,7 +59,7 @@ const Typesetting = props => {
59 59 const [materialWidth, setMaterialWidth] = useState(0);
60 60 const [dProductQty, setDProductQty] = useState(0);
61 61 const [materialName, setMaterialName] = useState("");
62   - const [dMaterialsKQty, setDMaterialsKQty] = useState(0);
  62 + // const [dMaterialsKQty, setDMaterialsKQty] = useState(0);
63 63 const [dPartsLength, setDPartsLength] = useState(0);
64 64 const [newDHorizontalType, setNewDHorizontalType] = useState(0);
65 65 const [newDPortraitType, setNewDPortraitType] = useState(0);
... ... @@ -70,6 +70,8 @@ const Typesetting = props => {
70 70 const boxsRef = useRef(null);
71 71 const typesettingBox = useRef(null);
72 72 const typesettingBoxs = useRef(null);
  73 + const svgBox = useRef(null);
  74 + const svgBoxs = useRef(null);
73 75 // 获取外层盒子尺寸
74 76 const clientWidth = boxWidth || 400;
75 77 const clientHeight = boxHeight || 300;
... ... @@ -92,23 +94,24 @@ const Typesetting = props => {
92 94 const H = masterData?.dWidth || 0;
93 95 const D = masterData?.dHeight || 0;
94 96 // 动态计算公式值
95   - const evaluateFormula = (formula, variables) => {
96   - if (!formula) return 0; // 如果公式为空,返回0
97   - try {
98   - // 提取公式中的变量名
99   - const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];
100   - // 构建函数参数
101   - const params = variableNames.join(",");
102   - // 替换公式中的变量为实际值
103   - const func = new Function(params, `return ${formula}`);
104   - // 提取变量值
105   - const args = variableNames.map(name => Number(variables[name]) || 0);
106   - // 执行函数并返回结果
107   - return func(...args);
108   - } catch (error) {
109   - return 0;
110   - }
111   - };
  97 + const evaluateFormula = (formula, variables) => {
  98 + if (!formula) return 0; // 如果公式为空,返回0
  99 + try {
  100 + // 提取公式中的变量名
  101 + const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];
  102 + // 构建函数参数
  103 + const params = variableNames.join(",");
  104 + // 替换公式中的变量为实际值
  105 + const func = new Function(params, `return ${formula}`);
  106 + // 提取变量值
  107 + const args = variableNames.map(name => Number(variables[name]) || 0);
  108 + // 执行函数并返回结果
  109 + return func(...args);
  110 + } catch (error) {
  111 + console.error("公式执行错误:", error);
  112 + return 0;
  113 + }
  114 +};
112 115 // 计算公式值
113 116 const variables = {
114 117 L,
... ... @@ -119,7 +122,7 @@ const Typesetting = props => {
119 122 };
120 123 const { sStripType = 0 } = props.state.selectedNode;
121 124 let boxList = [];
122   - if (sColumnNameConfig ) {
  125 + if (sColumnNameConfig) {
123 126 const slaveNewData = JSON.parse(sColumnNameConfig);
124 127 const tables = [
125 128 { name: "盒型类别", value: slaveRowData.sBoxType, type: null },
... ... @@ -200,13 +203,14 @@ const Typesetting = props => {
200 203 const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移
201 204 const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下'
202 205 const reference = sSGroupOffset === "首盒"; // 第三列参考
203   - console.log(innerWidth,innerHeight,dFWidthOffset,dFLengthOffset,dSWidthOffset,dSLengthOffset,boxLengthOffset,boxWidthOffset,'typeSetting');
204   -
  206 + console.log(innerWidth, innerHeight, dFWidthOffset, dFLengthOffset, dSWidthOffset, dSLengthOffset, boxLengthOffset, boxWidthOffset, "typeSetting");
  207 +
205 208 // 计算内层盒子尺寸 加上间距
206 209 let jInnerHeight = innerHeight;
207 210 let jInnerWidth = innerWidth;
208 211 let dSvgBoxWidth = innerWidth;
209 212 let dSvgBoxHeight = innerHeight;
  213 + const isRrotate = iFAngle === 90 || iFAngle === 270 || iSAngle === 90 || iSAngle === 270;
210 214 if (iFAngle === 90 || iFAngle === 270 || iSAngle === 90 || iSAngle === 270) {
211 215 jInnerHeight = innerWidth;
212 216 jInnerWidth = innerHeight;
... ... @@ -229,8 +233,8 @@ const Typesetting = props => {
229 233 };
230 234 // 加上间距后的最大盒子长宽 计算每列可以放多少个组合 需要计算间距
231 235 // 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量
232   - const dSWidthOffsetCombined = (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset))
233   - let cols = dSWidthOffsetCombined === 0 ? 0 : Math.floor(outerWidth / dSWidthOffsetCombined);
  236 + const dSWidthOffsetCombined = innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset);
  237 + let cols = dSWidthOffsetCombined === 0 ? 0 : Math.floor(outerWidth / dSWidthOffsetCombined);
234 238 let rows = Math.floor(outerHeight / (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)));
235 239 let colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined;
236 240 while (colsMaxLength >= outerWidth && cols > 0) {
... ... @@ -373,11 +377,15 @@ const Typesetting = props => {
373 377 alignItems: "center",
374 378 position: "absolute",
375 379 left: `${
376   - isVertical ? dSLengthOffset : iSAngle === 90 || iSAngle === 270
  380 + isVertical
  381 + ? dSLengthOffset
  382 + : iSAngle === 90 || iSAngle === 270
377 383 ? innerHeight + dFLengthOffset + dSLengthOffset + dYBJJ
378 384 : innerWidth + dFLengthOffset + dSLengthOffset + dYBJJ
379 385 }px`,
380   - top: `${isVertical ? jInnerHeight + dFWidthOffset + dSWidthOffset + dXBJJ: iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset}px`,
  386 + top: `${
  387 + isVertical ? jInnerHeight + dFWidthOffset + dSWidthOffset + dXBJJ : iSAngle === 90 || iSAngle === 270 ? dSWidthOffset : dSWidthOffset
  388 + }px`,
381 389 }}
382 390 >
383 391 <div style={{ transform: `rotateZ(${iSAngle}deg)` }}>
... ... @@ -416,8 +424,8 @@ const Typesetting = props =&gt; {
416 424 <div
417 425 key={`${col}-${row}-${index}`}
418 426 style={{
419   - width: `${innerWidth}px`,
420   - height: `${innerHeight}px`,
  427 + width: `${jInnerWidth}px`,
  428 + height: `${jInnerHeight}px`,
421 429 display: "flex",
422 430 justifyContent: "center",
423 431 alignItems: "center",
... ... @@ -469,7 +477,7 @@ const Typesetting = props =&gt; {
469 477 useEffect(() => {
470 478 // 计算缩放比例
471 479 // setBoxKey(new Date().getTime());
472   - // setTimeout(() => {
  480 + setTimeout(() => {
473 481 const scaleX = (clientWidth - 50) / (outerWidth + 110);
474 482 const scaleY = (clientHeight - 5) / (outerHeight + 90);
475 483 const newScale = Math.min(scaleX, scaleY);
... ... @@ -478,68 +486,91 @@ const Typesetting = props =&gt; {
478 486 boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`;
479 487 boxRef.current.style.transformOrigin = "top left";
480 488 }
481   - // }, 0);
  489 + }, 0);
482 490 }, [radioValue, slaveRowData, masterData, selectedNode, slaveData]);
483 491 // 生成里层 div 的数组
484 492 const innerDivs = [];
485   -
486   - for (let col = 0; col < cols; col++) {
487   - for (let row = 0; row < rows; row++) {
488   - const leftPosition = col * (innerWidthCombined + dYBJJ);
489   - const topPosition = row * (innerHeightCombined + dXBJJ);
490   - innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  493 + // 生成盒子
  494 + if (cols === 0 || rows === 0) {
  495 + if (cols > 0) {
  496 + for (let col = 0; col < cols; col++) {
  497 + const leftPosition = col * (innerWidthCombined + dYBJJ);
  498 + const topPosition = 0 * (innerHeightCombined + dXBJJ);
  499 + innerDivs.push(createBoxOne(col, 0, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  500 + }
491 501 }
492   - // 如果可以放下首盒
493   - if (remaining) {
494   - if (isVertical) {
495   - let leftPosition = 0;
496   - let topPosition = 0;
497   - if (reference) {
498   - // 是否首盒
499   - // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距
500   - leftPosition = col * innerWidthCombined;
501   - topPosition = rows * innerHeightCombined;
502   - } else {
503   - leftPosition = col * (innerWidthCombined + dYBJJ); ;
504   - topPosition = rows *( innerHeightCombined + dXBJJ);
505   - }
506   - innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
507   - } else {
508   - for (let index = 0; index < rows; index++) {
509   - // 先默认为首盒参考
510   - let topPosition = 0;
  502 + if (rows > 0) {
  503 + for (let row = 0; row < rows; row++) {
  504 + const leftPosition = 0 * (innerWidthCombined + dYBJJ);
  505 + const topPosition = row * (innerHeightCombined + dXBJJ);
  506 + innerDivs.push(createBoxOne(0, row, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  507 + }
  508 + }
  509 + } else {
  510 + for (let col = 0; col < cols; col++) {
  511 + for (let row = 0; row < rows; row++) {
  512 + const leftPosition = col * (innerWidthCombined + dYBJJ);
  513 + const topPosition = row * (innerHeightCombined + dXBJJ);
  514 + innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  515 + }
  516 + // 如果可以放下首盒
  517 + if (remaining) {
  518 + if (isVertical) {
511 519 let leftPosition = 0;
  520 + let topPosition = 0;
512 521 if (reference) {
513   - topPosition = index * (innerHeightCombined + boxWidthOffset);
514   - leftPosition = cols * (innerWidthCombined + boxLengthOffset);
  522 + // 是否首盒
  523 + // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距
  524 + leftPosition = col * innerWidthCombined;
  525 + topPosition = rows * innerHeightCombined;
515 526 } else {
516   - topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset);
517   - leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset);
  527 + leftPosition = col * (innerWidthCombined + dYBJJ);
  528 + topPosition = rows * (innerHeightCombined + dXBJJ);
  529 + }
  530 + innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  531 + } else {
  532 + for (let index = 0; index < rows; index++) {
  533 + // 先默认为首盒参考
  534 + let topPosition = 0;
  535 + let leftPosition = 0;
  536 + if (reference) {
  537 + topPosition = index * (innerHeightCombined + boxWidthOffset);
  538 + leftPosition = cols * (innerWidthCombined + boxLengthOffset);
  539 + } else {
  540 + topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset);
  541 + leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset);
  542 + }
  543 + innerDivs.push(createDiv(col, index, 3, leftPosition + col * dYBJJ, topPosition + index * dXBJJ, iFAngle, DisableMateriallIcon));
518 544 }
519   - innerDivs.push(createDiv(col, index, 3, leftPosition + (col * dYBJJ), topPosition + (index * dXBJJ), iFAngle, DisableMateriallIcon));
520 545 }
521 546 }
522 547 }
523 548 }
524   - // 如果第一行只能放下一个
525   - if (cols === 0 && !isVertical) {
526   - const maxLength = Number(slaveDataDetail?.dMaxLength);
527   - if (maxLength > innerWidth) {
528   - let leftPosition = 0;
529   - let topPosition = 0;
530   - innerDivs.push(createBoxOne(0, rows, 3, leftPosition , topPosition , iFAngle, DisableMateriallIcon));
531   - }
532   - }
533   - // 如果第一列
534   - if (rows === 0) {
535   - const maxWidth = Number(slaveDataDetail?.dMaxWidth);
536   - if (maxWidth > innerHeight) {
537   - let leftPosition = 0;
538   - let topPosition = 0;
539   - innerDivs.push(createBoxOne(cols, 0, 3, leftPosition , topPosition, iFAngle, DisableMateriallIcon));
540   - }
541   - }
542   -
  549 +
  550 + // // 如果第一行只能放下一个
  551 + // if (cols === 0 && !isVertical) {
  552 + // const maxLength = Number(slaveDataDetail?.dMaxLength);
  553 + // if (maxLength > innerWidth) {
  554 + // let leftPosition = 0;
  555 + // let topPosition = 0;
  556 + // innerDivs.push(createBoxOne(0, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  557 + // }
  558 + // }
  559 +
  560 + // // 如果第一列
  561 + // if (rows === 0 && isVertical) {
  562 + // const maxWidth = Number(slaveDataDetail?.dMaxWidth);
  563 + // if (maxWidth > innerHeight) {
  564 + // for (let index = 0; index < cols; index++) {
  565 + // let leftPosition = index * (innerWidthCombined + dYBJJ);
  566 + // let topPosition = 0;
  567 + // innerDivs.push(createBoxOne(cols, 0, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
  568 + // }
  569 + // }
  570 + // }
  571 +
  572 + console.log(cols, rows, innerDivs.length, "innerDivs");
  573 +
543 574 // 判断展开长展开宽是否变化
544 575 if (dPartsLength !== innerWidth && !innerDivs.length) {
545 576 setDPartsLength(innerWidth);
... ... @@ -566,14 +597,23 @@ const Typesetting = props =&gt; {
566 597 : remaining
567 598 ? rows + rows * (cols * 2)
568 599 : rows * (cols * 2);
569   - // 计算竖版数量
570   - if ((cols === 1 && rows === 0 )|| (cols === 0 && rows === 1 )) {
571   - dSinglePQty = 1
572   - }
573 600  
574   - const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2;
575   - const dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows;
576 601  
  602 + let dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2;
  603 + let dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows;
  604 + if (cols === 0 || rows === 0) {
  605 + if (innerDivs.length > 0) {
  606 + if (cols === 0 && rows > 0) {
  607 + dSinglePQty = rows;
  608 + dPortraitType = rows;
  609 + dHorizontalType = 1;
  610 + } else if (rows === 0 && cols > 0) {
  611 + dSinglePQty = cols;
  612 + dHorizontalType = cols;
  613 + dPortraitType = 1;
  614 + }
  615 + }
  616 + }
577 617 const newDProductQty = masterData.dProductQty;
578 618 const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1;
579 619 if (
... ... @@ -646,6 +686,14 @@ const Typesetting = props =&gt; {
646 686 // typesettingBox.current.style.top = dSBLB + "px";
647 687 // typesettingBox.current.style.left = dZBLB + "px";
648 688 }
  689 + if (svgBox.current) {
  690 + svgBox.current.style.width = newMaterialLength + dYBLB + "px";
  691 + svgBox.current.style.height = newMaterialWidth + dXBLB + "px";
  692 + }
  693 + if (svgBoxs.current) {
  694 + svgBoxs.current.style.width = newMaterialLength + dYBLB + "px";
  695 + svgBoxs.current.style.height = newMaterialWidth + dXBLB + "px";
  696 + }
649 697 if (typesettingBoxs.current) {
650 698 typesettingBoxs.current.style.backgroundColor = "#b7e0ff";
651 699 // typesettingBox.current.style.margin = [dSBLB, dYBLB, dXBLB, dZBLB].map(item => item + "px").join(" ");
... ... @@ -659,7 +707,7 @@ const Typesetting = props =&gt; {
659 707 Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength) &&
660 708 Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
661 709  
662   - const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
  710 + const isShow = (slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0);
663 711 console.log(
664 712 slaveDataDetail?.dMaxLength,
665 713 slaveDataDetail?.dMaxWidth,
... ... @@ -717,7 +765,18 @@ const Typesetting = props =&gt; {
717 765 }}
718 766 >
719 767 <div style={style} ref={boxRef}>
720   - <div style={{ position: "absolute", width: `${materialLength}px`, height: `${materialWidth}px`, marginLeft:`${dZBLB}px`, marginTop:`${dSBLB}px`,marginRight:`${dYBLB}px`, marginBottom:`${dXBLB}px` }}>
  768 + <div
  769 + ref={svgBox}
  770 + style={{
  771 + position: "absolute",
  772 + // width: `${isRrotate ?materialWidth: materialLength}px`,
  773 + // height: `${isRrotate ?materialLength : materialWidth}px`,
  774 + marginLeft: `${dZBLB}px`,
  775 + marginTop: `${dSBLB}px`,
  776 + marginRight: `${dYBLB}px`,
  777 + marginBottom: `${dXBLB}px`,
  778 + }}
  779 + >
721 780 {boxList.length ? innerDivs : []}
722 781 </div>
723 782 <div
... ... @@ -1036,7 +1095,18 @@ const Typesetting = props =&gt; {
1036 1095 }}
1037 1096 >
1038 1097 <div style={{ ...style, position: "absolute", left: "50%" }} ref={boxsRef}>
1039   - <div style={{ position: "absolute", width: `${materialLength}px`, height: `${materialWidth}px`, marginLeft:`${dZBLB}px`, marginTop:`${dSBLB}px`,marginRight:`${dYBLB}px`, marginBottom:`${dXBLB}px`}}>
  1098 + <div
  1099 + ref={svgBoxs}
  1100 + style={{
  1101 + position: "absolute",
  1102 + // width: `${isRrotate ?materialWidth: materialLength}px`,
  1103 + // height: `${isRrotate ?materialLength : materialWidth}px`,
  1104 + marginLeft: `${dZBLB}px`,
  1105 + marginTop: `${dSBLB}px`,
  1106 + marginRight: `${dYBLB}px`,
  1107 + marginBottom: `${dXBLB}px`,
  1108 + }}
  1109 + >
1040 1110 {boxList.length ? innerDivs : []}
1041 1111 </div>
1042 1112 <div
... ... @@ -1125,7 +1195,7 @@ const Typesetting = props =&gt; {
1125 1195 <div
1126 1196 style={{
1127 1197 position: "absolute",
1128   - top: `-${materialWidth / 2 }px`,
  1198 + top: `-${materialWidth / 2}px`,
1129 1199 left: "14px",
1130 1200 width: "20px",
1131 1201 }}
... ... @@ -1136,7 +1206,7 @@ const Typesetting = props =&gt; {
1136 1206 height: `${materialWidth * 0.3}px`,
1137 1207 position: "absolute",
1138 1208 right: "10px",
1139   - top: `${materialWidth / 2 + 8}px`,
  1209 + top: `${materialWidth / 2 + 8}px`,
1140 1210 width: "2px",
1141 1211 backgroundColor: "#333",
1142 1212 }}
... ... @@ -1147,7 +1217,7 @@ const Typesetting = props =&gt; {
1147 1217 width: "30px",
1148 1218 backgroundColor: "#333",
1149 1219 position: "absolute",
1150   - top: `${materialWidth / 2 }px`,
  1220 + top: `${materialWidth / 2}px`,
1151 1221 right: "-4.5px",
1152 1222 }}
1153 1223 />
... ...
src/components/QuickQuote/index.jsx
... ... @@ -268,7 +268,7 @@ const QuickQuoteEvent = props =&gt; {
268 268 extraState.backendParamsConfig = sParamConfig;
269 269 extraState.backendConfig = { sParentFieldsName: sFieldName, sBoxModel: boxModel };
270 270 const sBackendParams = sParamConfig
271   - .map((item) => {
  271 + .map(item => {
272 272 const { sParamDefault, sParam, sFieldName, iOrder } = item;
273 273 return !sParamDefault
274 274 ? ""
... ... @@ -772,10 +772,10 @@ const QuickQuoteEvent = props =&gt; {
772 772 delete partsDataRow.dMaterialsKQty;
773 773 delete partsDataRow.dMaterialsLength;
774 774 delete partsDataRow.dMaterialsWidth;
775   - if (productClassify.bSpecialRules) {
776   - partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
777   - partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
778   - }
  775 + // if (productClassify.bSpecialRules) {
  776 + // partsDataRow.dMachineLength = partsDataRow.dMaxMachineLength;
  777 + // partsDataRow.dMachineWidth = partsDataRow.dMaxMachineWidth;
  778 + // }
779 779 controlData.push(partsDataRow);
780 780 // 材料信息
781 781 for (let i = 0; i < partInfo.materialsInfo.length; i++) {
... ... @@ -1978,14 +1978,15 @@ const BoxComponent = props =&gt; {
1978 1978 // 提取公式中的变量名
1979 1979 const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || [];
1980 1980 // 构建函数参数
1981   - const params = variableNames.join(",");
  1981 + const params = variableNames.join(",") + ",Math";
1982 1982 // 替换公式中的变量为实际值
1983 1983 const func = new Function(params, `return ${formula}`);
1984 1984 // 提取变量值
1985 1985 const args = variableNames.map(name => Number(variables[name]) || 0);
1986 1986 // 执行函数并返回结果
1987   - return func(...args);
  1987 + return func(...args, Math);
1988 1988 } catch (error) {
  1989 + console.error("公式执行错误:", error);
1989 1990 return 0;
1990 1991 }
1991 1992 };
... ... @@ -2006,7 +2007,7 @@ const BoxComponent = props =&gt; {
2006 2007 slaveNewData.forEach(x => {
2007 2008 let key = 0;
2008 2009 if (x.sAssignFormula) {
2009   - key = parseFloat(evaluateFormula(x.sAssignFormula, variables)).toFixed(2);
  2010 + key = evaluateFormula(x.sAssignFormula, variables);
2010 2011 slaveRowData[x.sName] = key;
2011 2012 } else {
2012 2013 key = slaveRowData[x.sName];
... ... @@ -2958,7 +2959,6 @@ const BackendParamsExtraComponent = props =&gt; {
2958 2959 return props.getSqlDropDownData(...args);
2959 2960 },
2960 2961 onDataChange: (name, sFieldName, changeValue, sId, dropDownData, isWait) => {
2961   -
2962 2962 const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId);
2963 2963 const iIndex1 = slaveData[iIndex].sBackProcessData.findIndex(item => item[sParentFieldsName]);
2964 2964 const showConfig = viewConfigs.find(item => item.sName === sFieldName);
... ...
src/mobile/quotation/detailNew.jsx
... ... @@ -2312,6 +2312,7 @@ const PrintParamsComponent = props =&gt; {
2312 2312 iColValue: 8,
2313 2313 };
2314 2314 });
  2315 + console.log("🚀 ~ printParamsConfig:", printParamsConfig)
2315 2316  
2316 2317 const result = [];
2317 2318 for (let i = 0; i < printParams.length + 1; i++) {
... ...