diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index 91a3caa..f16b4a0 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -52,7 +52,8 @@ const Typesetting = props => { const [materialName, setMaterialName] = useState(""); const [dMaterialsKQty, setDMaterialsKQty] = useState(0); const [dPartsLength, setDPartsLength] = useState(0); - + const [newDHorizontalType, setNewDHorizontalType] = useState(0); + const [newDPortraitType, setNewDPortraitType] = useState(0); // 横板 let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; // 使用 useRef 获取 DOM 元素 @@ -73,11 +74,9 @@ const Typesetting = props => { let outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸 let outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 - dHorizontal = 2; + // dHorizontal = 1; // 如果需要自定义排版数 - console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait, dHorizontalType, dPortraitType, outerWidth, outerHeight); - // 确认是竖向排列还是横向排列 const L = masterData?.dLength; const W = masterData?.dWidth; @@ -248,43 +247,35 @@ const Typesetting = props => { //剩余量能不能放一下单独一个 const commonHeightCheck = remainingHeight > jInnerHeight; const commonWidthCheck = remainingWidth > jInnerWidth; + const isCustomized = false; let remaining = isVertical ? commonHeightCheck : commonWidthCheck; - console.log( - cols, - rows, - innerWidth, - innerHeight, - jInnerWidth, - jInnerHeight, - innerWidthCombined, - innerHeightCombined, - remainingWidth, - remainingHeight, - colsMaxLength, - rowsMaxLength, - remaining, - isVertical, - boxLengthOffset, - boxWidthOffset, - dSLengthOffset, - dFLengthOffset, - "rowsMaxLength" - ); - // 从上到下 - if (isVertical) { - // dHorizontal, dPortrait, dHorizontalType, dPortraitType - // 如果dHorizontal 与 dHorizontalType 不相同 横板 - if (Number(dHorizontal) !== Number(dHorizontalType)) { - console.log(dHorizontal, "dHorizontal"); - } - } else { - if (Number(dHorizontal) !== Number(dHorizontalType)) { - // outerWidth = outerWidth - jInnerWidth; - } - if (Number(dPortrait) !== Number(dPortraitType)) { - console.log(dPortrait, "dPortrait"); + // const remaining = false; + + const isOdd = num => { + return num % 2 !== 0; + }; + + // 是否定制 + if (isCustomized) { + if (isVertical) { + cols = dHorizontal; + rows = Math.trunc(dPortrait / 2); + if (isOdd(dPortrait)) { + remaining = true; + } else { + remaining = false; + } + } else { + cols = Math.trunc(dHorizontal / 2); + rows = dPortrait; + if (isOdd(dHorizontal)) { + remaining = true; + } else { + remaining = false; + } } } + // 抵扣盒默认展示 svg // const isSvg = props.slaveRowData.sName === "扣抵盒"; // 组装svg数据 @@ -533,7 +524,7 @@ const Typesetting = props => { : rows * (cols * 2); // 计算竖版数量 const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; - const dPortraitType = isVertical ? rows * 2 : remaining ? rows : rows; + const dPortraitType = isVertical ? (remaining ? rows * 2 + 1 : rows * 2) : remaining ? rows : rows; const newDProductQty = masterData.dProductQty; const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; @@ -541,13 +532,17 @@ const Typesetting = props => { dPartsLength !== innerWidth || newMaterialLength !== materialLength || newMaterialWidth !== materialWidth || - materialName !== sMaterialsName + materialName !== sMaterialsName || + newDHorizontalType !== dHorizontalType || + newDPortraitType !== dPortraitType ) { setMaterialLength(newMaterialLength); setMaterialWidth(newMaterialWidth); setMaterialName(sMaterialsName); setDProductQty(newDProductQty); setDPartsLength(innerWidth); + setNewDHorizontalType(dHorizontalType); + setNewDPortraitType(dPortraitType); // setDMaterialsKQty(newDMaterialsKQty) const scaleX = (clientWidth - 50) / (outerWidth + 110); const scaleY = (clientHeight - 5) / (outerHeight + 90); diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index f9fedda..ef59ff0 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -1000,7 +1000,6 @@ const TreeComponent = props => { // 点击节点后查询数据 useEffect(() => { if (!selectedNode.sId || commonUtils.isEmptyObject(slaveConfig)) return; - console.log(selectedNode,'selectedNode'); timeRef.current += 1; @@ -1583,8 +1582,8 @@ const BoxComponent = props => { scale: scale, dPartsLength: innerWidth, dPartsWidth: innerHeight, - dHorizontal: dHorizontal || dHorizontalType, - dPortrait: dPortrait || dPortraitType, + dHorizontal: dHorizontalType, + dPortrait: dPortraitType, dHorizontalType: dHorizontalType, // 判断 dPortraitType: dPortraitType, }; diff --git a/src/mobile/quotation/detailNew.jsx b/src/mobile/quotation/detailNew.jsx index b23bf90..8d7fd68 100644 --- a/src/mobile/quotation/detailNew.jsx +++ b/src/mobile/quotation/detailNew.jsx @@ -1196,7 +1196,7 @@ const QuotationTabs = props => { > {sAllPartsNameList && sAllPartsNameList.length ? sAllPartsNameList.map((pane, index) => ( - + {/* */}