From d7151f0db6f80a5f65f9d30761570d045c850b29 Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Thu, 26 Jun 2025 11:14:10 +0800 Subject: [PATCH] 卷筒类默认formId --- src/components/QuickQuote/index.jsx | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------- 1 file changed, 85 insertions(+), 77 deletions(-) diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 467dc69..98a024b 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -1141,6 +1141,12 @@ const TreeComponent = props => { }; }); }; + if (selectedNode.sTypeKey === "juantong") { + props.onSaveState({ + masterData: { ...props.masterData, sFormId: "101251240115016002356125200" }, + }); + } + getDropDownData(props); }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]); @@ -1291,14 +1297,16 @@ const MasterComponent = props => { const ableConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible); // 处理长宽样式 - const viewConfigs = !(selectedNode?.bBox && selectedNode.sTypeKey === "kapai" || selectedNode?.bBox && selectedNode.sTypeKey === "juantong") ? ableConfigs : ableConfigs.filter(x => x.sName !== "dHeight"); - if (!(selectedNode?.bBox && selectedNode.sTypeKey === "kapai" || selectedNode?.bBox && selectedNode.sTypeKey === "juantong")) { + const viewConfigs = ((selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sTypeKey !== "juantong") ) + ? ableConfigs + : ableConfigs.filter(x => x.sName !== "dHeight"); + if (selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sTypeKey !== "juantong") { viewConfigs.forEach(item => { if (item.sName === "dLength" || item.sName === "dWidth") { item.iColValue = 4; } }); - } else { + } else { viewConfigs.forEach(item => { item.iColValue = viewConfigs[0].iColValue; }); @@ -1673,80 +1681,78 @@ const BoxComponent = props => { const [materialWidth, setMaterialWidth] = useState(0); // 使用 useCallback 确保回调函数的稳定性 - const handleSaveState = - ( - length, - width, - slaveData, - masterData, - dSinglePQty, - dMaterialsKQty, - dProductQty, - scale, - dWlcd, - dWlkd, - innerWidth, - innerHeight, - dHorizontal, - dPortrait, - dHorizontalType, - dPortraitType - ) => { - // 查找符合条件的索引 - const { selectedNode } = props.state; - - const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); - // 判断展长展宽是否可以放下原纸 - const isDPartsLength = - slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth; - - if (index !== undefined && index !== -1) { - // 计算开数 - - // 获取原始对象并创建一个新的对象进行更新 - const updatedProduct = { - ...slaveData[index], - materialLength: length, - materialWidth: width, - dMachineLength: length, // 上机长 - dMachineWidth: width, // 上机宽 - 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, - sLayoutRate: Number( - ( - (((length || slaveData[index].materialLength) * (width || slaveData[index].materialWidth)) / - (slaveData[index].dMaxLength * slaveData[index].dMaxWidth)) * - 100 - ).toFixed(2) - ), - dWlcd: dWlcd, - dWlkd: dWlkd, - dMachineQty: Math.floor(dProductQty / dSinglePQty), - dSinglePQty: dSinglePQty, - dMaterialsKQty: dMaterialsKQty, - scale: scale, - dPartsLength: innerWidth, - dPartsWidth: innerHeight, - dHorizontal: dHorizontalType, - dPortrait: dPortraitType, - dHorizontalType: dHorizontalType, // 判断 - dPortraitType: dPortraitType, - }; - // 更新状态 - props.setState(prevState => ({ - ...prevState, - slaveData: slaveData.map((item, i) => (i === index ? updatedProduct : item)), - })); - } + const handleSaveState = ( + length, + width, + slaveData, + masterData, + dSinglePQty, + dMaterialsKQty, + dProductQty, + scale, + dWlcd, + dWlkd, + innerWidth, + innerHeight, + dHorizontal, + dPortrait, + dHorizontalType, + dPortraitType + ) => { + // 查找符合条件的索引 + const { selectedNode } = props.state; + + const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); + // 判断展长展宽是否可以放下原纸 + const isDPartsLength = + slaveData[index]?.dPartsLength < slaveData[index]?.dMaxLength && slaveData[index]?.dPartsWidth < slaveData[index]?.dMaxWidth; - setMaterialLength(length); - setMaterialWidth(width); + if (index !== undefined && index !== -1) { + // 计算开数 + + // 获取原始对象并创建一个新的对象进行更新 + const updatedProduct = { + ...slaveData[index], + materialLength: length, + materialWidth: width, + dMachineLength: length, // 上机长 + dMachineWidth: width, // 上机宽 + 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, + sLayoutRate: Number( + ( + (((length || slaveData[index].materialLength) * (width || slaveData[index].materialWidth)) / + (slaveData[index].dMaxLength * slaveData[index].dMaxWidth)) * + 100 + ).toFixed(2) + ), + dWlcd: dWlcd, + dWlkd: dWlkd, + dMachineQty: Math.floor(dProductQty / dSinglePQty), + dSinglePQty: dSinglePQty, + dMaterialsKQty: dMaterialsKQty, + scale: scale, + dPartsLength: innerWidth, + dPartsWidth: innerHeight, + dHorizontal: dHorizontalType, + dPortrait: dPortraitType, + dHorizontalType: dHorizontalType, // 判断 + dPortraitType: dPortraitType, + }; + // 更新状态 + props.setState(prevState => ({ + ...prevState, + slaveData: slaveData.map((item, i) => (i === index ? updatedProduct : item)), + })); } - ; + setMaterialLength(length); + setMaterialWidth(width); + }; + const onSaveDPartsLength = useCallback((innerWidth, innerHeight, slaveData) => { const { selectedNode } = props.state; const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); @@ -1785,8 +1791,8 @@ const BoxComponent = props => { let boxList = []; if ( (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) || - (selectedNode.sTypeKey === "kapai" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) - ||(selectedNode.sTypeKey === "juantong" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) + (selectedNode.sTypeKey === "kapai" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) || + (selectedNode.sTypeKey === "juantong" && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) ) { const slaveNewData = JSON.parse(slaveRowData.sColumnNameConfig); const tables = [ @@ -1949,7 +1955,9 @@ const BoxComponent = props => { <>
-
{!(selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong") ? : ""}
+
+ {!(selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong") ? : ""} +
{cailiaoyinshuaDiv}
{bBox && ( -- libgit2 0.22.2