From 1ba48b0f89343f7a86906f6173ba53439343fd96 Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Fri, 4 Jul 2025 10:07:41 +0800 Subject: [PATCH] 材料 --- src/components/Common/BoxShowImgMaterial/indexNew.js | 10 +++++----- src/components/Common/Typesetting/typesetting.js | 9 ++++++++- src/components/QuickQuote/index.jsx | 7 +++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/components/Common/BoxShowImgMaterial/indexNew.js b/src/components/Common/BoxShowImgMaterial/indexNew.js index 358bc1d..d4b11f2 100644 --- a/src/components/Common/BoxShowImgMaterial/indexNew.js +++ b/src/components/Common/BoxShowImgMaterial/indexNew.js @@ -25,8 +25,8 @@ const BoxShowImgMaterial = props => { // 计算可以放置的盒子数量 const horizontalBoxes = Math.floor(dWlcd / dMachineLength); const verticalBoxes = Math.floor(dWlkd / dMachineWidth); - const scaleX = (clientWidth - 100) / dWlcd; - const scaleY = (clientHeight - 70) / dWlkd; + const scaleX = (clientWidth - 100) / Number(dWlcd); + const scaleY = (clientHeight - 70) / Number(dWlkd); // 动态生成多个 materialBox const generateMaterialBoxes = () => { const boxes = []; @@ -170,7 +170,7 @@ const BoxShowImgMaterial = props => { 100 ).toFixed(2); useEffect(() => { - // setBoxKey(new Date().getTime()); + setBoxKey(new Date().getTime()); setTimeout(() => { // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { @@ -184,8 +184,8 @@ const BoxShowImgMaterial = props => { textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; textRefs.current.style.transformOrigin = "top left"; } - }, 0); - }, [slaveDataDetail]); + }, 10); + }, [scaleX,scaleY]); const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth; const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth; diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index a31ed75..ed3259c 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -567,6 +567,8 @@ const Typesetting = props => { let openEdition = 0; if (propsData && L) { + console.log(111111); + const sMaterialsName = slaveData.find(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel).sMaterialsName; const propsDataLeft = Number(propsData.props.style.left.slice(0, -2)); // 长需要找出最大的 @@ -612,6 +614,8 @@ const Typesetting = props => { newDHorizontalType !== dHorizontalType || newDPortraitType !== dPortraitType ) { + console.log(222222); + setMaterialLength(newMaterialLength); setMaterialWidth(newMaterialWidth); setMaterialName(sMaterialsName); @@ -619,7 +623,7 @@ const Typesetting = props => { setDPartsLength(innerWidth); setNewDHorizontalType(dHorizontalType); setNewDPortraitType(dPortraitType); - // setDMaterialsKQty(newDMaterialsKQty) + setOldVariables(selectedNode.sTypeKey) const scaleX = (clientWidth - 50) / (outerWidth + 110); const scaleY = (clientHeight - 5) / (outerHeight + 90); const newScale = Math.min(scaleX, scaleY); @@ -662,6 +666,9 @@ const Typesetting = props => { dHorizontalType, dPortraitType ); + } else if (selectedNode.sTypeKey === 'kapai') { + console.log(111111111); + } openEdition = (((newMaterialLength * newMaterialWidth) / (maxWidth * maxHeight)) * 100).toFixed(2); diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 9d43f15..96f7537 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -400,6 +400,8 @@ const QuickQuoteEvent = props => { ...slaveData[saveIndex], dMachineQty: Math.floor(slaveData[saveIndex].dMachineQty / slaveData[saveIndex].dSinglePQty), dMaterialsKQty: newDMaterialsKQty, + newMaterialLength: sFieldName === "dWlcd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlcd, + newMaterialWidth: sFieldName === "dWlkd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlkd, }; } @@ -1098,6 +1100,7 @@ const QuickQuoteEvent = props => { // 入口 const QuickQuote = baseProps => { const props = QuickQuoteEvent(baseProps); + console.log("🚀 ~ QuickQuote:", props) const [treeClassName, setTreeClassName] = useState(""); // 监听页面滚动事件 @@ -1911,8 +1914,8 @@ const BoxComponent = props => { sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸 sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸 sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2), - newMaterialLength: length, - newMaterialWidth: width, + newMaterialLength: dWlcd, + newMaterialWidth: dWlkd, sLayoutRate: Number( ( (((length || slaveData[index].materialLength) * (width || slaveData[index].materialWidth)) / -- libgit2 0.22.2