Commit 1ba48b0f89343f7a86906f6173ba53439343fd96
1 parent
a0e42b2c
材料
Showing
3 changed files
with
18 additions
and
8 deletions
src/components/Common/BoxShowImgMaterial/indexNew.js
| ... | ... | @@ -25,8 +25,8 @@ const BoxShowImgMaterial = props => { |
| 25 | 25 | // 计算可以放置的盒子数量 |
| 26 | 26 | const horizontalBoxes = Math.floor(dWlcd / dMachineLength); |
| 27 | 27 | const verticalBoxes = Math.floor(dWlkd / dMachineWidth); |
| 28 | - const scaleX = (clientWidth - 100) / dWlcd; | |
| 29 | - const scaleY = (clientHeight - 70) / dWlkd; | |
| 28 | + const scaleX = (clientWidth - 100) / Number(dWlcd); | |
| 29 | + const scaleY = (clientHeight - 70) / Number(dWlkd); | |
| 30 | 30 | // 动态生成多个 materialBox |
| 31 | 31 | const generateMaterialBoxes = () => { |
| 32 | 32 | const boxes = []; |
| ... | ... | @@ -170,7 +170,7 @@ const BoxShowImgMaterial = props => { |
| 170 | 170 | 100 |
| 171 | 171 | ).toFixed(2); |
| 172 | 172 | useEffect(() => { |
| 173 | - // setBoxKey(new Date().getTime()); | |
| 173 | + setBoxKey(new Date().getTime()); | |
| 174 | 174 | setTimeout(() => { |
| 175 | 175 | // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) |
| 176 | 176 | if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { |
| ... | ... | @@ -184,8 +184,8 @@ const BoxShowImgMaterial = props => { |
| 184 | 184 | textRefs.current.style.transform = `scale(${1 / scaleX}, ${1 / scaleY})`; |
| 185 | 185 | textRefs.current.style.transformOrigin = "top left"; |
| 186 | 186 | } |
| 187 | - }, 0); | |
| 188 | - }, [slaveDataDetail]); | |
| 187 | + }, 10); | |
| 188 | + }, [scaleX,scaleY]); | |
| 189 | 189 | const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth; |
| 190 | 190 | const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth; |
| 191 | 191 | ... | ... |
src/components/Common/Typesetting/typesetting.js
| ... | ... | @@ -567,6 +567,8 @@ const Typesetting = props => { |
| 567 | 567 | |
| 568 | 568 | let openEdition = 0; |
| 569 | 569 | if (propsData && L) { |
| 570 | + console.log(111111); | |
| 571 | + | |
| 570 | 572 | const sMaterialsName = slaveData.find(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel).sMaterialsName; |
| 571 | 573 | const propsDataLeft = Number(propsData.props.style.left.slice(0, -2)); |
| 572 | 574 | // 长需要找出最大的 |
| ... | ... | @@ -612,6 +614,8 @@ const Typesetting = props => { |
| 612 | 614 | newDHorizontalType !== dHorizontalType || |
| 613 | 615 | newDPortraitType !== dPortraitType |
| 614 | 616 | ) { |
| 617 | + console.log(222222); | |
| 618 | + | |
| 615 | 619 | setMaterialLength(newMaterialLength); |
| 616 | 620 | setMaterialWidth(newMaterialWidth); |
| 617 | 621 | setMaterialName(sMaterialsName); |
| ... | ... | @@ -619,7 +623,7 @@ const Typesetting = props => { |
| 619 | 623 | setDPartsLength(innerWidth); |
| 620 | 624 | setNewDHorizontalType(dHorizontalType); |
| 621 | 625 | setNewDPortraitType(dPortraitType); |
| 622 | - // setDMaterialsKQty(newDMaterialsKQty) | |
| 626 | + setOldVariables(selectedNode.sTypeKey) | |
| 623 | 627 | const scaleX = (clientWidth - 50) / (outerWidth + 110); |
| 624 | 628 | const scaleY = (clientHeight - 5) / (outerHeight + 90); |
| 625 | 629 | const newScale = Math.min(scaleX, scaleY); |
| ... | ... | @@ -662,6 +666,9 @@ const Typesetting = props => { |
| 662 | 666 | dHorizontalType, |
| 663 | 667 | dPortraitType |
| 664 | 668 | ); |
| 669 | + } else if (selectedNode.sTypeKey === 'kapai') { | |
| 670 | + console.log(111111111); | |
| 671 | + | |
| 665 | 672 | } |
| 666 | 673 | openEdition = (((newMaterialLength * newMaterialWidth) / (maxWidth * maxHeight)) * 100).toFixed(2); |
| 667 | 674 | ... | ... |
src/components/QuickQuote/index.jsx
| ... | ... | @@ -400,6 +400,8 @@ const QuickQuoteEvent = props => { |
| 400 | 400 | ...slaveData[saveIndex], |
| 401 | 401 | dMachineQty: Math.floor(slaveData[saveIndex].dMachineQty / slaveData[saveIndex].dSinglePQty), |
| 402 | 402 | dMaterialsKQty: newDMaterialsKQty, |
| 403 | + newMaterialLength: sFieldName === "dWlcd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlcd, | |
| 404 | + newMaterialWidth: sFieldName === "dWlkd" ? changeValue[sFieldName] : slaveData[saveIndex]?.dWlkd, | |
| 403 | 405 | }; |
| 404 | 406 | } |
| 405 | 407 | |
| ... | ... | @@ -1098,6 +1100,7 @@ const QuickQuoteEvent = props => { |
| 1098 | 1100 | // 入口 |
| 1099 | 1101 | const QuickQuote = baseProps => { |
| 1100 | 1102 | const props = QuickQuoteEvent(baseProps); |
| 1103 | + console.log("🚀 ~ QuickQuote:", props) | |
| 1101 | 1104 | const [treeClassName, setTreeClassName] = useState(""); |
| 1102 | 1105 | |
| 1103 | 1106 | // 监听页面滚动事件 |
| ... | ... | @@ -1911,8 +1914,8 @@ const BoxComponent = props => { |
| 1911 | 1914 | sMaterialsStyle: `${slaveData[index]?.dWlcd || 0}*${slaveData[index]?.dWlkd || 0}`, // 原纸尺寸 |
| 1912 | 1915 | sMachineStyle: `${length || slaveData[index].materialLength}*${width || slaveData[index].materialWidth}`, // 开料尺寸为计算的排版尺寸 |
| 1913 | 1916 | sMaterialRate: (((length * width) / (slaveData[index].dWlcd * slaveData[index].dWlkd)) * 100).toFixed(2), |
| 1914 | - newMaterialLength: length, | |
| 1915 | - newMaterialWidth: width, | |
| 1917 | + newMaterialLength: dWlcd, | |
| 1918 | + newMaterialWidth: dWlkd, | |
| 1916 | 1919 | sLayoutRate: Number( |
| 1917 | 1920 | ( |
| 1918 | 1921 | (((length || slaveData[index].materialLength) * (width || slaveData[index].materialWidth)) / | ... | ... |