From 691cc11f85b2017b8735b4188615880313bc1a7d Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Fri, 4 Jul 2025 18:43:19 +0800 Subject: [PATCH] 门幅卷筒展示 --- src/components/Common/BoxShowImgMaterial/indexNew.js | 40 +++++++++++++++++++++++++++++++++++----- src/components/Common/Typesetting/typesetting.js | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- src/components/QuickQuote/index.jsx | 45 ++++++++++++++++++++++----------------------- 3 files changed, 124 insertions(+), 81 deletions(-) diff --git a/src/components/Common/BoxShowImgMaterial/indexNew.js b/src/components/Common/BoxShowImgMaterial/indexNew.js index d4b11f2..7b14875 100644 --- a/src/components/Common/BoxShowImgMaterial/indexNew.js +++ b/src/components/Common/BoxShowImgMaterial/indexNew.js @@ -1,6 +1,6 @@ /* eslint-disable */ import React, { useEffect, useState, useRef } from "react"; -import { VerticalLeftOutlined, VerticalRightOutlined } from "@ant-design/icons"; +import { VerticalLeftOutlined, VerticalRightOutlined, ArrowRightOutlined } from "@ant-design/icons"; import styles from "./index.less"; import { bottom } from "react-grid-layout/build/utils"; import { transform } from "@antv/g2/lib/util/transform"; @@ -23,6 +23,7 @@ const BoxShowImgMaterial = props => { var { dMaxLength, dMaxWidth, dMachineLength, dMachineWidth, dWlcd, dWlkd, dSBLB, dXBLB, dZBLB, dYBLB, scale } = slaveDataDetail; } // 计算可以放置的盒子数量 + const isJuantong = selectedNode.sTypeKey === "juantong"; const horizontalBoxes = Math.floor(dWlcd / dMachineLength); const verticalBoxes = Math.floor(dWlkd / dMachineWidth); const scaleX = (clientWidth - 100) / Number(dWlcd); @@ -136,10 +137,14 @@ const BoxShowImgMaterial = props => { {dMachineWidth} + + { }} /> + {/*
+ {isJuantong ? "门幅方向" : ""} +
+
+ +
*/} ); } @@ -185,14 +215,14 @@ const BoxShowImgMaterial = props => { textRefs.current.style.transformOrigin = "top left"; } }, 10); - }, [scaleX,scaleY]); + }, [scaleX, scaleY]); const isMax = slaveDataDetail?.dMaxWidth * slaveDataDetail?.dMaxLength > slaveDataDetail?.dMachineLength * slaveDataDetail?.dMachineWidth; const isDPartsLength = slaveDataDetail?.dPartsLength < slaveDataDetail?.dMaxLength && slaveDataDetail?.dPartsWidth < slaveDataDetail?.dMaxWidth; const isShow = isDPartsLength && slaveDataDetail && slaveDataDetail.dMachineLength && slaveDataDetail.dMaxWidth && slaveDataDetail.dMaxLength && isMax; - - return ( + + return ( <> {isShow ? (
{ style={{ position: "absolute", left: "0px", - width: `${(dWlcd * (clientWidth - 100)) / (dWlcd)}px`, + width: `${(dWlcd * (clientWidth - 100)) / dWlcd}px`, fontSize: `${size || 11}px`, textAlign: "center", height: "30px", diff --git a/src/components/Common/Typesetting/typesetting.js b/src/components/Common/Typesetting/typesetting.js index 3f77ce9..ecee754 100644 --- a/src/components/Common/Typesetting/typesetting.js +++ b/src/components/Common/Typesetting/typesetting.js @@ -1,18 +1,11 @@ /* eslint-disable */ -import * as commonFunc from '@/components/Common/commonFunc'; -import { - DownOutlined, - LeftOutlined, - RightOutlined, - UpOutlined, - VerticalLeftOutlined, - VerticalRightOutlined, -} from '@ant-design/icons'; -import { message, Modal } from 'antd-v4'; -import React, { useEffect, useRef, useState } from 'react'; - -import DynamicSVG from '../../Common/BoxDesignCompontent/svg'; -import styles from './index.less'; +import * as commonFunc from "@/components/Common/commonFunc"; +import { DownOutlined, LeftOutlined, RightOutlined, UpOutlined, VerticalLeftOutlined, VerticalRightOutlined } from "@ant-design/icons"; +import { message, Modal } from "antd-v4"; +import React, { useEffect, useRef, useState } from "react"; +import { ArrowRightOutlined } from "@ant-design/icons"; +import DynamicSVG from "../../Common/BoxDesignCompontent/svg"; +import styles from "./index.less"; const Typesetting = props => { const { @@ -47,7 +40,7 @@ const Typesetting = props => { } = slaveRowData; const { masterData, selectedNode, slaveData } = state; - if (!masterData) return + if (!masterData) return; // 如果是卷筒类 那么上下左右留白等于左留白 if (selectedNode && selectedNode.sTypeKey === "juantong") { dSBLB = dZBLB; @@ -70,7 +63,7 @@ const Typesetting = props => { const [dPartsLength, setDPartsLength] = useState(0); const [newDHorizontalType, setNewDHorizontalType] = useState(0); const [newDPortraitType, setNewDPortraitType] = useState(0); - const [oldVariables, setOldVariables] = useState('') + const [oldVariables, setOldVariables] = useState(""); // 横板 let { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; // 使用 useRef 获取 DOM 元素 @@ -116,7 +109,6 @@ const Typesetting = props => { // 执行函数并返回结果 return func(...args, Math); } catch (error) { - console.error("公式执行错误:", error); return 0; } }; @@ -192,10 +184,10 @@ const Typesetting = props => { // 计算表达式结果 const variabless = { - ...variables, + ...variables, ...result, }; - + let DisableMateriallIcon = L ? sPackDetailPath : null; // 盒子展长展开公式计算 const innerWidth = slaveRowData.sTypes === "6" ? evaluateFormula(sWidthFormula, variabless) : evaluateFormula(sLengthFormula, variabless); @@ -220,17 +212,17 @@ const Typesetting = props => { jInnerHeight = innerWidth; jInnerWidth = innerHeight; } - if (state.selectedNode.sTypeKey === 'kapai' || state.selectedNode.sTypeKey === "juantong") { + if (state.selectedNode.sTypeKey === "kapai" || state.selectedNode.sTypeKey === "juantong") { jInnerHeight = innerHeight; jInnerWidth = innerWidth; } - + 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 + ? Math.max(jInnerWidth + dFLengthOffset, jInnerWidth + dSLengthOffset) + dYBJJ : jInnerWidth * 2 + dSLengthOffset + dFLengthOffset + dYBJJ; const style = { width: `${outerWidth}px`, @@ -244,25 +236,27 @@ const Typesetting = props => { 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 colsMaxLength = (cols) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ) + dZBLB + dYBLB - (reference ? 0 : dSLengthOffset); + let colsMaxLength = + cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ) + dZBLB + dYBLB - (reference ? 0 : dSLengthOffset); - let rowsMaxLength = rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ) + dSBLB + dXBLB - (reference ? 0 : dSWidthOffset) ; - while (colsMaxLength >= outerWidth && cols > 0) { + let rowsMaxLength = + rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ) + dSBLB + dXBLB - (reference ? 0 : dSWidthOffset); + while (colsMaxLength >= outerWidth && cols > 0) { cols = cols - 1; - colsMaxLength = (cols) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset) + dYBJJ); + 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) ; + rowsMaxLength = rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset) + dXBJJ); } // console.log(cols, rows, outerWidth, outerHeight, colsMaxLength,rowsMaxLength,"cols rows outerWidth outerHeight"); // 最大上机长 上机宽 开料尺寸 // 计算剩余空间 每组都算上偏移量 那么剩余需要加上后面偏移的总量 - const remainingWidth = outerWidth - colsMaxLength - const remainingHeight = outerHeight - rowsMaxLength + const remainingWidth = outerWidth - colsMaxLength; + const remainingHeight = outerHeight - rowsMaxLength; // const remainingWidth = // outerWidth - // (cols * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) - boxLengthOffset - (reference ? 0 : dSLengthOffset)); @@ -270,15 +264,12 @@ const Typesetting = props => { // outerHeight - // (rows * (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset)) - boxWidthOffset - (reference ? 0 : dSWidthOffset)); //剩余量能不能放一下单独一个 - const commonHeightCheck = remainingHeight > jInnerHeight + dXBJJ; - const commonWidthCheck = remainingWidth > jInnerWidth + dYBJJ ; + const commonHeightCheck = remainingHeight > jInnerHeight + dXBJJ; + const commonWidthCheck = remainingWidth > jInnerWidth + dYBJJ; const isCustomized = bAdvancedSetting; let remaining = isVertical ? commonHeightCheck : commonWidthCheck; - - - // const remaining = false; const isOdd = num => { return num % 2 !== 0; @@ -511,14 +502,14 @@ const Typesetting = props => { if (cols === 0 || rows === 0) { if (cols > 0) { for (let col = 0; col < cols; col++) { - const leftPosition = col * (innerWidthCombined); + const leftPosition = col * innerWidthCombined; const topPosition = 0 * (innerHeightCombined + dXBJJ); 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 leftPosition = 0 * innerWidthCombined; const topPosition = row * (innerHeightCombined + dXBJJ); innerDivs.push(createBoxOne(0, row, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); } @@ -526,8 +517,8 @@ const Typesetting = props => { } else { for (let col = 0; col < cols; col++) { for (let row = 0; row < rows; row++) { - const leftPosition = col * (innerWidthCombined); - const topPosition = row * (innerHeightCombined + dXBJJ) ; + const leftPosition = col * innerWidthCombined; + const topPosition = row * (innerHeightCombined + dXBJJ); innerDivs.push(createBox(col, row, 1, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); } // 如果可以放下首盒 @@ -538,10 +529,10 @@ const Typesetting = props => { if (reference) { // 是否首盒 // 首盒的上边距下边距 末尾盒子的上下边距 添加那一行的上边距 - leftPosition = col * (innerWidthCombined) + dFLengthOffset; + leftPosition = col * innerWidthCombined + dFLengthOffset; topPosition = rows * (innerHeightCombined + dXBJJ) + dFWidthOffset; } else { - leftPosition = col * (innerWidthCombined); + leftPosition = col * innerWidthCombined; topPosition = rows * (innerHeightCombined + dXBJJ); } innerDivs.push(createBoxOne(col, rows, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); @@ -564,7 +555,6 @@ const Typesetting = props => { } } - // 判断展开长展开宽是否变化 if (dPartsLength !== innerWidth && !innerDivs.length) { setDPartsLength(innerWidth); @@ -573,8 +563,8 @@ const Typesetting = props => { const propsData = innerDivs[innerDivs.length - 1]; let openEdition = 0; if (propsData && L) { - const {dWlcd,sBillNo} = slaveRowData - + const { dWlcd, sBillNo } = slaveRowData; + const sMaterialsName = slaveData.find(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel).sMaterialsName; const propsDataLeft = Number(propsData.props.style.left.slice(0, -2)); // 长需要找出最大的 @@ -582,8 +572,8 @@ const Typesetting = props => { const propsDataHeight = Number(propsData.props.style.height.slice(0, -2)); const propsDataTop = Number(propsData.props.style.top.slice(0, -2)); // 判断列是否是单独的 - - const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长 + + const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长 const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB).toFixed(2); // 计算开数 @@ -613,7 +603,6 @@ const Typesetting = props => { const newDProductQty = masterData.dProductQty; const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; - if ( dPartsLength !== innerWidth || newMaterialLength !== materialLength || @@ -623,8 +612,6 @@ const Typesetting = props => { newDPortraitType !== dPortraitType || (!dWlcd && sBillNo) ) { - console.log(slaveRowData.dMachineLength,'slaveRowData.dMachineLengthss'); - setMaterialLength(newMaterialLength); setMaterialWidth(newMaterialWidth); setMaterialName(sMaterialsName); @@ -632,7 +619,7 @@ const Typesetting = props => { setDPartsLength(innerWidth); setNewDHorizontalType(dHorizontalType); setNewDPortraitType(dPortraitType); - setOldVariables(selectedNode.sTypeKey) + setOldVariables(selectedNode.sTypeKey); const scaleX = (clientWidth - 50) / (outerWidth + 110); const scaleY = (clientHeight - 5) / (outerHeight + 90); const newScale = Math.min(scaleX, scaleY); @@ -675,7 +662,7 @@ const Typesetting = props => { dHorizontalType, dPortraitType ); - } + } openEdition = (((newMaterialLength * newMaterialWidth) / (maxWidth * maxHeight)) * 100).toFixed(2); setTimeout(() => { @@ -708,10 +695,10 @@ const Typesetting = props => { 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; const confirmParam = commonFunc.showLocalMessage(props, "confirmParam", "排版尺寸大于上机尺寸,请确认参数!"); - + const isJuantong = selectedNode.sTypeKey === "juantong"; if (isCustomized && !isShow) { if (isMobile) return; message.error(confirmParam); @@ -840,6 +827,33 @@ const Typesetting = props => { }} > {materialWidth} + {isJuantong ? ( + + {"门幅方向"} + + ) : ( + "" + )} + {isJuantong ? ( + + ) : ( + "" + )}
{ dProductQty: changeValue.dProductQty, })); } - + if (sFieldName === "dLength" || sFieldName === "dWidth" || sFieldName === "dHeight") { if (props.currentBoxModel) { const boxModel = props.currentBoxModel.replace("slaveUp", "").replace("slaveDown", ""); @@ -1146,7 +1146,6 @@ const QuickQuoteEvent = props => { // 入口 const QuickQuote = baseProps => { const props = QuickQuoteEvent(baseProps); - console.log("🚀 ~ QuickQuote:", props); const [treeClassName, setTreeClassName] = useState(""); // 监听页面滚动事件 @@ -1501,7 +1500,7 @@ const MasterComponent = props => { item.iColValue = 4; } }); - } + } const lengthData = viewConfigs.find(x => x.sName === "dLength"); if (selectedNode && selectedNode.sTypeKey && selectedNode.sTypeKey !== "danye") { @@ -1557,13 +1556,12 @@ const BoxComponent = props => { const { bBox } = selectedNode; const [boxTypeList, setBoxTypeList] = useState([]); // 卡牌类卷筒类默认使用矩形 当是核价保存过的需要在主表数据加载完后在赋值 - console.log(props, "asdadasd"); const slaveRowData = slaveData.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel) || {}; const { sBillNo } = slaveRowData; useEffect(() => { if (selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong") { - const {sBillNo} = slaveRowData - if(sBillNo) return + const { sBillNo } = slaveRowData; + if (sBillNo) return; let dropDownData = []; dropDownData.push(KapaiJson); const boxData = (dropDownData || []).map((item, index) => ({ @@ -1574,21 +1572,6 @@ const BoxComponent = props => { } }, [boxModel]); - // useEffect(() => { - // if (sBillNo) { - // setTimeout(() => { - // if (selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong") { - // let dropDownData = []; - // dropDownData.push(KapaiJson); - // const boxData = (dropDownData || []).map((item, index) => ({ - // ...item, - // iOrder: index + 1, - // })); - // props.onDataChange("slaveUp" + boxModel, "sName", { sName: KapaiJson.sName }, KapaiJson.sId, boxData); - // } - // }, 500); - // } - // }, [masterData.dLength]); const { upAbleConfigsExtra = [], calcMethodData = [], boxPicData = [], radioValue = calcMethodData[0]?.sCode } = slaveRowData; const calcMethod = calcMethodData.map(item => ({ value: item.sCode, @@ -1638,6 +1621,20 @@ const BoxComponent = props => { item.showName = rateList.find(rate => rate.id === Number(selectedNode.iRateType))?.name || "倍率"; } } + + if (item.sName === "dWlcd" && selectedNode.sTypeKey === "juantong") { + return false + } + if (item.sName === "dAuxiliaryQty" && selectedNode.sTypeKey !== "juantong") { + return false + } + if (item.sName === "dWlkd") { + if (selectedNode.sTypeKey === "juantong") { + item.showName = "门幅"; + } else { + item.showName = "材料宽"; + } + } if (item.sName === "sPaperDirection" && selectedNode.sTypeKey === "huace") { return false; } @@ -1654,6 +1651,7 @@ const BoxComponent = props => { if (selectedNode.sTypeKey !== "juantong" && item.sName === "sPaperDirection") { return false; } + return item.iTag === iTag; }); @@ -1966,10 +1964,9 @@ const BoxComponent = props => { // 判断展长展宽是否可以放下原纸 const isDPartsLength = slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth; - + const dProductQtys = props.state.masterData.dProductQty || 0 if (index !== undefined && index !== -1) { // 计算开数 - // 获取原始对象并创建一个新的对象进行更新 const updatedProduct = { ...slaveData[index], @@ -1989,8 +1986,10 @@ const BoxComponent = props => { 100 ).toFixed(2) ), + // dWlcd: selectedNode.sTypeKey === 'juantong' ? Math.floor(dProductQty / dSinglePQty * ( length/ 1000)) : dWlcd, dWlcd: dWlcd, dWlkd: dWlkd, + dAuxiliaryQty: Math.floor(dProductQty / dSinglePQty * ( length/ 1000)), dMachineQty: Math.floor(dProductQty / dSinglePQty), dSinglePQty: dSinglePQty, dMaterialsKQty: dMaterialsKQty, -- libgit2 0.22.2