Commit 494f925a276dee5608e5f1d20030d84ed00034f8

Authored by 陈鑫涛
1 parent d1b8a5ee

双盒盒型

src/components/Common/BoxDesignCompontent/index.js
@@ -187,6 +187,17 @@ const BoxDesignCompontent = baseProps => { @@ -187,6 +187,17 @@ const BoxDesignCompontent = baseProps => {
187 "右插位组件", 187 "右插位组件",
188 "右下插位组件", 188 "右下插位组件",
189 ]; 189 ];
  190 + const doubleTitlieList1 = [
  191 + { name: "左上插位组件", value: "dZSCW" },
  192 + { name: "上插位组件", value: "dSCW" },
  193 + { name: "右上插位组件", value: "dYSCW" },
  194 + { name: "左偏移", value: "dZPY" },
  195 + { name: "左插位组件", value: "dZCW" },
  196 + { name: "左下插位组件", value: "dZXCW" },
  197 + { name: "右偏移", value: "dYPY" },
  198 + { name: "右插位组件", value: "dYCW" },
  199 + { name: "右下插位组件", value: "dYXCW" },
  200 + ];
190 const newBoxList = []; 201 const newBoxList = [];
191 202
192 // const boxs = titleList.length + tableData.length; 203 // const boxs = titleList.length + tableData.length;
@@ -218,8 +229,10 @@ const BoxDesignCompontent = baseProps => { @@ -218,8 +229,10 @@ const BoxDesignCompontent = baseProps => {
218 }); 229 });
219 }); 230 });
220 // 部件信息 231 // 部件信息
  232 +
  233 + const boxTypes = masterData.sTypes;
221 if (slaveData && slaveData.length) { 234 if (slaveData && slaveData.length) {
222 - if (boxType !== "8") { 235 + if (boxTypes !== "8") {
223 slaveData.forEach((item, index) => { 236 slaveData.forEach((item, index) => {
224 const i = titleList1.findIndex(i => { 237 const i = titleList1.findIndex(i => {
225 return i.value === item.sCode; 238 return i.value === item.sCode;
@@ -236,11 +249,28 @@ const BoxDesignCompontent = baseProps => { @@ -236,11 +249,28 @@ const BoxDesignCompontent = baseProps => {
236 } 249 }
237 }); 250 });
238 } else { 251 } else {
  252 + slaveData.forEach((item, index) => {
  253 + const i = doubleTitlieList1.findIndex(i => {
  254 + return i.value === item.sCode;
  255 + });
  256 + if (i !== -1) {
  257 + const x = newBoxList.findIndex(z => z.sName === doubleTitlieList1[i].name);
  258 + newBoxList[x].value = item.iValue;
  259 + newBoxList[x].type = item.sTypes;
  260 + newBoxList[x].showName = item.sName;
  261 + newBoxList[x].selectImage = item.sMakeUpPath;
  262 + newBoxList[x].sName = doubleTitlieList1[i].name;
  263 + newBoxList[x].sAssignFormula = item.sAssignFormula;
  264 + newBoxList[x].bVisible = item.bVisible;
  265 + }
  266 + });
239 // 双盒盒型单独处理 267 // 双盒盒型单独处理
240 } 268 }
241 } 269 }
242 // 盒身信息 270 // 盒身信息
243 if (masterData) { 271 if (masterData) {
  272 + console.log(masterData,'masterData');
  273 +
244 newBoxList.forEach((item, index) => { 274 newBoxList.forEach((item, index) => {
245 if (item.sName === "盒身") { 275 if (item.sName === "盒身") {
246 newBoxList[index].value = masterData.sBoxBody; 276 newBoxList[index].value = masterData.sBoxBody;
@@ -254,7 +284,15 @@ const BoxDesignCompontent = baseProps => { @@ -254,7 +284,15 @@ const BoxDesignCompontent = baseProps => {
254 newBoxList[index].value = masterData.dBoxHeight; 284 newBoxList[index].value = masterData.dBoxHeight;
255 } else if (item.sName === "盒型名称") { 285 } else if (item.sName === "盒型名称") {
256 newBoxList[index].value = masterData.sName; 286 newBoxList[index].value = masterData.sName;
257 - } 287 + } else if (item.sName === "首盒长") {
  288 + // newBoxList[index].value = masterData.sName;
  289 + } else if (item.sName === "首盒宽") {
  290 + // newBoxList[index].value = masterData.sName;
  291 + } else if (item.sName === "次盒长") {
  292 + // newBoxList[index].value = masterData.sName;
  293 + } else if (item.sName === "次盒宽") {
  294 + // newBoxList[index].value = masterData.sName;
  295 + }
258 }); 296 });
259 } 297 }
260 // 有数据的时候 盒型设计需要赋值 298 // 有数据的时候 盒型设计需要赋值
@@ -313,6 +351,7 @@ const BoxDesignCompontent = baseProps => { @@ -313,6 +351,7 @@ const BoxDesignCompontent = baseProps => {
313 setRightBoxList(box.filter(rightBoxFilter)); 351 setRightBoxList(box.filter(rightBoxFilter));
314 } else if (type === "8" || type === 8) { 352 } else if (type === "8" || type === 8) {
315 const box = [...boxList]; 353 const box = [...boxList];
  354 + console.log("🚀 ~ updateLists ~ boxList:", boxList);
316 box.forEach(x => { 355 box.forEach(x => {
317 x.show = true; 356 x.show = true;
318 }); 357 });
@@ -355,9 +394,9 @@ const BoxDesignCompontent = baseProps => { @@ -355,9 +394,9 @@ const BoxDesignCompontent = baseProps => {
355 sAssignFormula: null, 394 sAssignFormula: null,
356 })); 395 }));
357 setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"])); 396 setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"]));
358 - setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"]));  
359 - setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"]));  
360 - setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"])); 397 + // setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"]));
  398 + // setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"]));
  399 + // setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"]));
361 } else { 400 } else {
362 } 401 }
363 }, [boxType]); 402 }, [boxType]);
@@ -450,15 +489,17 @@ const BoxDesignCompontent = baseProps => { @@ -450,15 +489,17 @@ const BoxDesignCompontent = baseProps => {
450 // 判断是新增还是修改 489 // 判断是新增还是修改
451 490
452 // 存储子表数据 491 // 存储子表数据
  492 + const boxTypes = boxList.find(item => item.sName === "盒身")?.type;
  493 + const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1;
453 boxList.forEach((item, index) => { 494 boxList.forEach((item, index) => {
454 - const i = titleList1.findIndex(i => i.name === item.sName);  
455 - const slave = slaveData.find(z => z.sCode === titleList1[i]?.value); 495 + const i = findList.findIndex(i => i.name === item.sName);
  496 + const slave = slaveData.find(z => z.sCode === findList[i]?.value);
456 if (i !== -1) { 497 if (i !== -1) {
457 const data = { 498 const data = {
458 ...slaveData[0], 499 ...slaveData[0],
459 handleType: slave ? "update" : "add", 500 handleType: slave ? "update" : "add",
460 sName: item.showName, 501 sName: item.showName,
461 - sCode: titleList1[i].value, 502 + sCode: findList[i].value,
462 iValue: item.value, 503 iValue: item.value,
463 iOrder: index + 1, 504 iOrder: index + 1,
464 iRowNum: index + 1, 505 iRowNum: index + 1,
@@ -488,213 +529,16 @@ const BoxDesignCompontent = baseProps => { @@ -488,213 +529,16 @@ const BoxDesignCompontent = baseProps => {
488 let sLengthFormula = ""; 529 let sLengthFormula = "";
489 let sWidthFormula = ""; 530 let sWidthFormula = "";
490 const boxType = boxList.find(item => item.sName === "盒身")?.type; 531 const boxType = boxList.find(item => item.sName === "盒身")?.type;
491 - const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value);  
492 - const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value);  
493 - const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value);  
494 - const zxcw = boxList.find(x => x.sName === "左(下)插位组件");  
495 - const zscw = boxList.find(x => x.sName === "左(上)插位组件");  
496 - const yscw = boxList.find(x => x.sName === "右(上)插位组件");  
497 - const yxcw = boxList.find(x => x.sName === "右(下)插位组件");  
498 - const hdzj = boxList.find(x => x.sName === "盒底组件");  
499 - const zxcwType = zxcw?.type;  
500 - const zxcwValue = zxcw?.value;  
501 - const zscwType = zscw?.type;  
502 - const zscwValue = zscw?.value;  
503 - const yscwType = yscw?.type;  
504 - const yscwValue = yscw?.value;  
505 - const yxcwType = yxcw?.type;  
506 - const yxcwValue = yxcw?.value;  
507 - let leftTopValue = 0;  
508 - let leftTop = "";  
509 - let rightTopValue = 0;  
510 - let rightTop = "";  
511 - let leftBottomValue = 0;  
512 - let leftBottom = "";  
513 - let rightBottomValue = 0;  
514 - let rightBottom = "";  
515 - if (boxType && boxType === "1") {  
516 - // 四面盒  
517 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;  
518 - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;  
519 - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : "");  
520 -  
521 - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {  
522 - leftBottomValue = Number(zxcwValue) + boxHeight;  
523 - leftBottom = " + dZXCW + W";  
524 - } else if (zxcwType === "4002" || zxcwType === "4003") {  
525 - leftBottomValue = Number(zxcwValue);  
526 - leftBottom = " + dZXCW";  
527 - } else if (zxcwType === "4004") {  
528 - leftBottomValue = Number(zxcwValue) + boxHeight * 2;  
529 - leftBottom = " + dZXCW + W * 2";  
530 - } else if (zxcwType === "4005") {  
531 - leftBottomValue = boxHeight * 2;  
532 - leftBottom = "+ W * 2";  
533 - }  
534 - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {  
535 - rightTopValue = Number(yscwValue) + boxHeight;  
536 - rightTop = "dYSCW + W + ";  
537 - } else if (yscwType === "6002" || yscwType === "6003") {  
538 - rightTopValue = Number(yscwValue);  
539 - rightTop = "dYSCW + ";  
540 - } else if (yscwType === "6004") {  
541 - rightTopValue = Number(yscwValue) + boxHeight * 2;  
542 - rightTop = "dYSCW + W * 2+ ";  
543 - } else if (yscwType === "6005") {  
544 - rightTopValue = boxHeight * 2;  
545 - rightTop = "W * 2+ ";  
546 - }  
547 - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {  
548 - leftTopValue = Number(zscwValue) + boxHeight;  
549 - leftTop = "dZSCW + W +";  
550 - } else if (zscwType === "3002" || zscwType === "3003") {  
551 - leftTopValue = Number(zscwValue);  
552 - leftTop = "dZSCW +";  
553 - } else if (zscwType === "3004") {  
554 - leftTopValue = Number(zscwValue) + boxHeight * 2;  
555 - leftTop = "dZSCW + W * 2 +";  
556 - } else if (zscwType === "3005") {  
557 - leftTopValue = boxHeight * 2;  
558 - leftTop = "W * 2 +";  
559 - }  
560 - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {  
561 - rightBottomValue = Number(yxcwValue) + boxHeight;  
562 - rightBottom = "+ dYXCW + W";  
563 - } else if (yxcwType === "7002" || yxcwType === "7003") {  
564 - rightBottomValue = Number(yxcwValue);  
565 - rightBottom = "+ dYXCW ";  
566 - } else if (yxcwType === "7004") {  
567 - rightBottomValue = Number(yxcwValue) + boxHeight * 2;  
568 - rightBottom = "+ dYXCW + W * 2";  
569 - } else if (yxcwType === "7005") {  
570 - rightBottomValue = boxHeight * 2;  
571 - rightBottom = "+ W * 2";  
572 - }  
573 - sWidthFormula =  
574 - (leftTopValue > rightTopValue ? leftTop : rightTop) +  
575 - "D" +  
576 - (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom);  
577 - } else if (boxType && boxType === "2") {  
578 - // 单折  
579 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;  
580 - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;  
581 - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : "");  
582 - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {  
583 - leftBottomValue = Number(zxcwValue) + boxHeight;  
584 - leftBottom = " + dZXCW + W";  
585 - } else if (zxcwType === "4002" || zxcwType === "4003") {  
586 - leftBottomValue = Number(zxcwValue);  
587 - leftBottom = " + dZXCW";  
588 - } else if (zxcwType === "4004") {  
589 - leftBottomValue = Number(zxcwValue) + boxHeight * 2;  
590 - leftBottom = " + dZXCW + W * 2";  
591 - } else if (zxcwType === "4005") {  
592 - leftBottomValue = boxHeight * 2;  
593 - leftBottom = "+ W * 2";  
594 - }  
595 - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {  
596 - rightTopValue = Number(yscwValue) + boxHeight;  
597 - rightTop = "dYSCW + W + ";  
598 - } else if (yscwType === "6002" || yscwType === "6003") {  
599 - rightTopValue = Number(yscwValue);  
600 - rightTop = "dYSCW + ";  
601 - } else if (yscwType === "6004") {  
602 - rightTopValue = Number(yscwValue) + boxHeight * 2;  
603 - rightTop = "dYSCW + W * 2+ ";  
604 - } else if (yscwType === "6005") {  
605 - rightTopValue = boxHeight * 2;  
606 - rightTop = "W * 2+ ";  
607 - }  
608 - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {  
609 - leftTopValue = Number(zscwValue) + boxHeight;  
610 - leftTop = "dZSCW + W +";  
611 - } else if (zscwType === "3002" || zscwType === "3003") {  
612 - leftTopValue = Number(zscwValue);  
613 - leftTop = "dZSCW +";  
614 - } else if (zscwType === "3004") {  
615 - leftTopValue = Number(zscwValue) + boxHeight * 2;  
616 - leftTop = "dZSCW + W * 2 +";  
617 - } else if (zscwType === "3005") {  
618 - leftTopValue = boxHeight * 2;  
619 - leftTop = "W * 2 +";  
620 - }  
621 - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {  
622 - rightBottomValue = Number(yxcwValue) + boxHeight;  
623 - rightBottom = "+ dYXCW + W";  
624 - } else if (yxcwType === "7002" || yxcwType === "7003") {  
625 - rightBottomValue = Number(yxcwValue);  
626 - rightBottom = "+ dYXCW ";  
627 - } else if (yxcwType === "7004") {  
628 - rightBottomValue = Number(yxcwValue) + boxHeight * 2;  
629 - rightBottom = "+ dYXCW + W * 2";  
630 - } else if (yxcwType === "7005") {  
631 - rightBottomValue = boxHeight * 2;  
632 - rightBottom = "+ W * 2";  
633 - }  
634 - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);  
635 - } else if (boxType && boxType === "3") {  
636 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;  
637 - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;  
638 - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : "");  
639 - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {  
640 - leftBottomValue = Number(zxcwValue) + boxHeight;  
641 - leftBottom = " + dZXCW + W";  
642 - } else if (zxcwType === "4002" || zxcwType === "4003") {  
643 - leftBottomValue = Number(zxcwValue);  
644 - leftBottom = " + dZXCW";  
645 - } else if (zxcwType === "4004") {  
646 - leftBottomValue = Number(zxcwValue) + boxHeight * 2;  
647 - leftBottom = " + dZXCW + W * 2";  
648 - } else if (zxcwType === "4005") {  
649 - leftBottomValue = boxHeight * 2;  
650 - leftBottom = "+ W * 2";  
651 - }  
652 - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {  
653 - rightTopValue = Number(yscwValue) + boxHeight;  
654 - rightTop = "dYSCW + W + ";  
655 - } else if (yscwType === "6002" || yscwType === "6003") {  
656 - rightTopValue = Number(yscwValue);  
657 - rightTop = "dYSCW + ";  
658 - } else if (yscwType === "6004") {  
659 - rightTopValue = Number(yscwValue) + boxHeight * 2;  
660 - rightTop = "dYSCW + W * 2+ ";  
661 - } else if (yscwType === "6005") {  
662 - rightTopValue = boxHeight * 2;  
663 - rightTop = "W * 2+ ";  
664 - }  
665 - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {  
666 - leftTopValue = Number(zscwValue) + boxHeight;  
667 - leftTop = "dZSCW + W +";  
668 - } else if (zscwType === "3002" || zscwType === "3003") {  
669 - leftTopValue = Number(zscwValue);  
670 - leftTop = "dZSCW +";  
671 - } else if (zscwType === "3004") {  
672 - leftTopValue = Number(zscwValue) + boxHeight * 2;  
673 - leftTop = "dZSCW + W * 2 +";  
674 - } else if (zscwType === "3005") {  
675 - leftTopValue = boxHeight * 2;  
676 - leftTop = "W * 2 +";  
677 - }  
678 - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {  
679 - rightBottomValue = Number(yxcwValue) + boxHeight;  
680 - rightBottom = "+ dYXCW + W";  
681 - } else if (yxcwType === "7002" || yxcwType === "7003") {  
682 - rightBottomValue = Number(yxcwValue);  
683 - rightBottom = "+ dYXCW ";  
684 - } else if (yxcwType === "7004") {  
685 - rightBottomValue = Number(yxcwValue) + boxHeight * 2;  
686 - rightBottom = "+ dYXCW + W * 2";  
687 - } else if (yxcwType === "7005") {  
688 - rightBottomValue = boxHeight * 2;  
689 - rightBottom = "+ W * 2";  
690 - }  
691 - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);  
692 - } else if (boxType && boxType === "4") {  
693 - // 天地盒 532 + if (boxType === "8") {
  533 + } else {
  534 + const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value);
  535 + const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value);
  536 + const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value);
694 const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); 537 const zxcw = boxList.find(x => x.sName === "左(下)插位组件");
695 const zscw = boxList.find(x => x.sName === "左(上)插位组件"); 538 const zscw = boxList.find(x => x.sName === "左(上)插位组件");
696 const yscw = boxList.find(x => x.sName === "右(上)插位组件"); 539 const yscw = boxList.find(x => x.sName === "右(上)插位组件");
697 const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); 540 const yxcw = boxList.find(x => x.sName === "右(下)插位组件");
  541 + const hdzj = boxList.find(x => x.sName === "盒底组件");
698 const zxcwType = zxcw?.type; 542 const zxcwType = zxcw?.type;
699 const zxcwValue = zxcw?.value; 543 const zxcwValue = zxcw?.value;
700 const zscwType = zscw?.type; 544 const zscwType = zscw?.type;
@@ -703,109 +547,309 @@ const BoxDesignCompontent = baseProps => { @@ -703,109 +547,309 @@ const BoxDesignCompontent = baseProps => {
703 const yscwValue = yscw?.value; 547 const yscwValue = yscw?.value;
704 const yxcwType = yxcw?.type; 548 const yxcwType = yxcw?.type;
705 const yxcwValue = yxcw?.value; 549 const yxcwValue = yxcw?.value;
706 - let leftValue = "";  
707 - let rightValue = "";  
708 - let topValue = "";  
709 - let bottomValue = "";  
710 - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {  
711 - // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2;  
712 - leftValue = "dZXCW + D * 2 +";  
713 - } else if (zxcwType === "4002" || zxcwType === "4003") {  
714 - leftValue = "dZXCW + D +";  
715 - } else if (zxcwType === "4004") {  
716 - leftValue = "dZXCW + D * 3 +";  
717 - } else if (zxcwType === "4005") {  
718 - leftValue = "D * 3 +";  
719 - }  
720 - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {  
721 - rightValue = "+ dYSCW + D * 2";  
722 - } else if (yscwType === "6002" || yscwType === "6003") {  
723 - rightValue = "+ dYSCW + D";  
724 - } else if (yscwType === "6004") {  
725 - rightValue = "+ dYSCW + D * 3";  
726 - } else if (yscwType === "6005") {  
727 - rightValue = " + D * 3";  
728 - }  
729 - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {  
730 - topValue = "dZSCW + D * 2 +";  
731 - } else if (zscwType === "3002" || zscwType === "3003") {  
732 - topValue = "dZSCW + D +";  
733 - } else if (zscwType === "3004") {  
734 - topValue = "dZSCW + D * 3 +";  
735 - } else if (zscwType === "3005") {  
736 - topValue = "D * 3+";  
737 - }  
738 - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {  
739 - bottomValue = "+ dYXCW + D * 2";  
740 - } else if (yxcwType === "7002" || yxcwType === "7003") {  
741 - bottomValue = "+ dYXCW + D ";  
742 - } else if (yxcwType === "7004") {  
743 - bottomValue = "+ dYXCW + D * 3";  
744 - } else if (yxcwType === "7005") {  
745 - bottomValue = "+ D * 3";  
746 - }  
747 - // viewBoxWidth = Number(boxLength) + leftValue + rightValue;  
748 - // viewBoxHeight = Number(boxWidth) + topValue + bottomValue;  
749 - sLengthFormula = leftValue + "L" + rightValue;  
750 - sWidthFormula = topValue + "W" + bottomValue;  
751 - } else if (boxType && boxType === "5") {  
752 - // 飞机盒  
753 - const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;  
754 - const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;  
755 - sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : "");  
756 - if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {  
757 - leftBottomValue = Number(zxcwValue) + boxHeight;  
758 - leftBottom = " + dZXCW + D";  
759 - } else if (zxcwType === "4002" || zxcwType === "4003") {  
760 - leftBottomValue = Number(zxcwValue);  
761 - leftBottom = " + dZXCW";  
762 - } else if (zxcwType === "4004") {  
763 - leftBottomValue = Number(zxcwValue) + boxHeight * 2;  
764 - leftBottom = " + dZXCW + D * 2";  
765 - } else if (zxcwType === "4005") {  
766 - leftBottomValue = boxHeight * 2;  
767 - leftBottom = "+ D * 2";  
768 - }  
769 - if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {  
770 - rightTopValue = Number(yscwValue) + boxHeight;  
771 - rightTop = "dYSCW + D + ";  
772 - } else if (yscwType === "6002" || yscwType === "6003") {  
773 - rightTopValue = Number(yscwValue);  
774 - rightTop = "dYSCW + ";  
775 - } else if (yscwType === "6004") {  
776 - rightTopValue = Number(yscwValue) + boxHeight * 2;  
777 - rightTop = "dYSCW + D * 2+ ";  
778 - } else if (yscwType === "6005") {  
779 - rightTopValue = boxHeight * 2;  
780 - rightTop = "D * 2+ ";  
781 - }  
782 - if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {  
783 - leftTopValue = Number(zscwValue) + boxHeight;  
784 - leftTop = "dZSCW + D +";  
785 - } else if (zscwType === "3002" || zscwType === "3003") {  
786 - leftTopValue = Number(zscwValue);  
787 - leftTop = "dZSCW +";  
788 - } else if (zscwType === "3004") {  
789 - leftTopValue = Number(zscwValue) + boxHeight * 2;  
790 - leftTop = "dZSCW + D * 2 +";  
791 - } else if (zscwType === "3005") {  
792 - leftTopValue = boxHeight * 2;  
793 - leftTop = "D * 2 +";  
794 - }  
795 - if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {  
796 - rightBottomValue = Number(yxcwValue) + boxHeight;  
797 - rightBottom = "+ dYXCW + D";  
798 - } else if (yxcwType === "7002" || yxcwType === "7003") {  
799 - rightBottomValue = Number(yxcwValue);  
800 - rightBottom = "+ dYXCW ";  
801 - } else if (yxcwType === "7004") {  
802 - rightBottomValue = Number(yxcwValue) + boxHeight * 2;  
803 - rightBottom = "+ dYXCW + D * 2";  
804 - } else if (yxcwType === "7005") {  
805 - rightBottomValue = boxHeight * 2;  
806 - rightBottom = "+ D * 2"; 550 + let leftTopValue = 0;
  551 + let leftTop = "";
  552 + let rightTopValue = 0;
  553 + let rightTop = "";
  554 + let leftBottomValue = 0;
  555 + let leftBottom = "";
  556 + let rightBottomValue = 0;
  557 + let rightBottom = "";
  558 + if (boxType && boxType === "1") {
  559 + // 四面盒
  560 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  561 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  562 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : "");
  563 +
  564 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  565 + leftBottomValue = Number(zxcwValue) + boxHeight;
  566 + leftBottom = " + dZXCW + W";
  567 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  568 + leftBottomValue = Number(zxcwValue);
  569 + leftBottom = " + dZXCW";
  570 + } else if (zxcwType === "4004") {
  571 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  572 + leftBottom = " + dZXCW + W * 2";
  573 + } else if (zxcwType === "4005") {
  574 + leftBottomValue = boxHeight * 2;
  575 + leftBottom = "+ W * 2";
  576 + }
  577 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  578 + rightTopValue = Number(yscwValue) + boxHeight;
  579 + rightTop = "dYSCW + W + ";
  580 + } else if (yscwType === "6002" || yscwType === "6003") {
  581 + rightTopValue = Number(yscwValue);
  582 + rightTop = "dYSCW + ";
  583 + } else if (yscwType === "6004") {
  584 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  585 + rightTop = "dYSCW + W * 2+ ";
  586 + } else if (yscwType === "6005") {
  587 + rightTopValue = boxHeight * 2;
  588 + rightTop = "W * 2+ ";
  589 + }
  590 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  591 + leftTopValue = Number(zscwValue) + boxHeight;
  592 + leftTop = "dZSCW + W +";
  593 + } else if (zscwType === "3002" || zscwType === "3003") {
  594 + leftTopValue = Number(zscwValue);
  595 + leftTop = "dZSCW +";
  596 + } else if (zscwType === "3004") {
  597 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  598 + leftTop = "dZSCW + W * 2 +";
  599 + } else if (zscwType === "3005") {
  600 + leftTopValue = boxHeight * 2;
  601 + leftTop = "W * 2 +";
  602 + }
  603 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  604 + rightBottomValue = Number(yxcwValue) + boxHeight;
  605 + rightBottom = "+ dYXCW + W";
  606 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  607 + rightBottomValue = Number(yxcwValue);
  608 + rightBottom = "+ dYXCW ";
  609 + } else if (yxcwType === "7004") {
  610 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  611 + rightBottom = "+ dYXCW + W * 2";
  612 + } else if (yxcwType === "7005") {
  613 + rightBottomValue = boxHeight * 2;
  614 + rightBottom = "+ W * 2";
  615 + }
  616 + sWidthFormula =
  617 + (leftTopValue > rightTopValue ? leftTop : rightTop) +
  618 + "D" +
  619 + (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  620 + } else if (boxType && boxType === "2") {
  621 + // 单折
  622 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  623 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  624 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : "");
  625 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  626 + leftBottomValue = Number(zxcwValue) + boxHeight;
  627 + leftBottom = " + dZXCW + W";
  628 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  629 + leftBottomValue = Number(zxcwValue);
  630 + leftBottom = " + dZXCW";
  631 + } else if (zxcwType === "4004") {
  632 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  633 + leftBottom = " + dZXCW + W * 2";
  634 + } else if (zxcwType === "4005") {
  635 + leftBottomValue = boxHeight * 2;
  636 + leftBottom = "+ W * 2";
  637 + }
  638 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  639 + rightTopValue = Number(yscwValue) + boxHeight;
  640 + rightTop = "dYSCW + W + ";
  641 + } else if (yscwType === "6002" || yscwType === "6003") {
  642 + rightTopValue = Number(yscwValue);
  643 + rightTop = "dYSCW + ";
  644 + } else if (yscwType === "6004") {
  645 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  646 + rightTop = "dYSCW + W * 2+ ";
  647 + } else if (yscwType === "6005") {
  648 + rightTopValue = boxHeight * 2;
  649 + rightTop = "W * 2+ ";
  650 + }
  651 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  652 + leftTopValue = Number(zscwValue) + boxHeight;
  653 + leftTop = "dZSCW + W +";
  654 + } else if (zscwType === "3002" || zscwType === "3003") {
  655 + leftTopValue = Number(zscwValue);
  656 + leftTop = "dZSCW +";
  657 + } else if (zscwType === "3004") {
  658 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  659 + leftTop = "dZSCW + W * 2 +";
  660 + } else if (zscwType === "3005") {
  661 + leftTopValue = boxHeight * 2;
  662 + leftTop = "W * 2 +";
  663 + }
  664 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  665 + rightBottomValue = Number(yxcwValue) + boxHeight;
  666 + rightBottom = "+ dYXCW + W";
  667 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  668 + rightBottomValue = Number(yxcwValue);
  669 + rightBottom = "+ dYXCW ";
  670 + } else if (yxcwType === "7004") {
  671 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  672 + rightBottom = "+ dYXCW + W * 2";
  673 + } else if (yxcwType === "7005") {
  674 + rightBottomValue = boxHeight * 2;
  675 + rightBottom = "+ W * 2";
  676 + }
  677 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  678 + } else if (boxType && boxType === "3") {
  679 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  680 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  681 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : "");
  682 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  683 + leftBottomValue = Number(zxcwValue) + boxHeight;
  684 + leftBottom = " + dZXCW + W";
  685 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  686 + leftBottomValue = Number(zxcwValue);
  687 + leftBottom = " + dZXCW";
  688 + } else if (zxcwType === "4004") {
  689 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  690 + leftBottom = " + dZXCW + W * 2";
  691 + } else if (zxcwType === "4005") {
  692 + leftBottomValue = boxHeight * 2;
  693 + leftBottom = "+ W * 2";
  694 + }
  695 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  696 + rightTopValue = Number(yscwValue) + boxHeight;
  697 + rightTop = "dYSCW + W + ";
  698 + } else if (yscwType === "6002" || yscwType === "6003") {
  699 + rightTopValue = Number(yscwValue);
  700 + rightTop = "dYSCW + ";
  701 + } else if (yscwType === "6004") {
  702 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  703 + rightTop = "dYSCW + W * 2+ ";
  704 + } else if (yscwType === "6005") {
  705 + rightTopValue = boxHeight * 2;
  706 + rightTop = "W * 2+ ";
  707 + }
  708 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  709 + leftTopValue = Number(zscwValue) + boxHeight;
  710 + leftTop = "dZSCW + W +";
  711 + } else if (zscwType === "3002" || zscwType === "3003") {
  712 + leftTopValue = Number(zscwValue);
  713 + leftTop = "dZSCW +";
  714 + } else if (zscwType === "3004") {
  715 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  716 + leftTop = "dZSCW + W * 2 +";
  717 + } else if (zscwType === "3005") {
  718 + leftTopValue = boxHeight * 2;
  719 + leftTop = "W * 2 +";
  720 + }
  721 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  722 + rightBottomValue = Number(yxcwValue) + boxHeight;
  723 + rightBottom = "+ dYXCW + W";
  724 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  725 + rightBottomValue = Number(yxcwValue);
  726 + rightBottom = "+ dYXCW ";
  727 + } else if (yxcwType === "7004") {
  728 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  729 + rightBottom = "+ dYXCW + W * 2";
  730 + } else if (yxcwType === "7005") {
  731 + rightBottomValue = boxHeight * 2;
  732 + rightBottom = "+ W * 2";
  733 + }
  734 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  735 + } else if (boxType && boxType === "4") {
  736 + // 天地盒
  737 + const zxcw = boxList.find(x => x.sName === "左(下)插位组件");
  738 + const zscw = boxList.find(x => x.sName === "左(上)插位组件");
  739 + const yscw = boxList.find(x => x.sName === "右(上)插位组件");
  740 + const yxcw = boxList.find(x => x.sName === "右(下)插位组件");
  741 + const zxcwType = zxcw?.type;
  742 + const zxcwValue = zxcw?.value;
  743 + const zscwType = zscw?.type;
  744 + const zscwValue = zscw?.value;
  745 + const yscwType = yscw?.type;
  746 + const yscwValue = yscw?.value;
  747 + const yxcwType = yxcw?.type;
  748 + const yxcwValue = yxcw?.value;
  749 + let leftValue = "";
  750 + let rightValue = "";
  751 + let topValue = "";
  752 + let bottomValue = "";
  753 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  754 + // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2;
  755 + leftValue = "dZXCW + D * 2 +";
  756 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  757 + leftValue = "dZXCW + D +";
  758 + } else if (zxcwType === "4004") {
  759 + leftValue = "dZXCW + D * 3 +";
  760 + } else if (zxcwType === "4005") {
  761 + leftValue = "D * 3 +";
  762 + }
  763 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  764 + rightValue = "+ dYSCW + D * 2";
  765 + } else if (yscwType === "6002" || yscwType === "6003") {
  766 + rightValue = "+ dYSCW + D";
  767 + } else if (yscwType === "6004") {
  768 + rightValue = "+ dYSCW + D * 3";
  769 + } else if (yscwType === "6005") {
  770 + rightValue = " + D * 3";
  771 + }
  772 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  773 + topValue = "dZSCW + D * 2 +";
  774 + } else if (zscwType === "3002" || zscwType === "3003") {
  775 + topValue = "dZSCW + D +";
  776 + } else if (zscwType === "3004") {
  777 + topValue = "dZSCW + D * 3 +";
  778 + } else if (zscwType === "3005") {
  779 + topValue = "D * 3+";
  780 + }
  781 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  782 + bottomValue = "+ dYXCW + D * 2";
  783 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  784 + bottomValue = "+ dYXCW + D ";
  785 + } else if (yxcwType === "7004") {
  786 + bottomValue = "+ dYXCW + D * 3";
  787 + } else if (yxcwType === "7005") {
  788 + bottomValue = "+ D * 3";
  789 + }
  790 + // viewBoxWidth = Number(boxLength) + leftValue + rightValue;
  791 + // viewBoxHeight = Number(boxWidth) + topValue + bottomValue;
  792 + sLengthFormula = leftValue + "L" + rightValue;
  793 + sWidthFormula = topValue + "W" + bottomValue;
  794 + } else if (boxType && boxType === "5") {
  795 + // 飞机盒
  796 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  797 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  798 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : "");
  799 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  800 + leftBottomValue = Number(zxcwValue) + boxHeight;
  801 + leftBottom = " + dZXCW + D";
  802 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  803 + leftBottomValue = Number(zxcwValue);
  804 + leftBottom = " + dZXCW";
  805 + } else if (zxcwType === "4004") {
  806 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  807 + leftBottom = " + dZXCW + D * 2";
  808 + } else if (zxcwType === "4005") {
  809 + leftBottomValue = boxHeight * 2;
  810 + leftBottom = "+ D * 2";
  811 + }
  812 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  813 + rightTopValue = Number(yscwValue) + boxHeight;
  814 + rightTop = "dYSCW + D + ";
  815 + } else if (yscwType === "6002" || yscwType === "6003") {
  816 + rightTopValue = Number(yscwValue);
  817 + rightTop = "dYSCW + ";
  818 + } else if (yscwType === "6004") {
  819 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  820 + rightTop = "dYSCW + D * 2+ ";
  821 + } else if (yscwType === "6005") {
  822 + rightTopValue = boxHeight * 2;
  823 + rightTop = "D * 2+ ";
  824 + }
  825 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  826 + leftTopValue = Number(zscwValue) + boxHeight;
  827 + leftTop = "dZSCW + D +";
  828 + } else if (zscwType === "3002" || zscwType === "3003") {
  829 + leftTopValue = Number(zscwValue);
  830 + leftTop = "dZSCW +";
  831 + } else if (zscwType === "3004") {
  832 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  833 + leftTop = "dZSCW + D * 2 +";
  834 + } else if (zscwType === "3005") {
  835 + leftTopValue = boxHeight * 2;
  836 + leftTop = "D * 2 +";
  837 + }
  838 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  839 + rightBottomValue = Number(yxcwValue) + boxHeight;
  840 + rightBottom = "+ dYXCW + D";
  841 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  842 + rightBottomValue = Number(yxcwValue);
  843 + rightBottom = "+ dYXCW ";
  844 + } else if (yxcwType === "7004") {
  845 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  846 + rightBottom = "+ dYXCW + D * 2";
  847 + } else if (yxcwType === "7005") {
  848 + rightBottomValue = boxHeight * 2;
  849 + rightBottom = "+ D * 2";
  850 + }
  851 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
807 } 852 }
808 - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);  
809 } 853 }
810 854
811 // 存储盒身数据 主表 855 // 存储盒身数据 主表
@@ -902,13 +946,13 @@ const BoxDesignCompontent = baseProps => { @@ -902,13 +946,13 @@ const BoxDesignCompontent = baseProps => {
902 </div> 946 </div>
903 ))} 947 ))}
904 {boxType === "8" && 948 {boxType === "8" &&
905 - topDoubleBoxList.map((topItem, index) => (  
906 - <div key={index} className={styles.boxFlex} style={{ display: topItem.show ? "block" : "none" }}>  
907 - <div className={styles.boxTitle}>{topItem.sName}</div>  
908 - {topItem?.selectImage ? ( 949 + topDoubleBoxList.map((item, index) => (
  950 + <div key={index} className={styles.boxFlex} style={{ display: item.show ? "block" : "none" }}>
  951 + <div className={styles.boxTitle}>{doubleTitlieList[index]}</div>
  952 + {item?.selectImage ? (
909 <img 953 <img
910 - src={topItem?.selectImage}  
911 - alt={topItem.value} 954 + src={item?.selectImage}
  955 + alt={item.value}
912 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }} 956 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }}
913 /> 957 />
914 ) : ( 958 ) : (
@@ -920,31 +964,30 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -920,31 +964,30 @@ const BoxDesignCompontent = baseProps =&gt; {
920 className="mySelects" 964 className="mySelects"
921 style={{ width: 180 }} 965 style={{ width: 180 }}
922 defaultValue={options.length ? options[0].value : ""} 966 defaultValue={options.length ? options[0].value : ""}
923 - onSelect={(value, option) => handleSelect(value, option, index, 0)} 967 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
924 onDropdownVisibleChange={async open => { 968 onDropdownVisibleChange={async open => {
925 if (open) { 969 if (open) {
926 - props.getSqlOptions(4); // 在下拉菜单打开时调用 getSqlOptions 970 + props.getSqlOptions(index + 11); // 在下拉菜单打开时调用 getSqlOptions
927 } 971 }
928 }} 972 }}
929 > 973 >
930 {!loading ? options.map(option => renderOptionWithImage(option)) : ""} 974 {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
931 </Select> 975 </Select>
932 <div className={styles.boxInput}> 976 <div className={styles.boxInput}>
933 - {/* <div className={styles.text}>参数:</div> */}  
934 <Input 977 <Input
935 - value={topItem?.showName}  
936 - onChange={e => handleChangeName(e, index)}  
937 - onFocus={e => handleFocus(e, index)}  
938 - onBlur={e => handleBlur(e, index)}  
939 - readOnly={!topItem?.isEditable} 978 + value={item?.showName}
  979 + onChange={e => handleChangeName(e, findIndexBySname(item.sName))}
  980 + onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
  981 + onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
  982 + readOnly={!item?.isEditable}
940 className={styles.text} 983 className={styles.text}
941 /> 984 />
942 <Input 985 <Input
943 - value={topItem?.value}  
944 - onChange={e => handleChange(e, index)}  
945 - onFocus={e => handleFocus(e, index)}  
946 - onBlur={e => handleBlur(e, index)}  
947 - readOnly={!topItem?.isEditable} 986 + value={item?.value}
  987 + onChange={e => handleChange(e, findIndexBySname(item.sName))}
  988 + onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
  989 + onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
  990 + readOnly={!item?.isEditable}
948 style={{ width: " 80%" }} 991 style={{ width: " 80%" }}
949 /> 992 />
950 </div> 993 </div>
@@ -1013,20 +1056,24 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1013,20 +1056,24 @@ const BoxDesignCompontent = baseProps =&gt; {
1013 <div key={index + 3} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}> 1056 <div key={index + 3} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}>
1014 <div className={styles.boxTitle}>{doubleTitlieList[index + 3]}</div> 1057 <div className={styles.boxTitle}>{doubleTitlieList[index + 3]}</div>
1015 1058
1016 - <Select  
1017 - optionLabelProp="label"  
1018 - className="mySelects"  
1019 - style={{ width: 180 }}  
1020 - defaultValue={options.length ? options[0].value : ""}  
1021 - onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}  
1022 - onDropdownVisibleChange={async open => {  
1023 - if (open) {  
1024 - props.getSqlOptions(4); // 在下拉菜单打开时调用 getSqlOptions  
1025 - }  
1026 - }}  
1027 - >  
1028 - {!loading ? options.map(option => renderOptionWithImage(option)) : ""}  
1029 - </Select> 1059 + {index !== 0 ? (
  1060 + <Select
  1061 + optionLabelProp="label"
  1062 + className="mySelects"
  1063 + style={{ width: 180 }}
  1064 + defaultValue={options.length ? options[0].value : ""}
  1065 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
  1066 + onDropdownVisibleChange={async open => {
  1067 + if (open) {
  1068 + props.getSqlOptions(index + 13); // 在下拉菜单打开时调用 getSqlOptions
  1069 + }
  1070 + }}
  1071 + >
  1072 + {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
  1073 + </Select>
  1074 + ) : (
  1075 + ""
  1076 + )}
1030 <div className={styles.boxInput}> 1077 <div className={styles.boxInput}>
1031 {item?.selectImage ? ( 1078 {item?.selectImage ? (
1032 <img 1079 <img
@@ -1128,20 +1175,24 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1128,20 +1175,24 @@ const BoxDesignCompontent = baseProps =&gt; {
1128 <div key={index + 6} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}> 1175 <div key={index + 6} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}>
1129 <div className={styles.boxTitle}>{doubleTitlieList[index + 6]}</div> 1176 <div className={styles.boxTitle}>{doubleTitlieList[index + 6]}</div>
1130 1177
1131 - <Select  
1132 - optionLabelProp="label"  
1133 - className="mySelects"  
1134 - style={{ width: 180 }}  
1135 - defaultValue={options.length ? options[0].value : ""}  
1136 - onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}  
1137 - onDropdownVisibleChange={async open => {  
1138 - if (open) {  
1139 - props.getSqlOptions(findIndexBySname(item.sName) + 1); // 在下拉菜单打开时调用 getSqlOptions  
1140 - }  
1141 - }}  
1142 - >  
1143 - {!loading ? options.map(option => renderOptionWithImage(option)) : ""}  
1144 - </Select> 1178 + {index !== 0 ? (
  1179 + <Select
  1180 + optionLabelProp="label"
  1181 + className="mySelects"
  1182 + style={{ width: 180 }}
  1183 + defaultValue={options.length ? options[0].value : ""}
  1184 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
  1185 + onDropdownVisibleChange={async open => {
  1186 + if (open) {
  1187 + props.getSqlOptions(index + 15); // 在下拉菜单打开时调用 getSqlOptions
  1188 + }
  1189 + }}
  1190 + >
  1191 + {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
  1192 + </Select>
  1193 + ) : (
  1194 + ""
  1195 + )}
1145 <div className={styles.boxInput}> 1196 <div className={styles.boxInput}>
1146 {item?.selectImage ? ( 1197 {item?.selectImage ? (
1147 <img 1198 <img
src/components/Common/BoxDesignCompontent/svg.js
@@ -51,7 +51,6 @@ import { @@ -51,7 +51,6 @@ import {
51 createBoxComponentNewFul6, 51 createBoxComponentNewFul6,
52 } from "../BoxDesign/createAirplaneBox"; 52 } from "../BoxDesign/createAirplaneBox";
53 const SvgBox = props => { 53 const SvgBox = props => {
54 - console.log("🚀 ~ SvgBox:", props);  
55 const svgContainerRef = useRef(null); 54 const svgContainerRef = useRef(null);
56 const svgRef = useRef(null); 55 const svgRef = useRef(null);
57 const [boxKey, setBoxKey] = useState(new Date().getTime()); 56 const [boxKey, setBoxKey] = useState(new Date().getTime());
@@ -100,7 +99,6 @@ const SvgBox = props =&gt; { @@ -100,7 +99,6 @@ const SvgBox = props =&gt; {
100 orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0; 99 orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0;
101 orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0; 100 orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0;
102 } 101 }
103 - console.log(headLength, headWidth, orderLength, orderWidth, props.showNew, "orderWidth");  
104 102
105 // 计算视口宽度和高度 103 // 计算视口宽度和高度
106 const zbtb = boxList.find(x => x.sName === "左贴边位"); 104 const zbtb = boxList.find(x => x.sName === "左贴边位");
@@ -264,9 +262,10 @@ const SvgBox = props =&gt; { @@ -264,9 +262,10 @@ const SvgBox = props =&gt; {
264 // viewBoxWidth = boxWidth + leftValue + rightValue; 262 // viewBoxWidth = boxWidth + leftValue + rightValue;
265 // viewBoxHeight = boxLength + dZSCW + dYXCW; 263 // viewBoxHeight = boxLength + dZSCW + dYXCW;
266 } else if (Number(svgType) === 8) { 264 } else if (Number(svgType) === 8) {
267 - 265 + const top = topOffect(boxList, headLength, headWidth);
268 viewBoxWidth = Number(headLength); 266 viewBoxWidth = Number(headLength);
269 - viewBoxHeight = Number(headWidth) + Number(orderWidth); 267 + viewBoxHeight = Number(headWidth) + Number(orderWidth) + top;
  268 + console.log("🚀 ~ initSVG ~ viewBoxHeight:", viewBoxHeight);
270 } 269 }
271 // 计算缩放比例 270 // 计算缩放比例
272 let scale = 1; 271 let scale = 1;
@@ -281,6 +280,8 @@ const SvgBox = props =&gt; { @@ -281,6 +280,8 @@ const SvgBox = props =&gt; {
281 const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); 280 const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight);
282 if (Number(svgType) === 4) { 281 if (Number(svgType) === 4) {
283 ySvg = ySvg + boxHeight * scale; 282 ySvg = ySvg + boxHeight * scale;
  283 + } else if (Number(svgType) === 8) {
  284 + ySvg = topOffect(boxList, headLength, headWidth) * scale;
284 } 285 }
285 ySvg = ySvg + 50 * scale; 286 ySvg = ySvg + 50 * scale;
286 let xSvg = 0; 287 let xSvg = 0;
@@ -304,6 +305,8 @@ const SvgBox = props =&gt; { @@ -304,6 +305,8 @@ const SvgBox = props =&gt; {
304 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; 305 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
305 if (Number(svgType) === 4) { 306 if (Number(svgType) === 4) {
306 ySvg = ySvg + boxHeight; 307 ySvg = ySvg + boxHeight;
  308 + } else if (Number(svgType) === 8) {
  309 + ySvg = topOffect(boxList, headLength, headWidth) * scale;
307 } 310 }
308 ySvg = ySvg + 50 * scale; 311 ySvg = ySvg + 50 * scale;
309 let xSvg = 0; 312 let xSvg = 0;
@@ -312,7 +315,6 @@ const SvgBox = props =&gt; { @@ -312,7 +315,6 @@ const SvgBox = props =&gt; {
312 } else { 315 } else {
313 xSvg = zbtb?.value; 316 xSvg = zbtb?.value;
314 } 317 }
315 - console.log(xSvg, viewBoxWidth / 2, viewBoxWidth, "viewBoxWidth / 2");  
316 318
317 svg.setAttribute( 319 svg.setAttribute(
318 "viewBox", 320 "viewBox",
@@ -1164,32 +1166,7 @@ const SvgBox = props =&gt; { @@ -1164,32 +1166,7 @@ const SvgBox = props =&gt; {
1164 } 1166 }
1165 // 右下部件 1167 // 右下部件
1166 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); 1168 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight));
1167 - // if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {  
1168 - // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));  
1169 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));  
1170 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW));  
1171 - // } else if (yxbj?.type === "7004" && yxbj?.value) {  
1172 - // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));  
1173 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));  
1174 - // pathList.push(  
1175 - // createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)  
1176 - // );  
1177 - // pathList.push(  
1178 - // createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")  
1179 - // );  
1180 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW));  
1181 - // } else if (yxbj?.type === "7005" && yxbj?.value) {  
1182 - // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));  
1183 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));  
1184 - // pathList.push(  
1185 - // createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)  
1186 - // );  
1187 - // pathList.push(  
1188 - // createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W")  
1189 - // );  
1190 - // } else if (dYXCW && yxbj?.type) {  
1191 - // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW));  
1192 - // } 1169 +
1193 // 右边 1170 // 右边
1194 pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); 1171 pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0));
1195 pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); 1172 pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0));
@@ -1199,18 +1176,20 @@ const SvgBox = props =&gt; { @@ -1199,18 +1176,20 @@ const SvgBox = props =&gt; {
1199 }); 1176 });
1200 svg.appendChild(g); 1177 svg.appendChild(g);
1201 } else if (Number(svgType) === 8) { 1178 } else if (Number(svgType) === 8) {
1202 - const scaleHeadLength = headLength * scale  
1203 - const scaleHeadWidth = headWidth * scale  
1204 - const scaleOrderLength = orderLength * scale  
1205 - const scaleOrderWidth = orderWidth * scale 1179 + const scaleHeadLength = headLength * scale;
  1180 + const scaleHeadWidth = headWidth * scale;
  1181 + const scaleOrderLength = orderLength * scale;
  1182 + const scaleOrderWidth = orderWidth * scale;
1206 // 获取他的偏移距离 1183 // 获取他的偏移距离
1207 - const leftOffect = boxList.find(x=>x.sName === "左偏移")?.value || 0  
1208 - const rightOffect = boxList.find(x=>x.sName === "右偏移")?.value || 0 1184 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  1185 + const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0;
1209 const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }]; 1186 const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }];
1210 rectangles.forEach(rect => { 1187 rectangles.forEach(rect => {
1211 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1188 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1212 }); 1189 });
1213 - const rectanglesLeft = [{ x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }]; 1190 + const rectanglesLeft = [
  1191 + { x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth },
  1192 + ];
1214 rectanglesLeft.forEach(rect => { 1193 rectanglesLeft.forEach(rect => {
1215 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1194 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1216 }); 1195 });
@@ -1218,583 +1197,283 @@ const SvgBox = props =&gt; { @@ -1218,583 +1197,283 @@ const SvgBox = props =&gt; {
1218 rectanglesRight.forEach(rect => { 1197 rectanglesRight.forEach(rect => {
1219 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1198 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1220 }); 1199 });
  1200 + // 处理双盒的插位组件
  1201 + let pathList = [];
  1202 + // 获取左上
  1203 + const scw = boxList.find(x => x.sName === "上插位组件");
  1204 + const zscw = boxList.find(x => x.sName === "左上插位组件");
  1205 + const yscw = boxList.find(x => x.sName === "右上插位组件");
  1206 + const zcw = boxList.find(x => x.sName === "左插位组件");
  1207 + const ycw = boxList.find(x => x.sName === "右插位组件");
  1208 + const zxcw = boxList.find(x => x.sName === "左下插位组件");
  1209 + const yxcw = boxList.find(x => x.sName === "右下插位组件");
  1210 + const dSCW = scw?.value;
  1211 + const dZSCW = zscw?.value;
  1212 + const dYSCW = yscw?.value;
  1213 + const dZCW = zcw?.value;
  1214 + const dYCW = ycw?.value;
  1215 + const dZXCW = zxcw?.value;
  1216 + const dYXCW = yxcw?.value;
  1217 + // 上插位
  1218 + pathList.push(createDynamicTopLeft(scw?.type, scaleHeadLength, -scaleHeadWidth, -dSCW * scale, 0, 0));
  1219 + // 左上插位
  1220 + pathList.push(createFull(zscw?.type, scaleHeadWidth, -scaleHeadWidth, -dZSCW * scale, 0, 0));
  1221 + // 左插位
  1222 + pathList.push(
  1223 + createFull(
  1224 + zcw?.type,
  1225 + scaleOrderWidth,
  1226 + -scaleOrderWidth,
  1227 + -dZCW * scale,
  1228 + scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect),
  1229 + scaleHeadWidth
  1230 + )
  1231 + );
  1232 + // 左下
  1233 + pathList.push(
  1234 + createDynamicTopLeft(
  1235 + zxcw?.type,
  1236 + scaleOrderLength,
  1237 + scaleOrderWidth,
  1238 + dZXCW * scale,
  1239 + scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect),
  1240 + scaleHeadWidth + scaleOrderWidth
  1241 + )
  1242 + );
  1243 + // 右上
  1244 + pathList.push(createFull(yscw?.type, scaleHeadWidth, scaleHeadWidth, dYSCW * scale, scaleHeadLength, 0));
  1245 + // 右插位
  1246 + pathList.push(
  1247 + createFull(
  1248 + ycw?.type,
  1249 + scaleOrderWidth,
  1250 + scaleOrderWidth,
  1251 + dYCW * scale,
  1252 + scaleHeadLength / 2 + Number(rightOffect) + scaleOrderLength,
  1253 + scaleHeadWidth
  1254 + )
  1255 + );
  1256 + // 右下
  1257 + pathList.push(
  1258 + createDynamicTopLeft(
  1259 + yxcw?.type,
  1260 + scaleOrderLength,
  1261 + scaleOrderWidth,
  1262 + dYXCW * scale,
  1263 + scaleHeadLength / 2 + Number(rightOffect),
  1264 + scaleHeadWidth + scaleOrderWidth
  1265 + )
  1266 + );
  1267 +
  1268 + pathList.forEach(x => {
  1269 + g.appendChild(x);
  1270 + });
1221 svg.appendChild(g); 1271 svg.appendChild(g);
1222 } 1272 }
1223 }; 1273 };
1224 // 计算头部偏移 1274 // 计算头部偏移
1225 const topOffect = (list, length, width, height) => { 1275 const topOffect = (list, length, width, height) => {
1226 - // 判断code  
1227 - const valueList = list.filter(x => x.type !== ("" || null));  
1228 - // const titleList = ['上方盒舌','左(上)插位组件','右(上)插位组件']  
1229 - const sfhs = valueList.find(x => x.sName === "上方盒舌");  
1230 - const zscw = valueList.find(x => x.sName === "左(上)插位组件");  
1231 - const yscw = valueList.find(x => x.sName === "右(上)插位组件");  
1232 - const svgType = valueList.find(x => x.sName === "盒身")?.type;  
1233 - let top = 0; 1276 + const val = list.filter(x => x.type);
  1277 + const sfhs = val.find(x => x.sName === "上方盒舌");
  1278 + const zscw = val.find(x => x.sName === "左(上)插位组件");
  1279 + const yscw = val.find(x => x.sName === "右(上)插位组件");
  1280 + const box = val.find(x => x.sName === "盒身");
  1281 + const svg = Number(box?.type);
  1282 + if (svg === 6) return 0;
  1283 +
  1284 + const dZ = Number(zscw?.value) || 0;
  1285 + const dY = Number(yscw?.value) || 0;
  1286 +
  1287 + if (svg === 8) {
  1288 + const scw = val.find(x => x.sName === "上插位组件");
  1289 + let tops = 0;
  1290 + if (scw?.type === "11001") {
  1291 + tops = width + Number(scw.value);
  1292 + }
  1293 + return tops;
  1294 + }
  1295 +
1234 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; 1296 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
1235 const four = ["6004", "3004", "4004", "7004"]; 1297 const four = ["6004", "3004", "4004", "7004"];
1236 const five = ["6005", "3005", "4005", "7005"]; 1298 const five = ["6005", "3005", "4005", "7005"];
1237 - const dYSCW = Number(yscw?.value) || 0;  
1238 - const dZSCW = Number(zscw?.value) || 0;  
1239 - if (Number(svgType) === 6) return 0;  
1240 - // 如果存在插位就不计算盒舌  
1241 - if (zscw?.type && yscw?.type) {  
1242 - const max = Math.max(dZSCW, dYSCW);  
1243 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1244 - top = svgType === "5" ? height * 2 : width * 2;  
1245 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1246 - const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW;  
1247 - const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW;  
1248 1299
1249 - const max = Math.max(z, y);  
1250 - if (max > (sfhs?.value || 0)) {  
1251 - top = max;  
1252 - } else {  
1253 - top = sfhs?.value;  
1254 - }  
1255 - } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) {  
1256 - const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW;  
1257 - const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW; 1300 + const coef = box?.type === "5" ? height : width;
1258 1301
1259 - const max = Math.max(z, y); 1302 + const pick = (cw, d) => {
  1303 + const t = cw?.type;
  1304 + if (five.includes(t)) return 2 * coef;
  1305 + if (four.includes(t)) return 2 * coef + d;
  1306 + if (one.includes(t)) return coef + d;
  1307 + return d;
  1308 + };
1260 1309
1261 - if (max > (sfhs?.value || 0)) {  
1262 - top = max;  
1263 - } else {  
1264 - top = sfhs?.value;  
1265 - }  
1266 - } else {  
1267 - top = max;  
1268 - } 1310 + let top = 0;
  1311 + if (zscw?.type && yscw?.type) {
  1312 + const z = pick(zscw, dZ);
  1313 + const y = pick(yscw, dY);
  1314 + top = Math.max(z, y, sfhs?.value || 0);
1269 } else if (yscw?.type) { 1315 } else if (yscw?.type) {
1270 - const max = dYSCW;  
1271 - if (  
1272 - five.includes(zscw?.type) ||  
1273 - five.includes(yscw?.type) ||  
1274 - four.includes(zscw?.type) ||  
1275 - four.includes(yscw?.type) ||  
1276 - one.includes(zscw?.type) ||  
1277 - one.includes(yscw?.type)  
1278 - ) {  
1279 - const coefficient = svgType === "5" ? height : width;  
1280 - let addValue = 0;  
1281 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1282 - addValue = 2 * coefficient;  
1283 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1284 - addValue = 2 * coefficient + max;  
1285 - } else {  
1286 - addValue = coefficient + max;  
1287 - }  
1288 - top = addValue > sfhs?.value ? addValue : sfhs?.value;  
1289 - } else {  
1290 - top = (addValue || 0) > sfhs?.value ? max : sfhs?.value;  
1291 - } 1316 + top = Math.max(pick(yscw, dY), sfhs?.value || 0);
1292 } else if (zscw?.type) { 1317 } else if (zscw?.type) {
1293 - const max = dZSCW;  
1294 - if (  
1295 - five.includes(zscw?.type) ||  
1296 - five.includes(yscw?.type) ||  
1297 - four.includes(zscw?.type) ||  
1298 - four.includes(yscw?.type) ||  
1299 - one.includes(zscw?.type) ||  
1300 - one.includes(yscw?.type)  
1301 - ) {  
1302 - const coefficient = svgType === "5" ? height : width;  
1303 - let addValue = 0;  
1304 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1305 - addValue = 2 * coefficient;  
1306 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1307 - addValue = 2 * coefficient + max;  
1308 - } else {  
1309 - addValue = coefficient + max;  
1310 - }  
1311 - top = addValue > sfhs?.value ? addValue : sfhs?.value;  
1312 - } else {  
1313 - top = max > sfhs?.value ? max : sfhs?.value;  
1314 - } 1318 + top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
1315 } else { 1319 } else {
1316 - top = sfhs?.value; 1320 + top = sfhs?.value || 0;
1317 } 1321 }
1318 1322
1319 - // 处理天地盒默认加上高  
1320 - if (Number(svgType) === 4) {  
1321 - top = top + height;  
1322 - } 1323 + if (svg === 4) top += height;
1323 return isNaN(top) ? 0 : top; 1324 return isNaN(top) ? 0 : top;
1324 }; 1325 };
1325 const bottomOffect = (list, length, width, height) => { 1326 const bottomOffect = (list, length, width, height) => {
1326 - // 判断code  
1327 - const valueList = list.filter(x => x.type !== ("" || null));  
1328 - // const titleList = ['上方盒舌','左(上)插位组件','右(上)插位组件']  
1329 - const sfhs = valueList.find(x => x.sName === "下方盒舌");  
1330 - const zscw = valueList.find(x => x.sName === "左(下)插位组件");  
1331 - const yscw = valueList.find(x => x.sName === "右(下)插位组件");  
1332 - const hdzj = valueList.find(x => x.sName === "盒底组件");  
1333 - const svgType = valueList.find(x => x.sName === "盒身")?.type;  
1334 - // 将找到的对象放入数组中,并过滤掉 undefined 值  
1335 - // 使用 reduce 方法比较 value 属性,找出最大的对象  
1336 - let top = 0; 1327 + const val = list.filter(x => x.type);
  1328 + const sfhs = val.find(x => x.sName === "下方盒舌");
  1329 + const zscw = val.find(x => x.sName === "左(下)插位组件");
  1330 + const yscw = val.find(x => x.sName === "右(下)插位组件");
  1331 + const hdzj = val.find(x => x.sName === "盒底组件");
  1332 + const box = val.find(x => x.sName === "盒身");
  1333 + const svg = Number(box?.type);
  1334 +
  1335 + if (svg === 6) return 0;
  1336 + if (hdzj?.type) return Number(hdzj.value);
  1337 +
  1338 + const dZ = Number(zscw?.value) || 0;
  1339 + const dY = Number(yscw?.value) || 0;
  1340 +
1337 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; 1341 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
1338 const four = ["6004", "3004", "4004", "7004"]; 1342 const four = ["6004", "3004", "4004", "7004"];
1339 const five = ["6005", "3005", "4005", "7005"]; 1343 const five = ["6005", "3005", "4005", "7005"];
1340 - const dYSCW = Number(yscw?.value) || 0;  
1341 - const dZSCW = Number(zscw?.value) || 0;  
1342 - if (Number(svgType) === 6) return 0;  
1343 - if (hdzj?.type) {  
1344 - return Number(hdzj?.value);  
1345 - } 1344 +
  1345 + const coef = box?.type === "5" ? height : width;
  1346 +
  1347 + const pick = (cw, d) => {
  1348 + const t = cw?.type;
  1349 + if (five.includes(t)) return 2 * coef;
  1350 + if (four.includes(t)) return 2 * coef + d;
  1351 + if (one.includes(t)) return coef + d;
  1352 + return d;
  1353 + };
  1354 +
  1355 + let top = 0;
1346 if (zscw?.type && yscw?.type) { 1356 if (zscw?.type && yscw?.type) {
1347 - const max = Math.max(dZSCW, dYSCW);  
1348 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1349 - top = svgType === "5" ? height * 2 : width * 2;  
1350 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1351 - const z = four.includes(zscw?.type) ? (svgType === "5" ? height * 2 + dZSCW : width * 2 + dZSCW) : dZSCW;  
1352 - const y = four.includes(yscw?.type) ? (svgType === "5" ? height * 2 + dYSCW : width * 2 + dYSCW) : dYSCW;  
1353 - const max = Math.max(z, y);  
1354 - if (max > (sfhs?.value || 0)) {  
1355 - top = max;  
1356 - } else {  
1357 - top = sfhs?.value;  
1358 - }  
1359 - } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) {  
1360 - const z = one.includes(zscw?.type) ? (svgType === "5" ? height + dZSCW : width + dZSCW) : dZSCW;  
1361 - const y = one.includes(yscw?.type) ? (svgType === "5" ? height + dYSCW : width + dYSCW) : dYSCW;  
1362 - const max = Math.max(z, y);  
1363 - if (max > (sfhs?.value || 0)) {  
1364 - top = max;  
1365 - } else {  
1366 - top = sfhs?.value;  
1367 - }  
1368 - } else {  
1369 - top = max;  
1370 - } 1357 + const z = pick(zscw, dZ);
  1358 + const y = pick(yscw, dY);
  1359 + top = Math.max(z, y, sfhs?.value || 0);
1371 } else if (yscw?.type) { 1360 } else if (yscw?.type) {
1372 - const max = dYSCW;  
1373 - if (  
1374 - five.includes(zscw?.type) ||  
1375 - five.includes(yscw?.type) ||  
1376 - four.includes(zscw?.type) ||  
1377 - four.includes(yscw?.type) ||  
1378 - one.includes(zscw?.type) ||  
1379 - one.includes(yscw?.type)  
1380 - ) {  
1381 - const coefficient = svgType === "5" ? height : width;  
1382 - let addValue = 0;  
1383 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1384 - addValue = 2 * coefficient;  
1385 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1386 - addValue = 2 * coefficient + max;  
1387 - } else {  
1388 - addValue = coefficient + max;  
1389 - }  
1390 - top = addValue > sfhs?.value ? addValue : sfhs?.value;  
1391 - } else {  
1392 - top = sfhs?.value ? max : sfhs?.value;  
1393 - } 1361 + top = Math.max(pick(yscw, dY), sfhs?.value || 0);
1394 } else if (zscw?.type) { 1362 } else if (zscw?.type) {
1395 - const max = dZSCW;  
1396 - if (  
1397 - five.includes(zscw?.type) ||  
1398 - five.includes(yscw?.type) ||  
1399 - four.includes(zscw?.type) ||  
1400 - four.includes(yscw?.type) ||  
1401 - one.includes(zscw?.type) ||  
1402 - one.includes(yscw?.type)  
1403 - ) {  
1404 - const coefficient = svgType === "5" ? height : width;  
1405 - let addValue = 0;  
1406 - if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1407 - addValue = 2 * coefficient;  
1408 - } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1409 - addValue = 2 * coefficient + max;  
1410 - } else {  
1411 - addValue = coefficient + max;  
1412 - }  
1413 - top = addValue > sfhs?.value ? addValue : sfhs?.value;  
1414 - } else {  
1415 - top = max > sfhs?.value ? max : sfhs?.value;  
1416 - } 1363 + top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
1417 } else { 1364 } else {
1418 - top = sfhs?.value;  
1419 - }  
1420 - // if (five.includes(zscw?.type) || five.includes(yscw?.type)) {  
1421 - // top = width * 2;  
1422 - // } else if (four.includes(zscw?.type) || four.includes(yscw?.type)) {  
1423 - // if (dZSCW && dYSCW) {  
1424 - // const max = Math.max(dZSCW, dYSCW);  
1425 - // top = width * 2 + max;  
1426 - // } else if (dZSCW && !dYSCW) {  
1427 - // top = width * 2 + dZSCW;  
1428 - // } else if (!dZSCW && dYSCW) {  
1429 - // top = width * 2 + dYSCW;  
1430 - // }  
1431 - // } else if (one.includes(zscw?.type) || one.includes(yscw?.type)) {  
1432 - // if (dZSCW && dYSCW) {  
1433 - // const max = Math.max(dZSCW, dYSCW);  
1434 - // top = width + max;  
1435 - // } else if (dZSCW && !dYSCW) {  
1436 - // top = width + dZSCW;  
1437 - // } else if (!dZSCW && dYSCW) {  
1438 - // top = width + dYSCW;  
1439 - // }  
1440 - // } else {  
1441 - // if (dZSCW && !dYSCW) {  
1442 - // top = Number(dZSCW);  
1443 - // } else if (!dZSCW && dYSCW) {  
1444 - // top = Number(dYSCW);  
1445 - // } else {  
1446 - // top = Number(sfhs?.value);  
1447 - // }  
1448 - // }  
1449 - // 处理天地盒默认加上高  
1450 - if (Number(svgType) === 4) {  
1451 - top = top + height; 1365 + top = sfhs?.value || 0;
1452 } 1366 }
  1367 +
  1368 + if (svg === 4) top += height;
1453 return isNaN(top) ? 0 : top; 1369 return isNaN(top) ? 0 : top;
1454 }; 1370 };
1455 // 上方盒舌左边 1371 // 上方盒舌左边
1456 - const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, offsetX, offsetY) => {  
1457 - if (!height) return createNoneProject();  
1458 - // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回  
1459 - let data = {};  
1460 - switch (upperBoxTongueType) {  
1461 - case "1001":  
1462 - data = createLineWeltTop(width, height, offsetX, offsetY);  
1463 - break;  
1464 - case "1002":  
1465 - data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY);  
1466 - break;  
1467 - case "1003":  
1468 - data = createTrapezoidWeltTop(width, height, offsetX, offsetY);  
1469 - break;  
1470 - case "1004":  
1471 - data = createFoldWeltTop(width, height, offsetX, offsetY);  
1472 - break;  
1473 - case "1005":  
1474 - data = createRoundedCornersWeltTop(width, height, offsetX, offsetY);  
1475 - break;  
1476 - case "2001":  
1477 - data = createLineWeltTop(width, height, offsetX, offsetY);  
1478 - break;  
1479 - case "2002":  
1480 - data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY);  
1481 - break;  
1482 - case "2003":  
1483 - data = createTrapezoidWeltTop(width, height, offsetX, offsetY);  
1484 - break;  
1485 - case "2004":  
1486 - data = createFoldWeltTop(width, height, offsetX, offsetY);  
1487 - break;  
1488 - case "2005":  
1489 - data = createRoundedCornersWeltTop(width, height, offsetX, offsetY);  
1490 - break;  
1491 - default:  
1492 - data = createNoneProject();  
1493 - break;  
1494 - }  
1495 - return data;  
1496 - };  
1497 - // 右上方盒舌  
1498 - const createUpperBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {  
1499 - if (!size) return createNoneProject();  
1500 - // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回  
1501 - let data = {};  
1502 - switch (upperBoxTongueType) {  
1503 - case "1001":  
1504 - data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);  
1505 - break;  
1506 - case 1:  
1507 - data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);  
1508 - break;  
1509 - default:  
1510 - data = createNoneProject();  
1511 - break;  
1512 - }  
1513 - return data; 1372 + const createUpperBoxTongueLeft = (type, w, h, ox, oy) => {
  1373 + if (!h) return createNoneProject();
  1374 + const fnMap = {
  1375 + 1001: createLineWeltTop,
  1376 + 1002: createIsoscelesTrapezoidWeltTop,
  1377 + 1003: createTrapezoidWeltTop,
  1378 + 1004: createFoldWeltTop,
  1379 + 1005: createRoundedCornersWeltTop,
  1380 + 2001: createLineWeltTop,
  1381 + 2002: createIsoscelesTrapezoidWeltTop,
  1382 + 2003: createTrapezoidWeltTop,
  1383 + 2004: createFoldWeltTop,
  1384 + 2005: createRoundedCornersWeltTop,
  1385 + };
  1386 + return (fnMap[type] || createNoneProject)(w, h, ox, oy);
1514 }; 1387 };
  1388 +
1515 // 右上方盒舌 1389 // 右上方盒舌
1516 - const createBottomBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {  
1517 - if (!size) return createNoneProject();  
1518 - // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回  
1519 - let data = {};  
1520 - switch (upperBoxTongueType) {  
1521 - case 0:  
1522 - data = createTopTongue(-deep, offsetX, offsetY, size, -2, 5, 0, true);  
1523 - break;  
1524 - case 1:  
1525 - data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);  
1526 - break;  
1527 - default:  
1528 - data = createNoneProject();  
1529 - break;  
1530 - }  
1531 - return data;  
1532 - };  
1533 - const createBottomBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {  
1534 - if (!size) return createNoneProject();  
1535 - // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回  
1536 - let data = {};  
1537 - switch (upperBoxTongueType) {  
1538 - case 0:  
1539 - data = createTopTongue(deep, offsetX, offsetY, size, 2, 5, 1, false);  
1540 - break;  
1541 - case 1:  
1542 - data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2);  
1543 - break;  
1544 - default:  
1545 - data = createNoneProject();  
1546 - break;  
1547 - }  
1548 - return data;  
1549 - };  
1550 1390
1551 // 左边贴位 1391 // 左边贴位
1552 const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { 1392 const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => {
1553 if (!size) return createNoneProject(); 1393 if (!size) return createNoneProject();
1554 - let data = {};  
1555 - switch (trapezoidLeftType) {  
1556 - case "8001":  
1557 - data = createWelt(height, size, offsetX, offsetY);  
1558 - break;  
1559 - case "8002":  
1560 - data = createWelt1(height, size, offsetX, offsetY);  
1561 - break;  
1562 - case "8003":  
1563 - data = createWelt2(height, size, offsetX, offsetY);  
1564 - break;  
1565 - case "8004":  
1566 - data = createWelt3(height, size, offsetX, offsetY);  
1567 - break;  
1568 - case "8005":  
1569 - data = createWelt4(height, size, offsetX, offsetY, dSFHS, dXFHS);  
1570 - break;  
1571 - default:  
1572 - data = createNoneProject();  
1573 - break;  
1574 - }  
1575 - return data; 1394 + const fnMap = {
  1395 + 8001: createWelt,
  1396 + 8002: createWelt1,
  1397 + 8003: createWelt2,
  1398 + 8004: createWelt3,
  1399 + 8005: createWelt4,
  1400 + };
  1401 + const fn = fnMap[trapezoidLeftType];
  1402 + return fn
  1403 + ? trapezoidLeftType === "8005"
  1404 + ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS)
  1405 + : fn(height, size, offsetX, offsetY)
  1406 + : createNoneProject();
1576 }; 1407 };
1577 // 右边贴位 1408 // 右边贴位
1578 const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { 1409 const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => {
1579 - if (!size) return createNoneProject();  
1580 - let data = {};  
1581 - switch (trapezoidLeftType) {  
1582 - case "9001":  
1583 - data = createWelt(height, size, offsetX, offsetY);  
1584 - break;  
1585 - case "9002":  
1586 - data = createWelt1(height, size, offsetX, offsetY);  
1587 - break;  
1588 - case "9003":  
1589 - data = createWelt2Right(height, size, offsetX, offsetY);  
1590 - break;  
1591 - case "9004":  
1592 - data = createWelt3Right(height, size, offsetX, offsetY);  
1593 - break;  
1594 - case "9005":  
1595 - data = createWelt4Right(height, size, offsetX, offsetY, dSFHS, dXFHS);  
1596 - break;  
1597 - default:  
1598 - data = createNoneProject();  
1599 - break;  
1600 - }  
1601 - return data; 1410 + const suffix = trapezoidLeftType;
  1411 + const fnMap = {
  1412 + 9001: createWelt,
  1413 + 9002: createWelt1,
  1414 + 9003: createWelt2Right,
  1415 + 9004: createWelt3Right,
  1416 + 9005: createWelt4Right,
  1417 + };
  1418 + const fn = fnMap[suffix];
  1419 + return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject();
1602 }; 1420 };
1603 // 左上部件 1421 // 左上部件
1604 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { 1422 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => {
1605 if (!size) return createNoneProject(); 1423 if (!size) return createNoneProject();
1606 - let data = {};  
1607 - switch (trapezoidLeftType) {  
1608 - case "3001":  
1609 - data = createBoxComponentNew(width, height, size, offsetX, offsetY);  
1610 - break;  
1611 - case "3002":  
1612 - data = createBoxComponentNew1(width, height, size, offsetX, offsetY);  
1613 - break;  
1614 - case "3003":  
1615 - data = createBoxComponentNew2(width, height, size, offsetX, offsetY);  
1616 - break;  
1617 - case "3004":  
1618 - data = createBoxComponentNew3(width, height, size, offsetX, offsetY);  
1619 - break;  
1620 - case "3005":  
1621 - data = createBoxComponentNew4(width, height, size, offsetX, offsetY);  
1622 - break;  
1623 - case "3006":  
1624 - data = createBoxComponentNew5(width, height, size, offsetX, offsetY);  
1625 - break;  
1626 - case "3007":  
1627 - data = createBoxComponentNew6(width, height, size, offsetX, offsetY);  
1628 - break;  
1629 - case "4001":  
1630 - data = createBoxComponentNew(width, height, size, offsetX, offsetY);  
1631 - break;  
1632 - case "4002":  
1633 - data = createBoxComponentNew1(width, height, size, offsetX, offsetY);  
1634 - break;  
1635 - case "4003":  
1636 - data = createBoxComponentNew2(width, height, size, offsetX, offsetY);  
1637 - break;  
1638 - case "4004":  
1639 - data = createBoxComponentNew3(width, height, size, offsetX, offsetY);  
1640 - break;  
1641 - case "4005":  
1642 - data = createBoxComponentNew4(width, height, size, offsetX, offsetY);  
1643 - break;  
1644 - case "4006":  
1645 - data = createBoxComponentNew5(width, height, size, offsetX, offsetY);  
1646 - break;  
1647 - case "4007":  
1648 - data = createBoxComponentNew6(width, height, size, offsetX, offsetY);  
1649 - break;  
1650 - case "6001":  
1651 - data = createBoxComponentNew(width, height, size, offsetX, offsetY);  
1652 - break;  
1653 - case "6002":  
1654 - data = createBoxComponentNew1(width, height, size, offsetX, offsetY);  
1655 - break;  
1656 - case "6003":  
1657 - data = createBoxComponentNew2(width, height, size, offsetX, offsetY);  
1658 - break;  
1659 - case "6004":  
1660 - data = createBoxComponentNew3(width, height, size, offsetX, offsetY);  
1661 - break;  
1662 - case "6005":  
1663 - data = createBoxComponentNew4(width, height, size, offsetX, offsetY);  
1664 - break;  
1665 - case "6006":  
1666 - data = createBoxComponentNew5(width, height, size, offsetX, offsetY);  
1667 - break;  
1668 - case "6007":  
1669 - data = createBoxComponentNew6(width, height, size, offsetX, offsetY);  
1670 - break;  
1671 - case "7001":  
1672 - data = createBoxComponentNew(width, height, size, offsetX, offsetY);  
1673 - break;  
1674 - case "7002":  
1675 - data = createBoxComponentNew1(width, height, size, offsetX, offsetY);  
1676 - break;  
1677 - case "7003":  
1678 - data = createBoxComponentNew2(width, height, size, offsetX, offsetY);  
1679 - break;  
1680 - case "7004":  
1681 - data = createBoxComponentNew3(width, height, size, offsetX, offsetY);  
1682 - break;  
1683 - case "7005":  
1684 - data = createBoxComponentNew4(width, height, size, offsetX, offsetY);  
1685 - break;  
1686 - case "7006":  
1687 - data = createBoxComponentNew5(width, height, size, offsetX, offsetY);  
1688 - break;  
1689 - case "7007":  
1690 - data = createBoxComponentNew6(width, height, size, offsetX, offsetY);  
1691 - break;  
1692 - default:  
1693 - data = createNoneProject();  
1694 - break;  
1695 - }  
1696 - return data;  
1697 - };  
1698 - // 右上部件  
1699 - const createDynamicTopRight = (trapezoidLeftType, width, height, size, offsetX, offsetY) => {  
1700 - if (!size) return createNoneProject();  
1701 - let data = {};  
1702 - switch (trapezoidLeftType) {  
1703 - case "6001":  
1704 - data = createBoxComponentNew(width, height, size, offsetX, offsetY);  
1705 - break;  
1706 - case 1:  
1707 - break;  
1708 - default:  
1709 - data = createNoneProject();  
1710 - break;  
1711 - }  
1712 - return data; 1424 +
  1425 + const suffix = trapezoidLeftType?.slice(-2);
  1426 + const fnMap = {
  1427 + "01": createBoxComponentNew,
  1428 + "02": createBoxComponentNew1,
  1429 + "03": createBoxComponentNew2,
  1430 + "04": createBoxComponentNew3,
  1431 + "05": createBoxComponentNew4,
  1432 + "06": createBoxComponentNew5,
  1433 + "07": createBoxComponentNew6,
  1434 + };
  1435 +
  1436 + const fn = fnMap[suffix];
  1437 + return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject();
1713 }; 1438 };
  1439 +
1714 // 盒底组件 特殊的盒底组件 1440 // 盒底组件 特殊的盒底组件
1715 const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { 1441 const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => {
1716 - let data = {};  
1717 - switch (trapezoidLeftType) {  
1718 - case "5001":  
1719 - data = createRightAngleBoxBottomComponent(width, deep, size, offsetX, offsetY);  
1720 - break;  
1721 - case "5002":  
1722 - data = createBoxBottomComponent1(width, deep, size, offsetX, offsetY);  
1723 - break;  
1724 - case "5003":  
1725 - data = createBoxBottomComponent2(width, deep, size, offsetX, offsetY);  
1726 - break;  
1727 - case "5004":  
1728 - data = createBoxBottomComponent3(width, deep, size, offsetX, offsetY);  
1729 - break;  
1730 - case "5005":  
1731 - data = createBoxBottomComponent4(width, deep, size, offsetX, offsetY);  
1732 - break;  
1733 - case "5006":  
1734 - data = createBoxBottomComponent5(width, deep, size, offsetX, offsetY);  
1735 - break;  
1736 - case "5007":  
1737 - data = createBoxBottomComponent6(width, deep, size, offsetX, offsetY);  
1738 - break;  
1739 - default:  
1740 - data = createNoneProject();  
1741 - break;  
1742 - }  
1743 - return data; 1442 + const suffix = trapezoidLeftType?.slice(-2);
  1443 + const fnMap = {
  1444 + "01": createRightAngleBoxBottomComponent,
  1445 + "02": createBoxBottomComponent1,
  1446 + "03": createBoxBottomComponent2,
  1447 + "04": createBoxBottomComponent3,
  1448 + "05": createBoxBottomComponent4,
  1449 + "06": createBoxBottomComponent5,
  1450 + "07": createBoxBottomComponent6,
  1451 + };
  1452 + return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY);
1744 }; 1453 };
1745 -  
1746 // 天地盒部件 1454 // 天地盒部件
1747 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { 1455 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => {
1748 - let data = {};  
1749 if (!size) return createNoneProject(); 1456 if (!size) return createNoneProject();
1750 - switch (trapezoidLeftType) {  
1751 - case "4001":  
1752 - data = createBoxComponentNewFull(width, deep, size, offsetX, offsetY);  
1753 - break;  
1754 - case "4002":  
1755 - data = createBoxComponentNewFull1(width, size, offsetX, offsetY);  
1756 - break;  
1757 - case "4003":  
1758 - data = createBoxComponentNewFull2(width, size, offsetX, offsetY);  
1759 - break;  
1760 - case "4004":  
1761 - data = createBoxComponentNewFul3(width, deep, size, offsetX, offsetY);  
1762 - break;  
1763 - case "4005":  
1764 - data = createBoxComponentNewFul4(width, deep, size, offsetX, offsetY);  
1765 - break;  
1766 - case "4006":  
1767 - data = createBoxComponentNewFul5(width, deep, size, offsetX, offsetY);  
1768 - break;  
1769 - case "4007":  
1770 - data = createBoxComponentNewFul6(width, deep, size, offsetX, offsetY);  
1771 - break;  
1772 - case "6001":  
1773 - data = createBoxComponentNewFull(width, deep, size, offsetX, offsetY);  
1774 - break;  
1775 - case "6002":  
1776 - data = createBoxComponentNewFull1(width, size, offsetX, offsetY);  
1777 - break;  
1778 - case "6003":  
1779 - data = createBoxComponentNewFull2(width, size, offsetX, offsetY);  
1780 - break;  
1781 - case "6004":  
1782 - data = createBoxComponentNewFul3(width, deep, size, offsetX, offsetY);  
1783 - break;  
1784 - case "6005":  
1785 - data = createBoxComponentNewFul4(width, deep, size, offsetX, offsetY);  
1786 - break;  
1787 - case "6006":  
1788 - data = createBoxComponentNewFul5(width, deep, size, offsetX, offsetY);  
1789 - break;  
1790 - case "6007":  
1791 - data = createBoxComponentNewFul6(width, deep, size, offsetX, offsetY);  
1792 - break; 1457 +
  1458 + const suffix = trapezoidLeftType?.slice(-2);
  1459 + switch (suffix) {
  1460 + case "01": // 4001,10001,12001,13001,15001,6001
  1461 + return createBoxComponentNewFull(width, deep, size, offsetX, offsetY);
  1462 + case "02": // 4002,10002,11002,12002,13002,15002,6002
  1463 + return createBoxComponentNewFull1(width, size, offsetX, offsetY);
  1464 + case "03": // 4003,6003
  1465 + return createBoxComponentNewFull2(width, size, offsetX, offsetY);
  1466 + case "04": // 4004,6004
  1467 + return createBoxComponentNewFul3(width, deep, size, offsetX, offsetY);
  1468 + case "05": // 4005,6005
  1469 + return createBoxComponentNewFul4(width, deep, size, offsetX, offsetY);
  1470 + case "06": // 4006,6006
  1471 + return createBoxComponentNewFul5(width, deep, size, offsetX, offsetY);
  1472 + case "07": // 4007,6007
  1473 + return createBoxComponentNewFul6(width, deep, size, offsetX, offsetY);
1793 default: 1474 default:
1794 - data = createNoneProject();  
1795 - break; 1475 + return createNoneProject();
1796 } 1476 }
1797 - return data;  
1798 }; 1477 };
1799 return ( 1478 return (
1800 <div 1479 <div