diff --git a/src/components/Common/BoxDesign/createAirplaneBox.js b/src/components/Common/BoxDesign/createAirplaneBox.js index 873e124..903dea0 100644 --- a/src/components/Common/BoxDesign/createAirplaneBox.js +++ b/src/components/Common/BoxDesign/createAirplaneBox.js @@ -666,8 +666,8 @@ const createSvg = d => { const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); svg.setAttribute("d", d); svg.setAttribute("fill", "transparent"); - svg.setAttribute("stroke", "#7588B9"); - svg.setAttribute("stroke-width", "1"); + svg.setAttribute("stroke", "#333"); + svg.setAttribute("stroke-width", "0.5"); return svg; }; const createDasharraySvg = d => { diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js index 3d6f025..5e09d3b 100644 --- a/src/components/Common/BoxDesignCompontent/svg.js +++ b/src/components/Common/BoxDesignCompontent/svg.js @@ -324,7 +324,7 @@ const SvgBox = props => { } else { leftSize = zbtb?.value; } - svg.setAttribute("viewBox", `${-(leftSize * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); + svg.setAttribute("viewBox", `${-((leftSize) * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); svg.setAttribute("width", `${dSvgBoxWidth}px`); svg.setAttribute("height", `${dSvgBoxHeight}px`); svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js index 9059053..41d254d 100644 --- a/src/components/Common/CommonComponent/index.js +++ b/src/components/Common/CommonComponent/index.js @@ -2880,8 +2880,6 @@ export default class CommonComponent extends Component { /* 如果是选择空值,则将特殊字符过滤为空值 */ value = ""; } - console.log("🚀 ~ sAssignFieldObj:", 66666) - /* 回带值声明 */ const returnValue = {}; const { searchValue, searchDropDownData, dropDownData } = this.state; diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index 48a5979..773bce7 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -94,24 +94,25 @@ const Typesetting = props => { const H = masterData?.dWidth || 0; const D = masterData?.dHeight || 0; // 动态计算公式值 - const evaluateFormula = (formula, variables) => { - if (!formula) return 0; // 如果公式为空,返回0 - try { - // 提取公式中的变量名 - const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || []; - // 构建函数参数 - const params = variableNames.join(","); - // 替换公式中的变量为实际值 - const func = new Function(params, `return ${formula}`); - // 提取变量值 - const args = variableNames.map(name => Number(variables[name]) || 0); - // 执行函数并返回结果 - return func(...args); - } catch (error) { - console.error("公式执行错误:", error); - return 0; - } -}; +const evaluateFormula = (formula, variables) => { + if (!formula) return 0; // 如果公式为空,返回0 + try { + // 提取公式中的变量名 + const variableNames = formula.match(/\b[a-zA-Z_][a-zA-Z0-9_]*\b/g) || []; + // 构建函数参数 + const params = variableNames.join(",") + ",Math"; + // 替换公式中的变量为实际值 + const func = new Function(params, `return ${formula}`); + // 提取变量值 + const args = variableNames.map(name => Number(variables[name]) || 0); + // 执行函数并返回结果 + return func(...args, Math); + } catch (error) { + console.error("公式执行错误:", error); + return 0; + } + }; + // 计算公式值 const variables = { L, @@ -217,13 +218,12 @@ const Typesetting = props => { // dSvgBoxHeight = jInnerHeight; // dSvgBoxWidth = jInnerWidth; } - const innerHeightCombined = isVertical - ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset - : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset); + const innerHeightCombined = isVertical ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset + dXBJJ: Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量 // 计算内层盒子宽度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量 const innerWidthCombined = isVertical - ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) - : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset; + ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) + dYBJJ + : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset + dYBJJ; +console.log('总高',innerHeightCombined,'总款',innerWidthCombined); const style = { width: `${outerWidth}px`, @@ -235,7 +235,8 @@ const Typesetting = props => { // 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量 const dSWidthOffsetCombined = innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset); let cols = dSWidthOffsetCombined === 0 ? 0 : Math.floor(outerWidth / dSWidthOffsetCombined); - let rows = Math.floor(outerHeight / (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset))); + const rowsCombined = innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset); + let rows =rowsCombined === 0 ? 0 : Math.floor(outerHeight / (rowsCombined)); let colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined; while (colsMaxLength >= outerWidth && cols > 0) { cols = cols - 1; @@ -247,6 +248,7 @@ const Typesetting = props => { rows = rows - 1; rowsMaxLength = (rows - 1) * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) + innerHeightCombined; } +console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeight"); // 最大上机长 上机宽 开料尺寸 // 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量