- {tableColum && tableColum.length
- ? tableColum.map((item, index) => {
- const uniqueIndex = index + 9;
- return (
-
-
-
- {item.showName}
-
-
handleChange(e, uniqueIndex)}
- onFocus={e => handleFocus(e, uniqueIndex)}
- onBlur={e => handleBlur(e, uniqueIndex)}
- readOnly={!boxList[uniqueIndex]?.isEditable}
- style={{ width: " 80%" }}
- />
-
-
- );
- })
- : ""}
- {boxBodyList && boxBodyList.length
- ? boxBodyList.map((item, index) => {
- const uniqueIndex = index + 9 + tableColum.length;
-
- return (
-
-
-
- {item.showName}
-
- {boxList[uniqueIndex]?.selectImage ? (
-
![{boxList[uniqueIndex].value}]({boxList[uniqueIndex]?.selectImage})
+ {leftBoxList.map((item, index) => (
+
+
{titleList[index + 3]}
+
+
+
+
+ ))}
+
+
+ {rightBoxList.map((item, index) => (
+
+
{titleList[findIndexBySname(item.sName)]}
+
+
+
+
+ ))}
+
+
+
+
+
+
+ {tableColum && tableColum.length
+ ? tableColum.map((item, index) => {
+ const uniqueIndex = index + 9;
+ return (
+
+
+
+ {item.showName}
+
+
handleChange(e, uniqueIndex)}
+ onFocus={e => handleFocus(e, uniqueIndex)}
+ onBlur={e => handleBlur(e, uniqueIndex)}
+ readOnly={!boxList[uniqueIndex]?.isEditable}
+ style={{ width: " 80%" }}
/>
- ) : (
- ""
- )}
- {isDefaultValue ?
{boxList[uniqueIndex]?.value}
: ""}
-
+
-
- );
- })
- : ""}
-
- {tableDataList && tableDataList.length
- ? tableDataList.map((item, index) => {
- const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length;
+ );
+ })
+ : ""}
+ {boxBodyList && boxBodyList.length
+ ? boxBodyList.map((item, index) => {
+ const uniqueIndex = index + 9 + tableColum.length;
return (
-
-
{item.sName}
-
handleChange(e, uniqueIndex)}
- onFocus={e => handleFocus(e, uniqueIndex)}
- onBlur={e => handleBlur(e, uniqueIndex)}
- readOnly={!boxList[uniqueIndex]?.isEditable}
- style={{ width: " 60%" }}
- />
+
+
+
+ {item.showName}
+
+ {boxList[uniqueIndex]?.selectImage ? (
+
![{boxList[uniqueIndex].value}]({boxList[uniqueIndex]?.selectImage})
+ ) : (
+ ""
+ )}
+ {isDefaultValue ?
{boxList[uniqueIndex]?.value}
: ""}
+
+
);
})
: ""}
+
+ {tableDataList && tableDataList.length
+ ? tableDataList.map((item, index) => {
+ const uniqueIndex = index + 9 + tableColum.length + boxBodyList.length;
+
+ return (
+
+
{item.sName}
+
handleChange(e, uniqueIndex)}
+ onFocus={e => handleFocus(e, uniqueIndex)}
+ onBlur={e => handleBlur(e, uniqueIndex)}
+ readOnly={!boxList[uniqueIndex]?.isEditable}
+ style={{ width: " 60%" }}
+ />
+
+ );
+ })
+ : ""}
+
-
+ )}
);
};
diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js
index 88faa4e..463eaaa 100644
--- a/src/components/Common/Typesetting/typesetting.js
+++ b/src/components/Common/Typesetting/typesetting.js
@@ -38,7 +38,7 @@ const Typesetting = props => {
bAdvancedSetting, // 高级设置
sSvgPath,
dL = 0,
- dW = 0
+ dW = 0,
} = slaveRowData;
const { masterData, selectedNode, slaveData } = state;
if (!masterData) return;
@@ -90,8 +90,8 @@ const Typesetting = props => {
// dHorizontal = 1;
// 如果需要自定义排版数
// 确认是竖向排列还是横向排列
- const L = slaveRowData.dL? Number(dL) : Number(masterData?.dLength) || 0;
- const W = slaveRowData.dW? Number(dW) : masterData?.dWidth || 0;
+ const L = slaveRowData.dL ? Number(dL) : Number(masterData?.dLength) || 0;
+ const W = slaveRowData.dW ? Number(dW) : masterData?.dWidth || 0;
const H = masterData?.dWidth || 0;
const D = masterData?.dHeight || 0;
// 动态计算公式值
@@ -188,7 +188,7 @@ const Typesetting = props => {
...result,
};
Object.keys(variabless).forEach(key => {
- if (variabless[key] === null || variabless[key] === undefined || variabless[key] === '') {
+ if (variabless[key] === null || variabless[key] === undefined || variabless[key] === "") {
variabless[key] = 0;
}
});
@@ -205,7 +205,6 @@ const Typesetting = props => {
const boxWidthOffset = evaluateFormula(sSecondLongitudinalOffset, variabless); // 第二列纵向偏移
const isVertical = sSettingMethod === "从上到下"; // true 表示竖向排列,false 表示横向排列 sSettingMethod === '从上到下'
const reference = sSGroupOffset === "首盒"; // 第三列参考
-
// 计算内层盒子尺寸 加上间距
let jInnerHeight = innerHeight;
let jInnerWidth = innerWidth;
@@ -221,13 +220,14 @@ const Typesetting = props => {
jInnerWidth = innerWidth;
}
- const innerHeightCombined = isVertical
- ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset + dXBJJ
- : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
+ const innerHeightCombined = (isVertical
+ ? jInnerHeight * 2 + dSWidthOffset + dFWidthOffset
+ : Math.max(jInnerHeight + dFWidthOffset, jInnerHeight + dSWidthOffset)) + dXBJJ; // 计算内层盒子高度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
// 计算内层盒子宽度 从上向下排列 取首盒加偏移量和次盒加偏移量最大的值 从左往右排列 盒子尺寸 * 2 加上首盒偏移量和次盒偏移量
- const innerWidthCombined = isVertical
- ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) + dYBJJ
- : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset + dYBJJ;
+ const innerWidthCombined = (isVertical
+ ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset)
+ : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset) + dYBJJ;
+
const style = {
width: `${outerWidth}px`,
height: `${outerHeight}px`,
@@ -245,19 +245,19 @@ const Typesetting = props => {
let rowsMaxLength =
rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ) + dSBLB + dXBLB - (reference ? 0 : dSWidthOffset);
- while (colsMaxLength >= outerWidth && cols > 0) {
+ while (colsMaxLength > outerWidth && cols > 0) {
cols = cols - 1;
colsMaxLength = cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ);
}
- while (rowsMaxLength >= outerHeight && rows > 0) {
+ while (rowsMaxLength > outerHeight && rows > 0) {
rows = rows - 1;
rowsMaxLength = rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ);
}
// 最大上机长 上机宽 开料尺寸
// 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量
- const remainingWidth = outerWidth - colsMaxLength - (boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ);
- const remainingHeight = outerHeight - rowsMaxLength - (boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ);
+ const remainingWidth = outerWidth - colsMaxLength + (boxLengthOffset + (reference ? 0 : dSLengthOffset));
+ const remainingHeight = outerHeight - rowsMaxLength + (boxWidthOffset + (reference ? 0 : dSWidthOffset));
// const remainingWidth =
// outerWidth -
// (cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) - boxLengthOffset - (reference ? 0 : dSLengthOffset));
@@ -268,8 +268,8 @@ const Typesetting = props => {
const commonHeightCheck = remainingHeight > jInnerHeight + dXBJJ;
const commonWidthCheck = remainingWidth > jInnerWidth + dYBJJ;
const isCustomized = bAdvancedSetting;
-
let remaining = isVertical ? commonHeightCheck : commonWidthCheck;
+ console.log(dSLengthOffset,'次盒横向偏移量');
// 判断
// const remaining = false;
@@ -336,7 +336,7 @@ const Typesetting = props => {
{
{
if (reference) {
return col === 0 ? leftPosition : leftPosition;
}
- return col === 0 ? leftPosition : leftPosition + boxLengthOffset * col;
+ return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col;
} else {
if (reference) {
return col === 0 ? leftPosition : leftPosition;
}
- return col === 0 ? leftPosition : leftPosition + boxLengthOffset * col + dSLengthOffset * col;
+ return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col + dSLengthOffset * col;
}
};
// 计算上偏移
@@ -505,59 +505,59 @@ const Typesetting = props => {
if (cols > 0) {
for (let col = 0; col < cols; col++) {
const leftPosition = col * innerWidthCombined;
- const topPosition = 0 * (innerHeightCombined + dXBJJ);
+ const topPosition = 0 * (innerHeightCombined );
innerDivs.push(createBoxOne(col, 0, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
}
}
if (rows > 0) {
for (let row = 0; row < rows; row++) {
const leftPosition = 0 * innerWidthCombined;
- const topPosition = row * (innerHeightCombined + dXBJJ);
+ const topPosition = row * (innerHeightCombined);
innerDivs.push(createBoxOne(0, row, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
}
}
} else {
+ let hasPushed = false; // 标志变量
for (let col = 0; col < cols; col++) {
for (let row = 0; row < rows; row++) {
const leftPosition = col * innerWidthCombined;
- const topPosition = row * (innerHeightCombined + dXBJJ);
+ const topPosition = row * (innerHeightCombined);
innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
}
// 如果可以放下首盒
- if (remaining) {
- if (isVertical) {
- let leftPosition = 0;
+ }
+ if (remaining) {
+ if (isVertical) {
+ let leftPosition = 0;
+ let topPosition = 0;
+ if (reference) {
+ // 是否首盒
+ // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距
+ leftPosition = cols - 1 * innerWidthCombined + dFLengthOffset;
+ topPosition = rows * (innerHeightCombined ) + dFWidthOffset;
+ } else {
+ leftPosition = cols - 1 * innerWidthCombined;
+ topPosition = rows * (innerHeightCombined);
+ }
+ innerDivs.push(createBoxOne(cols - 1, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
+ } else {
+ // 只会在横向排的时候
+ for (let index = 0; index < rows; index++) {
+ // 先默认为首盒参考
let topPosition = 0;
+ let leftPosition = 0;
if (reference) {
- // 是否首盒
- // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距
- leftPosition = col * innerWidthCombined + dFLengthOffset;
- topPosition = rows * (innerHeightCombined + dXBJJ) + dFWidthOffset;
+ topPosition = index * (innerHeightCombined + boxWidthOffset) ;
+ leftPosition = cols * (innerWidthCombined + boxLengthOffset) ;
} else {
- leftPosition = col * innerWidthCombined;
- topPosition = rows * (innerHeightCombined + dXBJJ);
- }
- innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
- } else {
- for (let index = 0; index < rows; index++) {
- // 先默认为首盒参考
- let topPosition = 0;
- let leftPosition = 0;
- if (reference) {
- topPosition = index * (innerHeightCombined + boxWidthOffset);
- leftPosition = cols * (innerWidthCombined + boxLengthOffset + dXBJJ);
- } else {
- topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset + dXBJJ);
- leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset);
- }
- innerDivs.push(createDiv(col, index, 3, leftPosition + col * dYBJJ, topPosition + index * dXBJJ, iFAngle, DisableMateriallIcon));
+ topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset) ;
+ leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset) + dYBJJ;
}
+ innerDivs.push(createDiv(cols - 1, index, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
}
}
}
}
- console.log(cols,rows,'cols');
-
// 判断展开长展开宽是否变化
if (dPartsLength !== innerWidth && !innerDivs.length) {
setDPartsLength(innerWidth);
@@ -575,9 +575,10 @@ const Typesetting = props => {
const propsDataHeight = Number(propsData.props.style.height.slice(0, -2));
const propsDataTop = Number(propsData.props.style.top.slice(0, -2));
// 判断列是否是单独的
-
+ console.log(cols,rows,'rows');
+
const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长
- const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB).toFixed(2);
+ const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB - (rows >= 1 ? dXBJJ : 0)).toFixed(2);
// 计算开数
let dSinglePQty = isVertical
@@ -699,7 +700,7 @@ const Typesetting = props => {
Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length > 0;
-
+
const confirmParam = commonFunc.showLocalMessage(props, "confirmParam", "排版尺寸大于上机尺寸,请确认参数!");
const isJuantong = selectedNode.sTypeKey === "juantong";
if (isCustomized && !isShow) {
--
libgit2 0.22.2