From e1f1415b3c7cba7181e20fd2bfcff70db3ce2486 Mon Sep 17 00:00:00 2001 From: 陈鑫涛 <10125295+chen-xintao97@user.noreply.gitee.com> Date: Fri, 22 Aug 2025 09:07:02 +0800 Subject: [PATCH] 盒型 --- src/components/Common/BoxDesignCompontent/index.js | 47 ++++++++++++++++++----------------------------- src/components/Common/BoxDesignCompontent/svg.js | 6 +++--- src/components/Common/CommonTable/index.js | 2 +- src/components/QuickQuote/index.jsx | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- 4 files changed, 105 insertions(+), 64 deletions(-) diff --git a/src/components/Common/BoxDesignCompontent/index.js b/src/components/Common/BoxDesignCompontent/index.js index e9ea7c6..7921dae 100644 --- a/src/components/Common/BoxDesignCompontent/index.js +++ b/src/components/Common/BoxDesignCompontent/index.js @@ -127,7 +127,7 @@ const BoxDesignCompontent = baseProps => { value: "", })) setTableColum(newTableColum); - }, [tableData.length]); + }, [tableData]); // 2️⃣ 只负责 boxBodyList 盒身 useEffect(() => { @@ -142,22 +142,14 @@ const BoxDesignCompontent = baseProps => { value: '', })) setBoxBodyList(bodyList); - }, [tableData.length]); + }, [tableData]); // 3️⃣ 只负责 tableDataList 和 tableDataLists useEffect(() => { if (!tableData?.length) return; - // const keywords = ["盒长", "盒高", "盒宽", "Box Length", "Box Width", "Box Height"]; - const keywordMap = { - '盒长': 'L', - '盒宽': 'W', - '盒高': 'D', - 'Box Length': 'L', - 'Box Width': 'W', - 'Box Height': 'D', - }; - + + const keywordMap = ['L','W', 'D'] const newList = tableData .filter(item => item.bVisible).filter(item => item.iTag === 30) .map(item => ({ @@ -166,21 +158,20 @@ const BoxDesignCompontent = baseProps => { isSelect: false, selectImage: null, value: "", - })).map(item => { + })).map((item,i) => { // 拼出新名字:原始关键字 + (后缀) - const sName = `${item.showName} (${keywordMap[item.showName?.trim()]})` + const sName = `${item.showName} (${keywordMap[i]})` return { ...item, sName }; }); setTableDataList(newList); setTableDataLists(newList); const shape = tableData.find(x => x.iTag === 70)?.showDropDown - if (!shape) return const JsonShape = JSON.parse(shape) const shapeLists = Array.from(Object.values(JsonShape)) setShapeList(shapeLists) const prompt = tableData.filter(x => x.iTag === 80) setDoublePrompt(prompt) - }, [tableData.length]); + }, [tableData]); // 获取itag为40的数据 const upViewPropsAll = Array.isArray(tableData) @@ -352,23 +343,23 @@ const BoxDesignCompontent = baseProps => { } } // 盒身信息 - if (masterData) { + if (masterData && boxBodyList.length && tableDataList.length && tableColum.length) { const headLength = slaveData.find(item => item.sCode === "dSHC")?.iValue; const headWidth = slaveData.find(item => item.sCode === "dSHK")?.iValue; const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue; const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue; newBoxList.forEach((item, index) => { - if (item.sName?.trim() === "盒身" || item.sName?.trim() === "Box Body") { + if (item.sName?.trim() === boxBodyList[0].showName) { newBoxList[index].value = masterData.sBoxBody; newBoxList[index].selectImage = masterData.sMakeUpPath; newBoxList[index].type = masterData.sTypes; - } else if (item.sName?.trim() === "盒长" || item.sName?.trim() === "Box Length") { + } else if (item.sName?.trim() === tableDataList[0].showName) { newBoxList[index].value = masterData.dBoxLength; - } else if (item.sName?.trim() === "盒宽" || item.sName?.trim() === "Box Width") { + } else if (item.sName?.trim() === tableDataList[1].showName) { newBoxList[index].value = masterData.dBoxWidth; - } else if (item.sName?.trim() === "盒高" || item.sName?.trim() === "Box Height") { + } else if (item.sName?.trim() === tableDataList[2].showName) { newBoxList[index].value = masterData.dBoxHeight; - } else if (item.sName === "盒型名称" || item.sName?.trim() === "Box Name") { + } else if (item.sName === tableColum[0].showName) { newBoxList[index].value = masterData.sName; } else if (item.sName === "首盒长") { newBoxList[index].value = headLength; @@ -681,9 +672,7 @@ const BoxDesignCompontent = baseProps => { const boxType = boxList.find(item => item.sName === boxBodyList[0]?.showName)?.type; if (boxType === "8") { } else { - const boxLength = Number(boxList.find(item => item.sName === "盒长" || item.sName?.trim() === "Box Length")?.value); - const boxWidth = Number(boxList.find(item => item.sName === "盒宽" || item.sName?.trim() === "Box Width")?.value); - const boxHeight = Number(boxList.find(item => item.sName === "盒高" || item.sName?.trim() === "Box Height")?.value); + const boxHeight = Number(boxList.find(item => item.sName === tableDataList[2].showName)?.value); const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const yscw = boxList.find(x => x.sName === "右(上)插位组件"); @@ -1332,7 +1321,7 @@ const BoxDesignCompontent = baseProps => {
- 层1{" "} + {doublePrompt[0].showName}
{
- 层2{" "} + {doublePrompt[1].showName}
{
- 层1{" "} + {doublePrompt[0].showName}
{
- 层2{" "} + {doublePrompt[1].showName}
{ // 如果存在部件和盒舌 取最大的 const top = topOffect(boxList, boxLength, boxWidth, boxHeight, props); const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight, props); - console.log("🚀 ~ initSVG ~ bottom:", top, bottom) max = Number(top) + Number(bottom); if (Number(svgType) === 8) { const top = topOffect(boxList, headLength, headWidth, props); @@ -239,7 +238,6 @@ const SvgBox = props => { } else if (Number(svgType) === 5) { viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW + doubleTotal viewBoxHeight = boxLength + max; - console.log("🚀 ~ initSVG ~ viewBoxHeight:", viewBoxHeight, boxLength, max) } else if (Number(svgType) === 6) { viewBoxWidth = boxWidth + 2; @@ -5180,6 +5178,9 @@ const SvgBox = props => { }); svg.appendChild(g); + } else if (Number(svgType) === 9) { + // g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)) + svg.appendChild(g); } }; // 计算头部偏移 @@ -5199,7 +5200,6 @@ const SvgBox = props => { } const svg = Number(box?.type); - console.log("🚀 ~ topOffect ~ svg:", svg, showNew) if (svg === 6) return 0; const dZ = Number(zscw?.value) || 0; diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 1e4976c..a44a58c 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4081,7 +4081,7 @@ class CommonTableRc extends React.Component { if (commonUtils.isNotEmptyObject(record)) { const sMemo = showConfig.sName; const title = showConfig.showName; - if (sName.includes('sTemplateFullMemo')) { + if (sName.includes(['sTemplateFullMemo','sContentMemo'])) { return this.setState({ simpleModalVisible: true, simpleModalWord: record[sName] }); } const sCurrMemoProps = { diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 5dc56be..8304a32 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -1527,6 +1527,8 @@ const TreeComponent = props => { masterData: { ...props.masterData, sFormId: "101251240115016076506222050" }, }); } + console.log(selectedNode, 'selectedNode'); + getDropDownData(props); }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]); const { slaveData } = props.state; @@ -1856,13 +1858,56 @@ const BoxComponent = props => { if (selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong") { const { sBillNo } = slaveRowData; if (sBillNo) return; - 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); + const getSqlDropDownData = async ({ sId, sSqlCondition = {} }, cb) => { + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; + const body = { + sKeyUpFilterName: "", + pageNum: 1, + pageSize: 1000, + sSqlCondition, + }; + const retrunData = await commonServices.postValueService(props.app.token, body, url); + const dropDownData = retrunData.data?.dataset?.rows; + if (dropDownData) { + const box = dropDownData.find(box => box.sId === '17551384620004172929247856556500'); // Define 'box' here + const boxData = dropDownData.map((itemBox, indexBox) => ({ + ...itemBox, + iOrder: indexBox + 1, + })); + if (box) { // Check if 'box' exists before using it + props.onDataChange("slaveUp" + boxModel, "sName", { sName: box.sName }, box.sId, boxData); + } + } + // if (dropDownData && sAllPartsNameDefaultList.length) { + // sAllPartsNameDefaultList.forEach((item, index) => { + // const sPartNameList = item.sPartName?.split(","); + // if (sPartNameList && sPartNameList.length) { + // sPartNameList.forEach(sPartName => { + // const box = dropDownData.find(box => box.sId === '17551384620004172929247856556500'); // Define 'box' here + // const boxData = dropDownData.map((itemBox, indexBox) => ({ + // ...itemBox, + // iOrder: indexBox + 1, + // })); + // if (box) { // Check if 'box' exists before using it + // props.onDataChange("slaveUp" + sPartName, "sName", { sName: box.sName }, box.sId, boxData); + // } + // }); + // } + // }); + // } + }; + + getSqlDropDownData({ + sId: '17428091410008594700322758474000', + sSqlCondition: { sProductClassifyId: selectedNode.sId }, + }); + // 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); } }, [boxModel]); @@ -1896,7 +1941,7 @@ const BoxComponent = props => { sName: item.sName + key, sDefault: item[key], showName: item.showName + ['1长', '1宽', '2长', '2宽'][idx], - sId:item.sId + idx + sId: item.sId + idx })) : [item] // 非 '09' 也要包一层数组,保持结构一致 ) @@ -1913,8 +1958,7 @@ const BoxComponent = props => { tableName: `slaveUp${boxModel}`, }; - console.log(upAbleConfigs,upAbleConfigsList,'upAbleConfigs'); - + const getUpViewPropsByITag = iTag => { const config = slaveConfig.gdsconfigformslave .filter(item => !["sPrint", "sColor", "iPrintModePo"].includes(item.sName)) @@ -1938,7 +1982,7 @@ const BoxComponent = props => { return false; } else { if (item.sName === "iPage") { - const rateList = commonUtils.convertStrToObj(slaveConfig.gdsconfigformslave.find(x => x.sName === "iRateType")?.showDropDown, []); + const rateList = JSON.parse(slaveConfig.gdsconfigformslave.find(x => x.sName === "iRateType")?.showDropDown) || []; item.showName = rateList[Number(selectedNode.iRateType)] || "倍率"; } } @@ -1951,9 +1995,11 @@ const BoxComponent = props => { } if (item.sName === "dWlkd") { if (selectedNode.sTypeKey === "juantong") { - item.showName = "门幅"; + const FabricWidth = commonFunc.showLocalMessage(props, "FabricWidth", "门幅"); + item.showName = FabricWidth; } else { - item.showName = "材料宽"; + const MaterialWidth = commonFunc.showLocalMessage(props, "MaterialWidth", "材料宽"); + item.showName = MaterialWidth; } } if (item.sName === "sPaperDirection" && selectedNode.sTypeKey === "huace") { @@ -1988,12 +2034,15 @@ const BoxComponent = props => { const UlToolPosition = commonFunc.showLocalMessage(props, "UlToolPosition", "上下刀位"); const RLToolPosition = commonFunc.showLocalMessage(props, "RLToolPosition", "左右刀位"); const LeftMargin = commonFunc.showLocalMessage(props, "LeftMargin", "左右留白"); + const StayOnTheEdge = commonFunc.showLocalMessage(props, "StayOnTheEdge", "留边"); + const Spacing = commonFunc.showLocalMessage(props, "Spacing", "间距"); + const HopDistance = commonFunc.showLocalMessage(props, "HopDistance", "跳距"); boxConfigList = boxConfig?.gdsconfigformslave?.filter(item => item.bVisible && showNameKeyList.includes(item.sName)) || []; if (selectedNode.sTypeKey === "juantong") { const mappings = { - dZBLB: "留边", - dXBJJ: "间距", - dYBJJ: "跳距", + dZBLB: StayOnTheEdge, + dXBJJ: Spacing, + dYBJJ: HopDistance, }; boxConfigList.forEach(item => { @@ -2528,7 +2577,6 @@ const BoxComponent = props => { dSvgBoxHeight: 200, showNew: 1, }; - console.log("🚀 ~ svgProps:", svgProps) // upViewProps.viewRow = @@ -2556,7 +2604,7 @@ const BoxComponent = props => { { src: getImageUrl(removeExtension(slaveRowData.sPackDetailPathUpLoad)), alt: "展开图" }, { src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }, ]; - if (!slaveRowData.sPackDetailPathUpLoad) { + if (!slaveRowData.sPackDetailPathUpLoad) { imagesData = [{ src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }]; } else if (!slaveRowData.sPackPath) { imagesData = [{ src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }]; @@ -2689,9 +2737,11 @@ const BoxComponent = props => {
) : selectedNode.sTypeKey === "kapai" || selectedNode.sTypeKey === "juantong" ? ( -
- -
+ {imagesData.map((image, index) => ( +
+ {image.alt} +
+ ))}
) : (
{noImage}
@@ -3278,12 +3328,14 @@ const BoxModelSelectedModal = props => { const [boxTypeList, setBoxTypeList] = useState([]); const [boxData, setBoxData] = useState([]); const [treeClassName, setTreeClassName] = useState(""); - const [boxTypeSelected, setBoxTypeSelected] = useState("全部"); const UniqueID = commonFunc.showLocalMessage(props, "UniqueID", "唯一ID"); const sName = commonFunc.showLocalMessage(props, "jurCon", "名称"); const KnifeLineChart = commonFunc.showLocalMessage(props, "KnifeLineChart", "刀线图"); const ThreeDGraph = commonFunc.showLocalMessage(props, "3DGraph", "3D图"); const BtnOperations = commonFunc.showLocalMessage(props, "BtnOperations", "操作"); + const allName = commonFunc.showLocalMessage(props, "btnAll", "全部"); + const otherName = commonFunc.showLocalMessage(props, "BtnOther", "其他"); + const [boxTypeSelected, setBoxTypeSelected] = useState(allName); useEffect(() => { const boxList = [ @@ -3325,7 +3377,7 @@ const BoxModelSelectedModal = props => { }; getSqlDropDownData({ sId: "17428091410008594700322758474000", sSqlCondition: { sProductClassifyId: selectedNode.sId } }, dropDownData => { - const boxTypeList = Array.from(new Set(dropDownData.map(item => item.sBoxType || "其它"))); + const boxTypeList = Array.from(new Set(dropDownData.map(item => item.sBoxType || otherName))); setBoxTypeList(boxTypeList); setBoxData( dropDownData.map((item, index) => ({ @@ -3338,18 +3390,18 @@ const BoxModelSelectedModal = props => { const renderTreeNodes = useMemo( () => - ["全部", ...boxTypeList].map(boxType => ( + [allName, ...boxTypeList].map(boxType => ( (item.sBoxType || "其它") === boxType).length} + count={boxType === allName ? boxData.length : boxData.filter(item => (item.sBoxType || otherName) === boxType).length} offset={[20, 8]} color="#faad14" > {boxType} } - key={boxType === "全部" ? 0 : commonUtils.createSid()} + key={boxType === allName ? 0 : commonUtils.createSid()} treeData={boxType} switcherIcon={} > @@ -3418,17 +3470,17 @@ const BoxModelSelectedModal = props => { }; return svgProps; }; - const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected)); + const selectBoxList = boxData.filter(item => (boxTypeSelected === allName ? true : (item.sBoxType || otherName) === boxTypeSelected)); const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片"); let btnSelectTitle = commonFunc.showLocalMessage(props, "BtnSelect", "选择"); const sLanguage = props.app?.userinfo?.sLanguage; - if (sLanguage === "sEnglish") { - btnSelectTitle = "BtnSelect"; - } + // if (sLanguage === "sEnglish") { + // btnSelectTitle = "BtnSelect"; + // } const tableProps = { ...commonBusiness.getTableTypes("box", { ...props, - boxData: boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected)), + boxData: boxData.filter(item => (boxTypeSelected === allName ? true : (item.sBoxType || otherName) === boxTypeSelected)), boxConfig, boxColumn, }), -- libgit2 0.22.2