diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js
index cfa7186..4eea796 100644
--- a/src/components/Common/Typesetting/typesetting.js
+++ b/src/components/Common/Typesetting/typesetting.js
@@ -63,6 +63,7 @@ const Typesetting = props => {
const [dPartsLength, setDPartsLength] = useState(0);
const [newDHorizontalType, setNewDHorizontalType] = useState(0);
const [newDPortraitType, setNewDPortraitType] = useState(0);
+ const [oldVariables, setOldVariables] = useState('')
// 横板
let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData;
// 使用 useRef 获取 DOM 元素
@@ -94,24 +95,24 @@ 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(",") + ",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 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 = {
@@ -124,7 +125,7 @@ const evaluateFormula = (formula, variables) => {
const { sStripType = 0 } = props.state.selectedNode;
let boxList = [];
if (sColumnNameConfig) {
- const slaveNewData = JSON.parse(sColumnNameConfig);
+ const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig);
const tables = [
{ name: "盒型类别", value: slaveRowData.sBoxType, type: null },
{ name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes },
@@ -180,17 +181,14 @@ const evaluateFormula = (formula, variables) => {
});
}
- const result = boxList?.reduce((acc, { sCode, value }) => ({ ...acc, [sCode]: value }), {});
+ const result = boxList?.reduce((acc, { sCode, value }) => ({ ...acc, [sCode]: Number(value) }), {});
// 计算表达式结果
const variabless = {
- L,
- W,
- H,
- D,
- ...props.slaveRowData,
+ ...variables,
...result,
};
+
let DisableMateriallIcon = L ? sPackDetailPath : null;
// 盒子展长展开公式计算
const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless);
@@ -218,12 +216,16 @@ const evaluateFormula = (formula, variables) => {
// dSvgBoxHeight = jInnerHeight;
// dSvgBoxWidth = jInnerWidth;
}
- const innerHeightCombined = isVertical ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset + dXBJJ: Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
+ 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) + dYBJJ
: jInnerWidth * 2 + dSLengthOffset + dFLengthOffset + dYBJJ;
+ console.log(innerWidthCombined,innerHeightCombined,jInnerWidth,jInnerHeight,'innerHeightCombined');
+
const style = {
width: `${outerWidth}px`,
height: `${outerHeight}px`,
@@ -235,7 +237,7 @@ const evaluateFormula = (formula, variables) => {
const dSWidthOffsetCombined = innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset);
let cols = dSWidthOffsetCombined === 0 ? 0 : Math.floor(outerWidth / dSWidthOffsetCombined);
const rowsCombined = innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset);
- let rows =rowsCombined === 0 ? 0 : Math.floor(outerHeight / (rowsCombined));
+ 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,7 +249,7 @@ const evaluateFormula = (formula, variables) => {
rows = rows - 1;
rowsMaxLength = (rows - 1) * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) + innerHeightCombined;
}
-console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeight");
+ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeight");
// 最大上机长 上机宽 开料尺寸
// 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量
@@ -548,29 +550,6 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
}
}
- // // 如果第一行只能放下一个
- // if (cols === 0 && !isVertical) {
- // const maxLength = Number(slaveDataDetail?.dMaxLength);
- // if (maxLength > innerWidth) {
- // let leftPosition = 0;
- // let topPosition = 0;
- // innerDivs.push(createBoxOne(0, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
- // }
- // }
-
- // // 如果第一列
- // if (rows === 0 && isVertical) {
- // const maxWidth = Number(slaveDataDetail?.dMaxWidth);
- // if (maxWidth > innerHeight) {
- // for (let index = 0; index < cols; index++) {
- // let leftPosition = index * (innerWidthCombined + dYBJJ);
- // let topPosition = 0;
- // innerDivs.push(createBoxOne(cols, 0, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
- // }
- // }
- // }
-
- console.log(cols, rows, innerDivs.length, "innerDivs");
// 判断展开长展开宽是否变化
if (dPartsLength !== innerWidth && !innerDivs.length) {
@@ -578,6 +557,7 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
onSaveDPartsLength(innerWidth, innerHeight, slaveData);
}
const propsData = innerDivs[innerDivs.length - 1];
+
let openEdition = 0;
if (propsData && L) {
const sMaterialsName = slaveData.find(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel).sMaterialsName;
@@ -599,7 +579,6 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
? rows + rows * (cols * 2)
: rows * (cols * 2);
-
let dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2;
let dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows;
if (cols === 0 || rows === 0) {
@@ -623,7 +602,8 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
newMaterialWidth !== materialWidth ||
materialName !== sMaterialsName ||
newDHorizontalType !== dHorizontalType ||
- newDPortraitType !== dPortraitType
+ newDPortraitType !== dPortraitType ||
+ oldVariables !== JSON.stringify(slaveRowData)
) {
setMaterialLength(newMaterialLength);
setMaterialWidth(newMaterialWidth);
@@ -632,6 +612,7 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
setDPartsLength(innerWidth);
setNewDHorizontalType(dHorizontalType);
setNewDPortraitType(dPortraitType);
+ setOldVariables(JSON.stringify(slaveRowData));
// setDMaterialsKQty(newDMaterialsKQty)
const scaleX = (clientWidth - 50) / (outerWidth + 110);
const scaleY = (clientHeight - 5) / (outerHeight + 90);
@@ -708,7 +689,7 @@ console.log(cols, rows, outerWidth, outerHeight, "cols rows outerWidth outerHeig
Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength) &&
Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
- const isShow = (slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0);
+ const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
console.log(
slaveDataDetail?.dMaxLength,
slaveDataDetail?.dMaxWidth,
diff --git a/src/mobile/quotation/detailNew.jsx b/src/mobile/quotation/detailNew.jsx
index 75e21c7..dd05299 100644
--- a/src/mobile/quotation/detailNew.jsx
+++ b/src/mobile/quotation/detailNew.jsx
@@ -153,7 +153,7 @@ const QuickQuoteEvent = props => {
const { showName: sTreeNodeName } = selectedNode;
const boxModel = name.replace("slaveUp", "").replace("slaveDown", "");
const iIndex = slaveData.findIndex(item => item.sTreeNodeName === sTreeNodeName && item.sBoxModel === boxModel);
- console.log("🚀 ~ iIndex:", iIndex,boxModel,props)
+ console.log("🚀 ~ iIndex:", iIndex, boxModel, props);
let masterDataNew = { ...masterData, ...changeValue };
masterDataNew.handleType = masterDataNew.handleType || "update";
masterDataNew.sId = commonUtils.createSid();
@@ -1397,7 +1397,6 @@ const BoxComponent = props => {
const slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {};
const { sModelsId } = props;
- console.log("🚀 ~ props:", props)
const [selectList, setSelectList] = useState([]);
const [boxTypeList, setBoxTypeList] = useState([]);
const [searchValue, setSearchValue] = useState("");
@@ -1408,12 +1407,14 @@ const BoxComponent = props => {
// 获取盒型信息
useEffect(() => {
const sId = "17428091410008594700322758474000";
+ console.log(props, "props");
+ const { selectedNode } = props;
const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`;
const body = {
sSqlCondition: {
- sProductClassifyId:sModelsId
+ sProductClassifyId: selectedNode.sId,
},
- sKeyUpFilterName: '',
+ sKeyUpFilterName: "",
pageNum: 1,
pageSize: 1000,
};
@@ -2221,7 +2222,8 @@ const BoxComponent = props => {
)}
- {getTableCloum(i, x)}
+ {/* {getTableCloum(i, x)} */}
+