diff --git a/src/components/Common/BoxDesignCompontent/index.js b/src/components/Common/BoxDesignCompontent/index.js index 6b9642c..7def463 100644 --- a/src/components/Common/BoxDesignCompontent/index.js +++ b/src/components/Common/BoxDesignCompontent/index.js @@ -187,6 +187,21 @@ const BoxDesignCompontent = baseProps => { "右插位组件", "右下插位组件", ]; + const doubleTitlieList1 = [ + { name: "左上插位组件", value: "dZSCW" }, + { name: "上插位组件", value: "dSCW" }, + { name: "右上插位组件", value: "dYSCW" }, + { name: "左偏移", value: "dZPY" }, + { name: "左插位组件", value: "dZCW" }, + { name: "左下插位组件", value: "dZXCW" }, + { name: "右偏移", value: "dYPY" }, + { name: "右插位组件", value: "dYCW" }, + { name: "右下插位组件", value: "dYXCW" }, + { name: "首盒长", value: "dSHC" }, + { name: "首盒宽", value: "dSHK" }, + { name: "次盒长", value: "dCHC" }, + { name: "次盒宽", value: "dCHK" }, + ]; const newBoxList = []; // const boxs = titleList.length + tableData.length; @@ -218,8 +233,10 @@ const BoxDesignCompontent = baseProps => { }); }); // 部件信息 + + const boxTypes = masterData.sTypes; if (slaveData && slaveData.length) { - if (boxType !== "8") { + if (boxTypes !== "8") { slaveData.forEach((item, index) => { const i = titleList1.findIndex(i => { return i.value === item.sCode; @@ -236,11 +253,30 @@ const BoxDesignCompontent = baseProps => { } }); } else { + slaveData.forEach((item, index) => { + const i = doubleTitlieList1.findIndex(i => { + return i.value === item.sCode; + }); + if (i !== -1) { + const x = newBoxList.findIndex(z => z.sName === doubleTitlieList1[i].name); + newBoxList[x].value = item.iValue; + newBoxList[x].type = item.sTypes; + newBoxList[x].showName = item.sName; + newBoxList[x].selectImage = item.sMakeUpPath; + newBoxList[x].sName = doubleTitlieList1[i].name; + newBoxList[x].sAssignFormula = item.sAssignFormula; + newBoxList[x].bVisible = item.bVisible; + } + }); // 双盒盒型单独处理 } } // 盒身信息 if (masterData) { + 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 === "盒身") { newBoxList[index].value = masterData.sBoxBody; @@ -254,7 +290,15 @@ const BoxDesignCompontent = baseProps => { newBoxList[index].value = masterData.dBoxHeight; } else if (item.sName === "盒型名称") { newBoxList[index].value = masterData.sName; - } + } else if (item.sName === "首盒长") { + newBoxList[index].value = headLength; + } else if (item.sName === "首盒宽") { + newBoxList[index].value = headWidth; + } else if (item.sName === "次盒长") { + newBoxList[index].value = orderLength; + } else if (item.sName === "次盒宽") { + newBoxList[index].value = orderWidth; + } }); } // 有数据的时候 盒型设计需要赋值 @@ -355,9 +399,9 @@ const BoxDesignCompontent = baseProps => { sAssignFormula: null, })); setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"])); - setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"])); - setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"])); - setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"])); + // setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"])); + // setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"])); + // setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"])); } else { } }, [boxType]); @@ -379,7 +423,6 @@ const BoxDesignCompontent = baseProps => { }; const handleChange = (e, index) => { - console.log(e.target.value, index, "handleChange"); const updatedBoxList = [...boxList]; updatedBoxList[index].value = e.target.value; setBoxList(updatedBoxList); @@ -450,15 +493,17 @@ const BoxDesignCompontent = baseProps => { // 判断是新增还是修改 // 存储子表数据 + const boxTypes = boxList.find(item => item.sName === "盒身")?.type; + const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1; boxList.forEach((item, index) => { - const i = titleList1.findIndex(i => i.name === item.sName); - const slave = slaveData.find(z => z.sCode === titleList1[i]?.value); + const i = findList.findIndex(i => i.name === item.sName); + const slave = slaveData.find(z => z.sCode === findList[i]?.value); if (i !== -1) { const data = { ...slaveData[0], handleType: slave ? "update" : "add", sName: item.showName, - sCode: titleList1[i].value, + sCode: findList[i].value, iValue: item.value, iOrder: index + 1, iRowNum: index + 1, @@ -488,213 +533,17 @@ const BoxDesignCompontent = baseProps => { let sLengthFormula = ""; let sWidthFormula = ""; const boxType = boxList.find(item => item.sName === "盒身")?.type; - const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value); - const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value); - const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value); - const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); - const zscw = boxList.find(x => x.sName === "左(上)插位组件"); - const yscw = boxList.find(x => x.sName === "右(上)插位组件"); - const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); - const hdzj = boxList.find(x => x.sName === "盒底组件"); - const zxcwType = zxcw?.type; - const zxcwValue = zxcw?.value; - const zscwType = zscw?.type; - const zscwValue = zscw?.value; - const yscwType = yscw?.type; - const yscwValue = yscw?.value; - const yxcwType = yxcw?.type; - const yxcwValue = yxcw?.value; - let leftTopValue = 0; - let leftTop = ""; - let rightTopValue = 0; - let rightTop = ""; - let leftBottomValue = 0; - let leftBottom = ""; - let rightBottomValue = 0; - let rightBottom = ""; - if (boxType && boxType === "1") { - // 四面盒 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); - - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = - (leftTopValue > rightTopValue ? leftTop : rightTop) + - "D" + - (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "2") { - // 单折 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "3") { - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + W"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + W * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ W * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + W + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + W * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "W * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + W +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + W * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "W * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + W"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + W * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ W * 2"; - } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); - } else if (boxType && boxType === "4") { - // 天地盒 + if (boxType === "8") { + + } else { + const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value); + const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value); + const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value); const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); const zscw = boxList.find(x => x.sName === "左(上)插位组件"); const yscw = boxList.find(x => x.sName === "右(上)插位组件"); const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); + const hdzj = boxList.find(x => x.sName === "盒底组件"); const zxcwType = zxcw?.type; const zxcwValue = zxcw?.value; const zscwType = zscw?.type; @@ -703,111 +552,312 @@ const BoxDesignCompontent = baseProps => { const yscwValue = yscw?.value; const yxcwType = yxcw?.type; const yxcwValue = yxcw?.value; - let leftValue = ""; - let rightValue = ""; - let topValue = ""; - let bottomValue = ""; - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; - leftValue = "dZXCW + D * 2 +"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftValue = "dZXCW + D +"; - } else if (zxcwType === "4004") { - leftValue = "dZXCW + D * 3 +"; - } else if (zxcwType === "4005") { - leftValue = "D * 3 +"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightValue = "+ dYSCW + D * 2"; - } else if (yscwType === "6002" || yscwType === "6003") { - rightValue = "+ dYSCW + D"; - } else if (yscwType === "6004") { - rightValue = "+ dYSCW + D * 3"; - } else if (yscwType === "6005") { - rightValue = " + D * 3"; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - topValue = "dZSCW + D * 2 +"; - } else if (zscwType === "3002" || zscwType === "3003") { - topValue = "dZSCW + D +"; - } else if (zscwType === "3004") { - topValue = "dZSCW + D * 3 +"; - } else if (zscwType === "3005") { - topValue = "D * 3+"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - bottomValue = "+ dYXCW + D * 2"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - bottomValue = "+ dYXCW + D "; - } else if (yxcwType === "7004") { - bottomValue = "+ dYXCW + D * 3"; - } else if (yxcwType === "7005") { - bottomValue = "+ D * 3"; - } - // viewBoxWidth = Number(boxLength) + leftValue + rightValue; - // viewBoxHeight = Number(boxWidth) + topValue + bottomValue; - sLengthFormula = leftValue + "L" + rightValue; - sWidthFormula = topValue + "W" + bottomValue; - } else if (boxType && boxType === "5") { - // 飞机盒 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { - leftBottomValue = Number(zxcwValue) + boxHeight; - leftBottom = " + dZXCW + D"; - } else if (zxcwType === "4002" || zxcwType === "4003") { - leftBottomValue = Number(zxcwValue); - leftBottom = " + dZXCW"; - } else if (zxcwType === "4004") { - leftBottomValue = Number(zxcwValue) + boxHeight * 2; - leftBottom = " + dZXCW + D * 2"; - } else if (zxcwType === "4005") { - leftBottomValue = boxHeight * 2; - leftBottom = "+ D * 2"; - } - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { - rightTopValue = Number(yscwValue) + boxHeight; - rightTop = "dYSCW + D + "; - } else if (yscwType === "6002" || yscwType === "6003") { - rightTopValue = Number(yscwValue); - rightTop = "dYSCW + "; - } else if (yscwType === "6004") { - rightTopValue = Number(yscwValue) + boxHeight * 2; - rightTop = "dYSCW + D * 2+ "; - } else if (yscwType === "6005") { - rightTopValue = boxHeight * 2; - rightTop = "D * 2+ "; - } - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { - leftTopValue = Number(zscwValue) + boxHeight; - leftTop = "dZSCW + D +"; - } else if (zscwType === "3002" || zscwType === "3003") { - leftTopValue = Number(zscwValue); - leftTop = "dZSCW +"; - } else if (zscwType === "3004") { - leftTopValue = Number(zscwValue) + boxHeight * 2; - leftTop = "dZSCW + D * 2 +"; - } else if (zscwType === "3005") { - leftTopValue = boxHeight * 2; - leftTop = "D * 2 +"; - } - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { - rightBottomValue = Number(yxcwValue) + boxHeight; - rightBottom = "+ dYXCW + D"; - } else if (yxcwType === "7002" || yxcwType === "7003") { - rightBottomValue = Number(yxcwValue); - rightBottom = "+ dYXCW "; - } else if (yxcwType === "7004") { - rightBottomValue = Number(yxcwValue) + boxHeight * 2; - rightBottom = "+ dYXCW + D * 2"; - } else if (yxcwType === "7005") { - rightBottomValue = boxHeight * 2; - rightBottom = "+ D * 2"; + let leftTopValue = 0; + let leftTop = ""; + let rightTopValue = 0; + let rightTop = ""; + let leftBottomValue = 0; + let leftBottom = ""; + let rightBottomValue = 0; + let rightBottom = ""; + if (boxType && boxType === "1") { + // 四面盒 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); + + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { + leftBottomValue = Number(zxcwValue) + boxHeight; + leftBottom = " + dZXCW + W"; + } else if (zxcwType === "4002" || zxcwType === "4003") { + leftBottomValue = Number(zxcwValue); + leftBottom = " + dZXCW"; + } else if (zxcwType === "4004") { + leftBottomValue = Number(zxcwValue) + boxHeight * 2; + leftBottom = " + dZXCW + W * 2"; + } else if (zxcwType === "4005") { + leftBottomValue = boxHeight * 2; + leftBottom = "+ W * 2"; + } + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { + rightTopValue = Number(yscwValue) + boxHeight; + rightTop = "dYSCW + W + "; + } else if (yscwType === "6002" || yscwType === "6003") { + rightTopValue = Number(yscwValue); + rightTop = "dYSCW + "; + } else if (yscwType === "6004") { + rightTopValue = Number(yscwValue) + boxHeight * 2; + rightTop = "dYSCW + W * 2+ "; + } else if (yscwType === "6005") { + rightTopValue = boxHeight * 2; + rightTop = "W * 2+ "; + } + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { + leftTopValue = Number(zscwValue) + boxHeight; + leftTop = "dZSCW + W +"; + } else if (zscwType === "3002" || zscwType === "3003") { + leftTopValue = Number(zscwValue); + leftTop = "dZSCW +"; + } else if (zscwType === "3004") { + leftTopValue = Number(zscwValue) + boxHeight * 2; + leftTop = "dZSCW + W * 2 +"; + } else if (zscwType === "3005") { + leftTopValue = boxHeight * 2; + leftTop = "W * 2 +"; + } + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { + rightBottomValue = Number(yxcwValue) + boxHeight; + rightBottom = "+ dYXCW + W"; + } else if (yxcwType === "7002" || yxcwType === "7003") { + rightBottomValue = Number(yxcwValue); + rightBottom = "+ dYXCW "; + } else if (yxcwType === "7004") { + rightBottomValue = Number(yxcwValue) + boxHeight * 2; + rightBottom = "+ dYXCW + W * 2"; + } else if (yxcwType === "7005") { + rightBottomValue = boxHeight * 2; + rightBottom = "+ W * 2"; + } + sWidthFormula = + (leftTopValue > rightTopValue ? leftTop : rightTop) + + "D" + + (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom); + } else if (boxType && boxType === "2") { + // 单折 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : ""); + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { + leftBottomValue = Number(zxcwValue) + boxHeight; + leftBottom = " + dZXCW + W"; + } else if (zxcwType === "4002" || zxcwType === "4003") { + leftBottomValue = Number(zxcwValue); + leftBottom = " + dZXCW"; + } else if (zxcwType === "4004") { + leftBottomValue = Number(zxcwValue) + boxHeight * 2; + leftBottom = " + dZXCW + W * 2"; + } else if (zxcwType === "4005") { + leftBottomValue = boxHeight * 2; + leftBottom = "+ W * 2"; + } + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { + rightTopValue = Number(yscwValue) + boxHeight; + rightTop = "dYSCW + W + "; + } else if (yscwType === "6002" || yscwType === "6003") { + rightTopValue = Number(yscwValue); + rightTop = "dYSCW + "; + } else if (yscwType === "6004") { + rightTopValue = Number(yscwValue) + boxHeight * 2; + rightTop = "dYSCW + W * 2+ "; + } else if (yscwType === "6005") { + rightTopValue = boxHeight * 2; + rightTop = "W * 2+ "; + } + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { + leftTopValue = Number(zscwValue) + boxHeight; + leftTop = "dZSCW + W +"; + } else if (zscwType === "3002" || zscwType === "3003") { + leftTopValue = Number(zscwValue); + leftTop = "dZSCW +"; + } else if (zscwType === "3004") { + leftTopValue = Number(zscwValue) + boxHeight * 2; + leftTop = "dZSCW + W * 2 +"; + } else if (zscwType === "3005") { + leftTopValue = boxHeight * 2; + leftTop = "W * 2 +"; + } + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { + rightBottomValue = Number(yxcwValue) + boxHeight; + rightBottom = "+ dYXCW + W"; + } else if (yxcwType === "7002" || yxcwType === "7003") { + rightBottomValue = Number(yxcwValue); + rightBottom = "+ dYXCW "; + } else if (yxcwType === "7004") { + rightBottomValue = Number(yxcwValue) + boxHeight * 2; + rightBottom = "+ dYXCW + W * 2"; + } else if (yxcwType === "7005") { + rightBottomValue = boxHeight * 2; + rightBottom = "+ W * 2"; + } + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); + } else if (boxType && boxType === "3") { + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : ""); + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { + leftBottomValue = Number(zxcwValue) + boxHeight; + leftBottom = " + dZXCW + W"; + } else if (zxcwType === "4002" || zxcwType === "4003") { + leftBottomValue = Number(zxcwValue); + leftBottom = " + dZXCW"; + } else if (zxcwType === "4004") { + leftBottomValue = Number(zxcwValue) + boxHeight * 2; + leftBottom = " + dZXCW + W * 2"; + } else if (zxcwType === "4005") { + leftBottomValue = boxHeight * 2; + leftBottom = "+ W * 2"; + } + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { + rightTopValue = Number(yscwValue) + boxHeight; + rightTop = "dYSCW + W + "; + } else if (yscwType === "6002" || yscwType === "6003") { + rightTopValue = Number(yscwValue); + rightTop = "dYSCW + "; + } else if (yscwType === "6004") { + rightTopValue = Number(yscwValue) + boxHeight * 2; + rightTop = "dYSCW + W * 2+ "; + } else if (yscwType === "6005") { + rightTopValue = boxHeight * 2; + rightTop = "W * 2+ "; + } + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { + leftTopValue = Number(zscwValue) + boxHeight; + leftTop = "dZSCW + W +"; + } else if (zscwType === "3002" || zscwType === "3003") { + leftTopValue = Number(zscwValue); + leftTop = "dZSCW +"; + } else if (zscwType === "3004") { + leftTopValue = Number(zscwValue) + boxHeight * 2; + leftTop = "dZSCW + W * 2 +"; + } else if (zscwType === "3005") { + leftTopValue = boxHeight * 2; + leftTop = "W * 2 +"; + } + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { + rightBottomValue = Number(yxcwValue) + boxHeight; + rightBottom = "+ dYXCW + W"; + } else if (yxcwType === "7002" || yxcwType === "7003") { + rightBottomValue = Number(yxcwValue); + rightBottom = "+ dYXCW "; + } else if (yxcwType === "7004") { + rightBottomValue = Number(yxcwValue) + boxHeight * 2; + rightBottom = "+ dYXCW + W * 2"; + } else if (yxcwType === "7005") { + rightBottomValue = boxHeight * 2; + rightBottom = "+ W * 2"; + } + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); + } else if (boxType && boxType === "4") { + // 天地盒 + const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); + const zscw = boxList.find(x => x.sName === "左(上)插位组件"); + const yscw = boxList.find(x => x.sName === "右(上)插位组件"); + const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); + const zxcwType = zxcw?.type; + const zxcwValue = zxcw?.value; + const zscwType = zscw?.type; + const zscwValue = zscw?.value; + const yscwType = yscw?.type; + const yscwValue = yscw?.value; + const yxcwType = yxcw?.type; + const yxcwValue = yxcw?.value; + let leftValue = ""; + let rightValue = ""; + let topValue = ""; + let bottomValue = ""; + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { + // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; + leftValue = "dZXCW + D * 2 +"; + } else if (zxcwType === "4002" || zxcwType === "4003") { + leftValue = "dZXCW + D +"; + } else if (zxcwType === "4004") { + leftValue = "dZXCW + D * 3 +"; + } else if (zxcwType === "4005") { + leftValue = "D * 3 +"; + } + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { + rightValue = "+ dYSCW + D * 2"; + } else if (yscwType === "6002" || yscwType === "6003") { + rightValue = "+ dYSCW + D"; + } else if (yscwType === "6004") { + rightValue = "+ dYSCW + D * 3"; + } else if (yscwType === "6005") { + rightValue = " + D * 3"; + } + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { + topValue = "dZSCW + D * 2 +"; + } else if (zscwType === "3002" || zscwType === "3003") { + topValue = "dZSCW + D +"; + } else if (zscwType === "3004") { + topValue = "dZSCW + D * 3 +"; + } else if (zscwType === "3005") { + topValue = "D * 3+"; + } + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { + bottomValue = "+ dYXCW + D * 2"; + } else if (yxcwType === "7002" || yxcwType === "7003") { + bottomValue = "+ dYXCW + D "; + } else if (yxcwType === "7004") { + bottomValue = "+ dYXCW + D * 3"; + } else if (yxcwType === "7005") { + bottomValue = "+ D * 3"; + } + // viewBoxWidth = Number(boxLength) + leftValue + rightValue; + // viewBoxHeight = Number(boxWidth) + topValue + bottomValue; + sLengthFormula = leftValue + "L" + rightValue; + sWidthFormula = topValue + "W" + bottomValue; + } else if (boxType && boxType === "5") { + // 飞机盒 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { + leftBottomValue = Number(zxcwValue) + boxHeight; + leftBottom = " + dZXCW + D"; + } else if (zxcwType === "4002" || zxcwType === "4003") { + leftBottomValue = Number(zxcwValue); + leftBottom = " + dZXCW"; + } else if (zxcwType === "4004") { + leftBottomValue = Number(zxcwValue) + boxHeight * 2; + leftBottom = " + dZXCW + D * 2"; + } else if (zxcwType === "4005") { + leftBottomValue = boxHeight * 2; + leftBottom = "+ D * 2"; + } + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { + rightTopValue = Number(yscwValue) + boxHeight; + rightTop = "dYSCW + D + "; + } else if (yscwType === "6002" || yscwType === "6003") { + rightTopValue = Number(yscwValue); + rightTop = "dYSCW + "; + } else if (yscwType === "6004") { + rightTopValue = Number(yscwValue) + boxHeight * 2; + rightTop = "dYSCW + D * 2+ "; + } else if (yscwType === "6005") { + rightTopValue = boxHeight * 2; + rightTop = "D * 2+ "; + } + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { + leftTopValue = Number(zscwValue) + boxHeight; + leftTop = "dZSCW + D +"; + } else if (zscwType === "3002" || zscwType === "3003") { + leftTopValue = Number(zscwValue); + leftTop = "dZSCW +"; + } else if (zscwType === "3004") { + leftTopValue = Number(zscwValue) + boxHeight * 2; + leftTop = "dZSCW + D * 2 +"; + } else if (zscwType === "3005") { + leftTopValue = boxHeight * 2; + leftTop = "D * 2 +"; + } + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { + rightBottomValue = Number(yxcwValue) + boxHeight; + rightBottom = "+ dYXCW + D"; + } else if (yxcwType === "7002" || yxcwType === "7003") { + rightBottomValue = Number(yxcwValue); + rightBottom = "+ dYXCW "; + } else if (yxcwType === "7004") { + rightBottomValue = Number(yxcwValue) + boxHeight * 2; + rightBottom = "+ dYXCW + D * 2"; + } else if (yxcwType === "7005") { + rightBottomValue = boxHeight * 2; + rightBottom = "+ D * 2"; + } + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); } - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); } + // const sDoubleSize = JSON.stringify([headLength,headWidth,orderLength,orderWidth]) // 存储盒身数据 主表 const newMasterData = { ...masterData, @@ -902,13 +952,13 @@ const BoxDesignCompontent = baseProps => { ))} {boxType === "8" && - topDoubleBoxList.map((topItem, index) => ( -