Commit a35249810794afb06b17000db3a29274130fc775

Authored by Min
2 parents f4b743f7 a607193e

Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi

src/components/Common/BoxDesignCompontent/index.js
@@ -187,6 +187,21 @@ const BoxDesignCompontent = baseProps => { @@ -187,6 +187,21 @@ 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 + { name: "首盒长", value: "dSHC" },
  201 + { name: "首盒宽", value: "dSHK" },
  202 + { name: "次盒长", value: "dCHC" },
  203 + { name: "次盒宽", value: "dCHK" },
  204 + ];
190 const newBoxList = []; 205 const newBoxList = [];
191 206
192 // const boxs = titleList.length + tableData.length; 207 // const boxs = titleList.length + tableData.length;
@@ -218,8 +233,10 @@ const BoxDesignCompontent = baseProps => { @@ -218,8 +233,10 @@ const BoxDesignCompontent = baseProps => {
218 }); 233 });
219 }); 234 });
220 // 部件信息 235 // 部件信息
  236 +
  237 + const boxTypes = masterData.sTypes;
221 if (slaveData && slaveData.length) { 238 if (slaveData && slaveData.length) {
222 - if (boxType !== "8") { 239 + if (boxTypes !== "8") {
223 slaveData.forEach((item, index) => { 240 slaveData.forEach((item, index) => {
224 const i = titleList1.findIndex(i => { 241 const i = titleList1.findIndex(i => {
225 return i.value === item.sCode; 242 return i.value === item.sCode;
@@ -236,11 +253,30 @@ const BoxDesignCompontent = baseProps => { @@ -236,11 +253,30 @@ const BoxDesignCompontent = baseProps => {
236 } 253 }
237 }); 254 });
238 } else { 255 } else {
  256 + slaveData.forEach((item, index) => {
  257 + const i = doubleTitlieList1.findIndex(i => {
  258 + return i.value === item.sCode;
  259 + });
  260 + if (i !== -1) {
  261 + const x = newBoxList.findIndex(z => z.sName === doubleTitlieList1[i].name);
  262 + newBoxList[x].value = item.iValue;
  263 + newBoxList[x].type = item.sTypes;
  264 + newBoxList[x].showName = item.sName;
  265 + newBoxList[x].selectImage = item.sMakeUpPath;
  266 + newBoxList[x].sName = doubleTitlieList1[i].name;
  267 + newBoxList[x].sAssignFormula = item.sAssignFormula;
  268 + newBoxList[x].bVisible = item.bVisible;
  269 + }
  270 + });
239 // 双盒盒型单独处理 271 // 双盒盒型单独处理
240 } 272 }
241 } 273 }
242 // 盒身信息 274 // 盒身信息
243 if (masterData) { 275 if (masterData) {
  276 + const headLength = slaveData.find(item => item.sCode === "dSHC")?.iValue
  277 + const headWidth = slaveData.find(item => item.sCode === "dSHK")?.iValue
  278 + const orderLength = slaveData.find(item => item.sCode === "dCHC")?.iValue
  279 + const orderWidth = slaveData.find(item => item.sCode === "dCHK")?.iValue
244 newBoxList.forEach((item, index) => { 280 newBoxList.forEach((item, index) => {
245 if (item.sName === "盒身") { 281 if (item.sName === "盒身") {
246 newBoxList[index].value = masterData.sBoxBody; 282 newBoxList[index].value = masterData.sBoxBody;
@@ -254,7 +290,15 @@ const BoxDesignCompontent = baseProps => { @@ -254,7 +290,15 @@ const BoxDesignCompontent = baseProps => {
254 newBoxList[index].value = masterData.dBoxHeight; 290 newBoxList[index].value = masterData.dBoxHeight;
255 } else if (item.sName === "盒型名称") { 291 } else if (item.sName === "盒型名称") {
256 newBoxList[index].value = masterData.sName; 292 newBoxList[index].value = masterData.sName;
257 - } 293 + } else if (item.sName === "首盒长") {
  294 + newBoxList[index].value = headLength;
  295 + } else if (item.sName === "首盒宽") {
  296 + newBoxList[index].value = headWidth;
  297 + } else if (item.sName === "次盒长") {
  298 + newBoxList[index].value = orderLength;
  299 + } else if (item.sName === "次盒宽") {
  300 + newBoxList[index].value = orderWidth;
  301 + }
258 }); 302 });
259 } 303 }
260 // 有数据的时候 盒型设计需要赋值 304 // 有数据的时候 盒型设计需要赋值
@@ -355,9 +399,9 @@ const BoxDesignCompontent = baseProps => { @@ -355,9 +399,9 @@ const BoxDesignCompontent = baseProps => {
355 sAssignFormula: null, 399 sAssignFormula: null,
356 })); 400 }));
357 setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"])); 401 setDoubleLayerList(createBox(["首盒长", "首盒宽", "次盒长", "次盒宽"]));
358 - setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"]));  
359 - setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"]));  
360 - setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"])); 402 + // setTopDoubleBoxList(createBox(["左上插位组件", "上插位组件", "右上插位组件"]));
  403 + // setLeftDoubleBoxList(createBox(["左偏移", "左插位组件", "左下插位组件"]));
  404 + // setRightDoubleBoxList(createBox(["右偏移", "右插位组件", "右下插位组件"]));
361 } else { 405 } else {
362 } 406 }
363 }, [boxType]); 407 }, [boxType]);
@@ -379,7 +423,6 @@ const BoxDesignCompontent = baseProps => { @@ -379,7 +423,6 @@ const BoxDesignCompontent = baseProps => {
379 }; 423 };
380 424
381 const handleChange = (e, index) => { 425 const handleChange = (e, index) => {
382 - console.log(e.target.value, index, "handleChange");  
383 const updatedBoxList = [...boxList]; 426 const updatedBoxList = [...boxList];
384 updatedBoxList[index].value = e.target.value; 427 updatedBoxList[index].value = e.target.value;
385 setBoxList(updatedBoxList); 428 setBoxList(updatedBoxList);
@@ -450,15 +493,17 @@ const BoxDesignCompontent = baseProps => { @@ -450,15 +493,17 @@ const BoxDesignCompontent = baseProps => {
450 // 判断是新增还是修改 493 // 判断是新增还是修改
451 494
452 // 存储子表数据 495 // 存储子表数据
  496 + const boxTypes = boxList.find(item => item.sName === "盒身")?.type;
  497 + const findList = boxTypes === "8" ? doubleTitlieList1 : titleList1;
453 boxList.forEach((item, index) => { 498 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); 499 + const i = findList.findIndex(i => i.name === item.sName);
  500 + const slave = slaveData.find(z => z.sCode === findList[i]?.value);
456 if (i !== -1) { 501 if (i !== -1) {
457 const data = { 502 const data = {
458 ...slaveData[0], 503 ...slaveData[0],
459 handleType: slave ? "update" : "add", 504 handleType: slave ? "update" : "add",
460 sName: item.showName, 505 sName: item.showName,
461 - sCode: titleList1[i].value, 506 + sCode: findList[i].value,
462 iValue: item.value, 507 iValue: item.value,
463 iOrder: index + 1, 508 iOrder: index + 1,
464 iRowNum: index + 1, 509 iRowNum: index + 1,
@@ -488,213 +533,17 @@ const BoxDesignCompontent = baseProps => { @@ -488,213 +533,17 @@ const BoxDesignCompontent = baseProps => {
488 let sLengthFormula = ""; 533 let sLengthFormula = "";
489 let sWidthFormula = ""; 534 let sWidthFormula = "";
490 const boxType = boxList.find(item => item.sName === "盒身")?.type; 535 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 - // 天地盒 536 + if (boxType === "8") {
  537 +
  538 + } else {
  539 + const boxLength = Number(boxList.find(item => item.sName === "盒长")?.value);
  540 + const boxWidth = Number(boxList.find(item => item.sName === "盒宽")?.value);
  541 + const boxHeight = Number(boxList.find(item => item.sName === "盒高")?.value);
694 const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); 542 const zxcw = boxList.find(x => x.sName === "左(下)插位组件");
695 const zscw = boxList.find(x => x.sName === "左(上)插位组件"); 543 const zscw = boxList.find(x => x.sName === "左(上)插位组件");
696 const yscw = boxList.find(x => x.sName === "右(上)插位组件"); 544 const yscw = boxList.find(x => x.sName === "右(上)插位组件");
697 const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); 545 const yxcw = boxList.find(x => x.sName === "右(下)插位组件");
  546 + const hdzj = boxList.find(x => x.sName === "盒底组件");
698 const zxcwType = zxcw?.type; 547 const zxcwType = zxcw?.type;
699 const zxcwValue = zxcw?.value; 548 const zxcwValue = zxcw?.value;
700 const zscwType = zscw?.type; 549 const zscwType = zscw?.type;
@@ -703,111 +552,312 @@ const BoxDesignCompontent = baseProps => { @@ -703,111 +552,312 @@ const BoxDesignCompontent = baseProps => {
703 const yscwValue = yscw?.value; 552 const yscwValue = yscw?.value;
704 const yxcwType = yxcw?.type; 553 const yxcwType = yxcw?.type;
705 const yxcwValue = yxcw?.value; 554 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"; 555 + let leftTopValue = 0;
  556 + let leftTop = "";
  557 + let rightTopValue = 0;
  558 + let rightTop = "";
  559 + let leftBottomValue = 0;
  560 + let leftBottom = "";
  561 + let rightBottomValue = 0;
  562 + let rightBottom = "";
  563 + if (boxType && boxType === "1") {
  564 + // 四面盒
  565 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  566 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  567 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : "");
  568 +
  569 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  570 + leftBottomValue = Number(zxcwValue) + boxHeight;
  571 + leftBottom = " + dZXCW + W";
  572 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  573 + leftBottomValue = Number(zxcwValue);
  574 + leftBottom = " + dZXCW";
  575 + } else if (zxcwType === "4004") {
  576 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  577 + leftBottom = " + dZXCW + W * 2";
  578 + } else if (zxcwType === "4005") {
  579 + leftBottomValue = boxHeight * 2;
  580 + leftBottom = "+ W * 2";
  581 + }
  582 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  583 + rightTopValue = Number(yscwValue) + boxHeight;
  584 + rightTop = "dYSCW + W + ";
  585 + } else if (yscwType === "6002" || yscwType === "6003") {
  586 + rightTopValue = Number(yscwValue);
  587 + rightTop = "dYSCW + ";
  588 + } else if (yscwType === "6004") {
  589 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  590 + rightTop = "dYSCW + W * 2+ ";
  591 + } else if (yscwType === "6005") {
  592 + rightTopValue = boxHeight * 2;
  593 + rightTop = "W * 2+ ";
  594 + }
  595 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  596 + leftTopValue = Number(zscwValue) + boxHeight;
  597 + leftTop = "dZSCW + W +";
  598 + } else if (zscwType === "3002" || zscwType === "3003") {
  599 + leftTopValue = Number(zscwValue);
  600 + leftTop = "dZSCW +";
  601 + } else if (zscwType === "3004") {
  602 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  603 + leftTop = "dZSCW + W * 2 +";
  604 + } else if (zscwType === "3005") {
  605 + leftTopValue = boxHeight * 2;
  606 + leftTop = "W * 2 +";
  607 + }
  608 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  609 + rightBottomValue = Number(yxcwValue) + boxHeight;
  610 + rightBottom = "+ dYXCW + W";
  611 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  612 + rightBottomValue = Number(yxcwValue);
  613 + rightBottom = "+ dYXCW ";
  614 + } else if (yxcwType === "7004") {
  615 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  616 + rightBottom = "+ dYXCW + W * 2";
  617 + } else if (yxcwType === "7005") {
  618 + rightBottomValue = boxHeight * 2;
  619 + rightBottom = "+ W * 2";
  620 + }
  621 + sWidthFormula =
  622 + (leftTopValue > rightTopValue ? leftTop : rightTop) +
  623 + "D" +
  624 + (hdzj ? " + dHDC" : leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  625 + } else if (boxType && boxType === "2") {
  626 + // 单折
  627 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  628 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  629 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : "");
  630 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  631 + leftBottomValue = Number(zxcwValue) + boxHeight;
  632 + leftBottom = " + dZXCW + W";
  633 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  634 + leftBottomValue = Number(zxcwValue);
  635 + leftBottom = " + dZXCW";
  636 + } else if (zxcwType === "4004") {
  637 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  638 + leftBottom = " + dZXCW + W * 2";
  639 + } else if (zxcwType === "4005") {
  640 + leftBottomValue = boxHeight * 2;
  641 + leftBottom = "+ W * 2";
  642 + }
  643 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  644 + rightTopValue = Number(yscwValue) + boxHeight;
  645 + rightTop = "dYSCW + W + ";
  646 + } else if (yscwType === "6002" || yscwType === "6003") {
  647 + rightTopValue = Number(yscwValue);
  648 + rightTop = "dYSCW + ";
  649 + } else if (yscwType === "6004") {
  650 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  651 + rightTop = "dYSCW + W * 2+ ";
  652 + } else if (yscwType === "6005") {
  653 + rightTopValue = boxHeight * 2;
  654 + rightTop = "W * 2+ ";
  655 + }
  656 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  657 + leftTopValue = Number(zscwValue) + boxHeight;
  658 + leftTop = "dZSCW + W +";
  659 + } else if (zscwType === "3002" || zscwType === "3003") {
  660 + leftTopValue = Number(zscwValue);
  661 + leftTop = "dZSCW +";
  662 + } else if (zscwType === "3004") {
  663 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  664 + leftTop = "dZSCW + W * 2 +";
  665 + } else if (zscwType === "3005") {
  666 + leftTopValue = boxHeight * 2;
  667 + leftTop = "W * 2 +";
  668 + }
  669 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  670 + rightBottomValue = Number(yxcwValue) + boxHeight;
  671 + rightBottom = "+ dYXCW + W";
  672 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  673 + rightBottomValue = Number(yxcwValue);
  674 + rightBottom = "+ dYXCW ";
  675 + } else if (yxcwType === "7004") {
  676 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  677 + rightBottom = "+ dYXCW + W * 2";
  678 + } else if (yxcwType === "7005") {
  679 + rightBottomValue = boxHeight * 2;
  680 + rightBottom = "+ W * 2";
  681 + }
  682 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  683 + } else if (boxType && boxType === "3") {
  684 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  685 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  686 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : "");
  687 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  688 + leftBottomValue = Number(zxcwValue) + boxHeight;
  689 + leftBottom = " + dZXCW + W";
  690 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  691 + leftBottomValue = Number(zxcwValue);
  692 + leftBottom = " + dZXCW";
  693 + } else if (zxcwType === "4004") {
  694 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  695 + leftBottom = " + dZXCW + W * 2";
  696 + } else if (zxcwType === "4005") {
  697 + leftBottomValue = boxHeight * 2;
  698 + leftBottom = "+ W * 2";
  699 + }
  700 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  701 + rightTopValue = Number(yscwValue) + boxHeight;
  702 + rightTop = "dYSCW + W + ";
  703 + } else if (yscwType === "6002" || yscwType === "6003") {
  704 + rightTopValue = Number(yscwValue);
  705 + rightTop = "dYSCW + ";
  706 + } else if (yscwType === "6004") {
  707 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  708 + rightTop = "dYSCW + W * 2+ ";
  709 + } else if (yscwType === "6005") {
  710 + rightTopValue = boxHeight * 2;
  711 + rightTop = "W * 2+ ";
  712 + }
  713 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  714 + leftTopValue = Number(zscwValue) + boxHeight;
  715 + leftTop = "dZSCW + W +";
  716 + } else if (zscwType === "3002" || zscwType === "3003") {
  717 + leftTopValue = Number(zscwValue);
  718 + leftTop = "dZSCW +";
  719 + } else if (zscwType === "3004") {
  720 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  721 + leftTop = "dZSCW + W * 2 +";
  722 + } else if (zscwType === "3005") {
  723 + leftTopValue = boxHeight * 2;
  724 + leftTop = "W * 2 +";
  725 + }
  726 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  727 + rightBottomValue = Number(yxcwValue) + boxHeight;
  728 + rightBottom = "+ dYXCW + W";
  729 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  730 + rightBottomValue = Number(yxcwValue);
  731 + rightBottom = "+ dYXCW ";
  732 + } else if (yxcwType === "7004") {
  733 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  734 + rightBottom = "+ dYXCW + W * 2";
  735 + } else if (yxcwType === "7005") {
  736 + rightBottomValue = boxHeight * 2;
  737 + rightBottom = "+ W * 2";
  738 + }
  739 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
  740 + } else if (boxType && boxType === "4") {
  741 + // 天地盒
  742 + const zxcw = boxList.find(x => x.sName === "左(下)插位组件");
  743 + const zscw = boxList.find(x => x.sName === "左(上)插位组件");
  744 + const yscw = boxList.find(x => x.sName === "右(上)插位组件");
  745 + const yxcw = boxList.find(x => x.sName === "右(下)插位组件");
  746 + const zxcwType = zxcw?.type;
  747 + const zxcwValue = zxcw?.value;
  748 + const zscwType = zscw?.type;
  749 + const zscwValue = zscw?.value;
  750 + const yscwType = yscw?.type;
  751 + const yscwValue = yscw?.value;
  752 + const yxcwType = yxcw?.type;
  753 + const yxcwValue = yxcw?.value;
  754 + let leftValue = "";
  755 + let rightValue = "";
  756 + let topValue = "";
  757 + let bottomValue = "";
  758 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  759 + // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2;
  760 + leftValue = "dZXCW + D * 2 +";
  761 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  762 + leftValue = "dZXCW + D +";
  763 + } else if (zxcwType === "4004") {
  764 + leftValue = "dZXCW + D * 3 +";
  765 + } else if (zxcwType === "4005") {
  766 + leftValue = "D * 3 +";
  767 + }
  768 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  769 + rightValue = "+ dYSCW + D * 2";
  770 + } else if (yscwType === "6002" || yscwType === "6003") {
  771 + rightValue = "+ dYSCW + D";
  772 + } else if (yscwType === "6004") {
  773 + rightValue = "+ dYSCW + D * 3";
  774 + } else if (yscwType === "6005") {
  775 + rightValue = " + D * 3";
  776 + }
  777 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  778 + topValue = "dZSCW + D * 2 +";
  779 + } else if (zscwType === "3002" || zscwType === "3003") {
  780 + topValue = "dZSCW + D +";
  781 + } else if (zscwType === "3004") {
  782 + topValue = "dZSCW + D * 3 +";
  783 + } else if (zscwType === "3005") {
  784 + topValue = "D * 3+";
  785 + }
  786 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  787 + bottomValue = "+ dYXCW + D * 2";
  788 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  789 + bottomValue = "+ dYXCW + D ";
  790 + } else if (yxcwType === "7004") {
  791 + bottomValue = "+ dYXCW + D * 3";
  792 + } else if (yxcwType === "7005") {
  793 + bottomValue = "+ D * 3";
  794 + }
  795 + // viewBoxWidth = Number(boxLength) + leftValue + rightValue;
  796 + // viewBoxHeight = Number(boxWidth) + topValue + bottomValue;
  797 + sLengthFormula = leftValue + "L" + rightValue;
  798 + sWidthFormula = topValue + "W" + bottomValue;
  799 + } else if (boxType && boxType === "5") {
  800 + // 飞机盒
  801 + const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value;
  802 + const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value;
  803 + sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : "");
  804 + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") {
  805 + leftBottomValue = Number(zxcwValue) + boxHeight;
  806 + leftBottom = " + dZXCW + D";
  807 + } else if (zxcwType === "4002" || zxcwType === "4003") {
  808 + leftBottomValue = Number(zxcwValue);
  809 + leftBottom = " + dZXCW";
  810 + } else if (zxcwType === "4004") {
  811 + leftBottomValue = Number(zxcwValue) + boxHeight * 2;
  812 + leftBottom = " + dZXCW + D * 2";
  813 + } else if (zxcwType === "4005") {
  814 + leftBottomValue = boxHeight * 2;
  815 + leftBottom = "+ D * 2";
  816 + }
  817 + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
  818 + rightTopValue = Number(yscwValue) + boxHeight;
  819 + rightTop = "dYSCW + D + ";
  820 + } else if (yscwType === "6002" || yscwType === "6003") {
  821 + rightTopValue = Number(yscwValue);
  822 + rightTop = "dYSCW + ";
  823 + } else if (yscwType === "6004") {
  824 + rightTopValue = Number(yscwValue) + boxHeight * 2;
  825 + rightTop = "dYSCW + D * 2+ ";
  826 + } else if (yscwType === "6005") {
  827 + rightTopValue = boxHeight * 2;
  828 + rightTop = "D * 2+ ";
  829 + }
  830 + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
  831 + leftTopValue = Number(zscwValue) + boxHeight;
  832 + leftTop = "dZSCW + D +";
  833 + } else if (zscwType === "3002" || zscwType === "3003") {
  834 + leftTopValue = Number(zscwValue);
  835 + leftTop = "dZSCW +";
  836 + } else if (zscwType === "3004") {
  837 + leftTopValue = Number(zscwValue) + boxHeight * 2;
  838 + leftTop = "dZSCW + D * 2 +";
  839 + } else if (zscwType === "3005") {
  840 + leftTopValue = boxHeight * 2;
  841 + leftTop = "D * 2 +";
  842 + }
  843 + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
  844 + rightBottomValue = Number(yxcwValue) + boxHeight;
  845 + rightBottom = "+ dYXCW + D";
  846 + } else if (yxcwType === "7002" || yxcwType === "7003") {
  847 + rightBottomValue = Number(yxcwValue);
  848 + rightBottom = "+ dYXCW ";
  849 + } else if (yxcwType === "7004") {
  850 + rightBottomValue = Number(yxcwValue) + boxHeight * 2;
  851 + rightBottom = "+ dYXCW + D * 2";
  852 + } else if (yxcwType === "7005") {
  853 + rightBottomValue = boxHeight * 2;
  854 + rightBottom = "+ D * 2";
  855 + }
  856 + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);
807 } 857 }
808 - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "L" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom);  
809 } 858 }
810 859
  860 + // const sDoubleSize = JSON.stringify([headLength,headWidth,orderLength,orderWidth])
811 // 存储盒身数据 主表 861 // 存储盒身数据 主表
812 const newMasterData = { 862 const newMasterData = {
813 ...masterData, 863 ...masterData,
@@ -902,13 +952,13 @@ const BoxDesignCompontent = baseProps => { @@ -902,13 +952,13 @@ const BoxDesignCompontent = baseProps => {
902 </div> 952 </div>
903 ))} 953 ))}
904 {boxType === "8" && 954 {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 ? ( 955 + topDoubleBoxList.map((item, index) => (
  956 + <div key={index} className={styles.boxFlex} style={{ display: item.show ? "block" : "none" }}>
  957 + <div className={styles.boxTitle}>{doubleTitlieList[index]}</div>
  958 + {item?.selectImage ? (
909 <img 959 <img
910 - src={topItem?.selectImage}  
911 - alt={topItem.value} 960 + src={item?.selectImage}
  961 + alt={item.value}
912 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }} 962 style={{ width: 40, height: 30, marginRight: 8, position: "absolute", left: 20, top: 24, zIndex: 10 }}
913 /> 963 />
914 ) : ( 964 ) : (
@@ -920,31 +970,30 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -920,31 +970,30 @@ const BoxDesignCompontent = baseProps =&gt; {
920 className="mySelects" 970 className="mySelects"
921 style={{ width: 180 }} 971 style={{ width: 180 }}
922 defaultValue={options.length ? options[0].value : ""} 972 defaultValue={options.length ? options[0].value : ""}
923 - onSelect={(value, option) => handleSelect(value, option, index, 0)} 973 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
924 onDropdownVisibleChange={async open => { 974 onDropdownVisibleChange={async open => {
925 if (open) { 975 if (open) {
926 - props.getSqlOptions(4); // 在下拉菜单打开时调用 getSqlOptions 976 + props.getSqlOptions(index + 11); // 在下拉菜单打开时调用 getSqlOptions
927 } 977 }
928 }} 978 }}
929 > 979 >
930 {!loading ? options.map(option => renderOptionWithImage(option)) : ""} 980 {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
931 </Select> 981 </Select>
932 <div className={styles.boxInput}> 982 <div className={styles.boxInput}>
933 - {/* <div className={styles.text}>参数:</div> */}  
934 <Input 983 <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} 984 + value={item?.showName}
  985 + onChange={e => handleChangeName(e, findIndexBySname(item.sName))}
  986 + onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
  987 + onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
  988 + readOnly={!item?.isEditable}
940 className={styles.text} 989 className={styles.text}
941 /> 990 />
942 <Input 991 <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} 992 + value={item?.value}
  993 + onChange={e => handleChange(e, findIndexBySname(item.sName))}
  994 + onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
  995 + onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
  996 + readOnly={!item?.isEditable}
948 style={{ width: " 80%" }} 997 style={{ width: " 80%" }}
949 /> 998 />
950 </div> 999 </div>
@@ -1013,20 +1062,24 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1013,20 +1062,24 @@ const BoxDesignCompontent = baseProps =&gt; {
1013 <div key={index + 3} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}> 1062 <div key={index + 3} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}>
1014 <div className={styles.boxTitle}>{doubleTitlieList[index + 3]}</div> 1063 <div className={styles.boxTitle}>{doubleTitlieList[index + 3]}</div>
1015 1064
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> 1065 + {index !== 0 ? (
  1066 + <Select
  1067 + optionLabelProp="label"
  1068 + className="mySelects"
  1069 + style={{ width: 180 }}
  1070 + defaultValue={options.length ? options[0].value : ""}
  1071 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
  1072 + onDropdownVisibleChange={async open => {
  1073 + if (open) {
  1074 + props.getSqlOptions(index + 13); // 在下拉菜单打开时调用 getSqlOptions
  1075 + }
  1076 + }}
  1077 + >
  1078 + {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
  1079 + </Select>
  1080 + ) : (
  1081 + ""
  1082 + )}
1030 <div className={styles.boxInput}> 1083 <div className={styles.boxInput}>
1031 {item?.selectImage ? ( 1084 {item?.selectImage ? (
1032 <img 1085 <img
@@ -1128,20 +1181,24 @@ const BoxDesignCompontent = baseProps =&gt; { @@ -1128,20 +1181,24 @@ const BoxDesignCompontent = baseProps =&gt; {
1128 <div key={index + 6} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}> 1181 <div key={index + 6} className={styles.boxFlex} style={{ display: item?.show ? "block" : "none" }}>
1129 <div className={styles.boxTitle}>{doubleTitlieList[index + 6]}</div> 1182 <div className={styles.boxTitle}>{doubleTitlieList[index + 6]}</div>
1130 1183
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> 1184 + {index !== 0 ? (
  1185 + <Select
  1186 + optionLabelProp="label"
  1187 + className="mySelects"
  1188 + style={{ width: 180 }}
  1189 + defaultValue={options.length ? options[0].value : ""}
  1190 + onSelect={(value, option) => handleSelect(value, option, findIndexBySname(item.sName), 0)}
  1191 + onDropdownVisibleChange={async open => {
  1192 + if (open) {
  1193 + props.getSqlOptions(index + 15); // 在下拉菜单打开时调用 getSqlOptions
  1194 + }
  1195 + }}
  1196 + >
  1197 + {!loading ? options.map(option => renderOptionWithImage(option)) : ""}
  1198 + </Select>
  1199 + ) : (
  1200 + ""
  1201 + )}
1145 <div className={styles.boxInput}> 1202 <div className={styles.boxInput}>
1146 {item?.selectImage ? ( 1203 {item?.selectImage ? (
1147 <img 1204 <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 === "左贴边位");
@@ -129,9 +127,15 @@ const SvgBox = props =&gt; { @@ -129,9 +127,15 @@ const SvgBox = props =&gt; {
129 // 展宽 127 // 展宽
130 if (boxList && boxList.length) { 128 if (boxList && boxList.length) {
131 // 如果存在部件和盒舌 取最大的 129 // 如果存在部件和盒舌 取最大的
  130 +
132 const top = topOffect(boxList, boxLength, boxWidth, boxHeight); 131 const top = topOffect(boxList, boxLength, boxWidth, boxHeight);
133 const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); 132 const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight);
134 max = Number(top) + Number(bottom); 133 max = Number(top) + Number(bottom);
  134 + if (Number(svgType) === 8) {
  135 + const top = topOffect(boxList, headLength, headWidth);
  136 + const bottom = bottomOffect(boxList, orderLength, orderWidth);
  137 + max = Number(top) + Number(bottom);
  138 + }
135 } 139 }
136 140
137 let viewBoxHeight = Number(boxHeight) + max; 141 let viewBoxHeight = Number(boxHeight) + max;
@@ -264,10 +268,40 @@ const SvgBox = props =&gt; { @@ -264,10 +268,40 @@ const SvgBox = props =&gt; {
264 // viewBoxWidth = boxWidth + leftValue + rightValue; 268 // viewBoxWidth = boxWidth + leftValue + rightValue;
265 // viewBoxHeight = boxLength + dZSCW + dYXCW; 269 // viewBoxHeight = boxLength + dZSCW + dYXCW;
266 } else if (Number(svgType) === 8) { 270 } else if (Number(svgType) === 8) {
267 -  
268 - viewBoxWidth = Number(headLength);  
269 - viewBoxHeight = Number(headWidth) + Number(orderWidth); 271 + const getTop = (item, offset = 0) => {
  272 + const map = {
  273 + 10001: headWidth + Number(item?.value),
  274 + 10002: Number(item?.value),
  275 + 10003: Number(item?.value),
  276 + 10004: Number(item?.value) + headWidth * 2,
  277 + 10005: headWidth * 2,
  278 + 10006: Number(item?.value) + headWidth,
  279 + 10007: Number(item?.value) + headWidth,
  280 + };
  281 + return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
  282 + };
  283 +
  284 + const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
  285 + const topRight = getTop(
  286 + boxList.find(x => x.sName === "右上插位组件"),
  287 + 2000
  288 + );
  289 + const topLength = headLength + topLeft + topRight;
  290 + const bottomLeft = getTop(
  291 + boxList.find(x => x.sName === "左插位组件"),
  292 + 3000
  293 + );
  294 + const bottomRight = getTop(
  295 + boxList.find(x => x.sName === "右插位组件"),
  296 + 5000
  297 + );
  298 + const bottomLength = orderLength * 2 + bottomLeft + bottomRight;
  299 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  300 + const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0;
  301 + viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect);
  302 + viewBoxHeight = Number(headWidth) + Number(orderWidth) + max;
270 } 303 }
  304 +
271 // 计算缩放比例 305 // 计算缩放比例
272 let scale = 1; 306 let scale = 1;
273 if (props.showNew === 0) { 307 if (props.showNew === 0) {
@@ -278,14 +312,44 @@ const SvgBox = props =&gt; { @@ -278,14 +312,44 @@ const SvgBox = props =&gt; {
278 let ySvg = dSvgBoxHeight 312 let ySvg = dSvgBoxHeight
279 ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale 313 ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale
280 : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; 314 : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
281 - const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); 315 + let bottom = 0;
  316 + if (Number(svgType) !== 8) {
  317 + bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight);
  318 + } else {
  319 + bottom = bottomOffect(boxList, orderLength, orderWidth);
  320 + }
282 if (Number(svgType) === 4) { 321 if (Number(svgType) === 4) {
283 ySvg = ySvg + boxHeight * scale; 322 ySvg = ySvg + boxHeight * scale;
  323 + } else if (Number(svgType) === 8) {
  324 + ySvg = topOffect(boxList, headLength, headWidth) * scale;
284 } 325 }
285 ySvg = ySvg + 50 * scale; 326 ySvg = ySvg + 50 * scale;
286 let xSvg = 0; 327 let xSvg = 0;
287 - if (Number(svgType === 7)) { 328 + if (Number(svgType) === 7) {
288 xSvg = scaledWidth + dZXCW * scale; 329 xSvg = scaledWidth + dZXCW * scale;
  330 + } else if (Number(svgType) === 8) {
  331 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  332 + // 计算首盒部件与次盒部件尺寸
  333 + const getTop = (item, offset = 0) => {
  334 + const map = {
  335 + 10001: headWidth + Number(item?.value),
  336 + 10002: Number(item?.value),
  337 + 10003: Number(item?.value),
  338 + 10004: Number(item?.value) + headWidth * 2,
  339 + 10005: headWidth * 2,
  340 + 10006: Number(item?.value) + headWidth,
  341 + 10007: Number(item?.value) + headWidth,
  342 + };
  343 + return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
  344 + };
  345 + const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
  346 + const topLength = headLength + topLeft;
  347 + const bottomLeft = getTop(
  348 + boxList.find(x => x.sName === "左插位组件"),
  349 + 3000
  350 + );
  351 + const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
  352 + xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength));
289 } else { 353 } else {
290 xSvg = zbtb?.value; 354 xSvg = zbtb?.value;
291 } 355 }
@@ -304,16 +368,39 @@ const SvgBox = props =&gt; { @@ -304,16 +368,39 @@ const SvgBox = props =&gt; {
304 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; 368 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
305 if (Number(svgType) === 4) { 369 if (Number(svgType) === 4) {
306 ySvg = ySvg + boxHeight; 370 ySvg = ySvg + boxHeight;
  371 + } else if (Number(svgType) === 8) {
  372 + ySvg = topOffect(boxList, headLength, headWidth) * scale;
307 } 373 }
308 ySvg = ySvg + 50 * scale; 374 ySvg = ySvg + 50 * scale;
309 let xSvg = 0; 375 let xSvg = 0;
310 - if (Number(svgType === 7)) { 376 + if (Number(svgType) === 7) {
311 xSvg = scaledWidth + dZXCW * scale; 377 xSvg = scaledWidth + dZXCW * scale;
  378 + } else if (Number(svgType) === 8) {
  379 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  380 + // 计算首盒部件与次盒部件尺寸
  381 + const getTop = (item, offset = 0) => {
  382 + const map = {
  383 + 10001: headWidth + Number(item?.value),
  384 + 10002: Number(item?.value),
  385 + 10003: Number(item?.value),
  386 + 10004: Number(item?.value) + headWidth * 2,
  387 + 10005: headWidth * 2,
  388 + 10006: Number(item?.value) + headWidth,
  389 + 10007: Number(item?.value) + headWidth,
  390 + };
  391 + return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
  392 + };
  393 + const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
  394 + const topLength = headLength + topLeft;
  395 + const bottomLeft = getTop(
  396 + boxList.find(x => x.sName === "左插位组件"),
  397 + 3000
  398 + );
  399 + const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
  400 + xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength));
312 } else { 401 } else {
313 xSvg = zbtb?.value; 402 xSvg = zbtb?.value;
314 } 403 }
315 - console.log(xSvg, viewBoxWidth / 2, viewBoxWidth, "viewBoxWidth / 2");  
316 -  
317 svg.setAttribute( 404 svg.setAttribute(
318 "viewBox", 405 "viewBox",
319 `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ 406 `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${
@@ -357,9 +444,34 @@ const SvgBox = props =&gt; { @@ -357,9 +444,34 @@ const SvgBox = props =&gt; {
357 ySvg = topSize; 444 ySvg = topSize;
358 } else if (Number(svgType) === 6) { 445 } else if (Number(svgType) === 6) {
359 leftSize = 0; 446 leftSize = 0;
  447 + } else if (Number(svgType) === 8) {
  448 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  449 + // 计算首盒部件与次盒部件尺寸
  450 + const getTop = (item, offset = 0) => {
  451 + const map = {
  452 + 10001: headWidth + Number(item?.value),
  453 + 10002: Number(item?.value),
  454 + 10003: Number(item?.value),
  455 + 10004: Number(item?.value) + headWidth * 2,
  456 + 10005: headWidth * 2,
  457 + 10006: Number(item?.value) + headWidth,
  458 + 10007: Number(item?.value) + headWidth,
  459 + };
  460 + return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
  461 + };
  462 + const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
  463 + const topLength = topLeft;
  464 + const bottomLeft = getTop(
  465 + boxList.find(x => x.sName === "左插位组件"),
  466 + 3000
  467 + );
  468 + const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
  469 + leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength));
  470 + ySvg = topOffect(boxList, headLength, headWidth);
360 } else { 471 } else {
361 leftSize = zbtb?.value; 472 leftSize = zbtb?.value;
362 } 473 }
  474 +
363 svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`); 475 svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`);
364 svg.setAttribute("width", `${viewBoxWidth}px`); 476 svg.setAttribute("width", `${viewBoxWidth}px`);
365 svg.setAttribute("height", `${viewBoxHeight}px`); 477 svg.setAttribute("height", `${viewBoxHeight}px`);
@@ -408,6 +520,30 @@ const SvgBox = props =&gt; { @@ -408,6 +520,30 @@ const SvgBox = props =&gt; {
408 ySvg = topSize; 520 ySvg = topSize;
409 } else if (Number(svgType) === 6) { 521 } else if (Number(svgType) === 6) {
410 leftSize = 0; 522 leftSize = 0;
  523 + } else if (Number(svgType) === 8) {
  524 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  525 + // 计算首盒部件与次盒部件尺寸
  526 + const getTop = (item, offset = 0) => {
  527 + const map = {
  528 + 10001: headWidth + Number(item?.value),
  529 + 10002: Number(item?.value),
  530 + 10003: Number(item?.value),
  531 + 10004: Number(item?.value) + headWidth * 2,
  532 + 10005: headWidth * 2,
  533 + 10006: Number(item?.value) + headWidth,
  534 + 10007: Number(item?.value) + headWidth,
  535 + };
  536 + return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
  537 + };
  538 + const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
  539 + const topLength = topLeft;
  540 + const bottomLeft = getTop(
  541 + boxList.find(x => x.sName === "左插位组件"),
  542 + 3000
  543 + );
  544 + const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
  545 + leftSize = Math.max(Math.abs(bottomLength), Math.abs(topLength));
  546 + ySvg = topOffect(boxList, headLength, headWidth);
411 } else { 547 } else {
412 leftSize = zbtb?.value; 548 leftSize = zbtb?.value;
413 } 549 }
@@ -1164,32 +1300,7 @@ const SvgBox = props =&gt; { @@ -1164,32 +1300,7 @@ const SvgBox = props =&gt; {
1164 } 1300 }
1165 // 右下部件 1301 // 右下部件
1166 pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); 1302 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 - // } 1303 +
1193 // 右边 1304 // 右边
1194 pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); 1305 pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0));
1195 pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); 1306 pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0));
@@ -1199,18 +1310,20 @@ const SvgBox = props =&gt; { @@ -1199,18 +1310,20 @@ const SvgBox = props =&gt; {
1199 }); 1310 });
1200 svg.appendChild(g); 1311 svg.appendChild(g);
1201 } else if (Number(svgType) === 8) { 1312 } 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 1313 + const scaleHeadLength = headLength * scale;
  1314 + const scaleHeadWidth = headWidth * scale;
  1315 + const scaleOrderLength = orderLength * scale;
  1316 + const scaleOrderWidth = orderWidth * scale;
1206 // 获取他的偏移距离 1317 // 获取他的偏移距离
1207 - const leftOffect = boxList.find(x=>x.sName === "左偏移")?.value || 0  
1208 - const rightOffect = boxList.find(x=>x.sName === "右偏移")?.value || 0 1318 + const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
  1319 + const rightOffect = boxList.find(x => x.sName === "右偏移")?.value || 0;
1209 const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }]; 1320 const rectangles = [{ x: 0, y: 0, width: scaleHeadLength, height: scaleHeadWidth }];
1210 rectangles.forEach(rect => { 1321 rectangles.forEach(rect => {
1211 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1322 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1212 }); 1323 });
1213 - const rectanglesLeft = [{ x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth }]; 1324 + const rectanglesLeft = [
  1325 + { x: scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect), y: scaleHeadWidth, width: scaleOrderLength, height: scaleOrderWidth },
  1326 + ];
1214 rectanglesLeft.forEach(rect => { 1327 rectanglesLeft.forEach(rect => {
1215 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1328 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1216 }); 1329 });
@@ -1218,583 +1331,309 @@ const SvgBox = props =&gt; { @@ -1218,583 +1331,309 @@ const SvgBox = props =&gt; {
1218 rectanglesRight.forEach(rect => { 1331 rectanglesRight.forEach(rect => {
1219 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); 1332 g.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height));
1220 }); 1333 });
  1334 + // 处理双盒的插位组件
  1335 + let pathList = [];
  1336 + // 获取左上
  1337 + const scw = boxList.find(x => x.sName === "上插位组件");
  1338 + const zscw = boxList.find(x => x.sName === "左上插位组件");
  1339 + const yscw = boxList.find(x => x.sName === "右上插位组件");
  1340 + const zcw = boxList.find(x => x.sName === "左插位组件");
  1341 + const ycw = boxList.find(x => x.sName === "右插位组件");
  1342 + const zxcw = boxList.find(x => x.sName === "左下插位组件");
  1343 + const yxcw = boxList.find(x => x.sName === "右下插位组件");
  1344 + const dSCW = scw?.value;
  1345 + const dZSCW = zscw?.value;
  1346 + const dYSCW = yscw?.value;
  1347 + const dZCW = zcw?.value;
  1348 + const dYCW = ycw?.value;
  1349 + const dZXCW = zxcw?.value;
  1350 + const dYXCW = yxcw?.value;
  1351 + // 上插位
  1352 + pathList.push(createDynamicTopLeft(scw?.type, scaleHeadLength, -scaleHeadWidth, -dSCW * scale, 0, 0));
  1353 + // 左上插位
  1354 + pathList.push(createFull(zscw?.type, scaleHeadWidth, -scaleHeadWidth, -dZSCW * scale, 0, 0));
  1355 + // 左插位
  1356 + pathList.push(
  1357 + createFull(
  1358 + zcw?.type,
  1359 + scaleOrderWidth,
  1360 + -scaleOrderWidth,
  1361 + -dZCW * scale,
  1362 + scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect),
  1363 + scaleHeadWidth
  1364 + )
  1365 + );
  1366 + // 左下
  1367 + pathList.push(
  1368 + createDynamicTopLeft(
  1369 + zxcw?.type,
  1370 + scaleOrderLength,
  1371 + scaleOrderWidth,
  1372 + dZXCW * scale,
  1373 + scaleHeadLength / 2 - scaleOrderLength - Number(leftOffect),
  1374 + scaleHeadWidth + scaleOrderWidth
  1375 + )
  1376 + );
  1377 + // 右上
  1378 + pathList.push(createFull(yscw?.type, scaleHeadWidth, scaleHeadWidth, dYSCW * scale, scaleHeadLength, 0));
  1379 + // 右插位
  1380 + pathList.push(
  1381 + createFull(
  1382 + ycw?.type,
  1383 + scaleOrderWidth,
  1384 + scaleOrderWidth,
  1385 + dYCW * scale,
  1386 + scaleHeadLength / 2 + Number(rightOffect) + scaleOrderLength,
  1387 + scaleHeadWidth
  1388 + )
  1389 + );
  1390 + // 右下
  1391 + pathList.push(
  1392 + createDynamicTopLeft(
  1393 + yxcw?.type,
  1394 + scaleOrderLength,
  1395 + scaleOrderWidth,
  1396 + dYXCW * scale,
  1397 + scaleHeadLength / 2 + Number(rightOffect),
  1398 + scaleHeadWidth + scaleOrderWidth
  1399 + )
  1400 + );
  1401 +
  1402 + pathList.forEach(x => {
  1403 + g.appendChild(x);
  1404 + });
1221 svg.appendChild(g); 1405 svg.appendChild(g);
1222 } 1406 }
1223 }; 1407 };
1224 // 计算头部偏移 1408 // 计算头部偏移
1225 const topOffect = (list, length, width, height) => { 1409 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; 1410 + const val = list.filter(x => x.type);
  1411 + const sfhs = val.find(x => x.sName === "上方盒舌");
  1412 + const zscw = val.find(x => x.sName === "左(上)插位组件");
  1413 + const yscw = val.find(x => x.sName === "右(上)插位组件");
  1414 + const box = val.find(x => x.sName === "盒身");
  1415 + const svg = Number(box?.type);
  1416 + if (svg === 6) return 0;
  1417 +
  1418 + const dZ = Number(zscw?.value) || 0;
  1419 + const dY = Number(yscw?.value) || 0;
  1420 +
  1421 + if (svg === 8) {
  1422 + const scw = val.find(x => x.sName === "上插位组件");
  1423 + const topsMap = {
  1424 + 11001: width + Number(scw?.value),
  1425 + 11002: Number(scw?.value),
  1426 + 11003: Number(scw?.value),
  1427 + 11004: Number(scw?.value) + width * 2,
  1428 + 11005: width * 2,
  1429 + 11006: Number(scw?.value) + width,
  1430 + 11007: Number(scw?.value) + width,
  1431 + };
  1432 + return topsMap[scw?.type] ?? 0;
  1433 + }
1234 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; 1434 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
1235 const four = ["6004", "3004", "4004", "7004"]; 1435 const four = ["6004", "3004", "4004", "7004"];
1236 const five = ["6005", "3005", "4005", "7005"]; 1436 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 1437
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; 1438 + const coef = box?.type === "5" ? height : width;
1258 1439
1259 - const max = Math.max(z, y); 1440 + const pick = (cw, d) => {
  1441 + const t = cw?.type;
  1442 + if (five.includes(t)) return 2 * coef;
  1443 + if (four.includes(t)) return 2 * coef + d;
  1444 + if (one.includes(t)) return coef + d;
  1445 + return d;
  1446 + };
1260 1447
1261 - if (max > (sfhs?.value || 0)) {  
1262 - top = max;  
1263 - } else {  
1264 - top = sfhs?.value;  
1265 - }  
1266 - } else {  
1267 - top = max;  
1268 - } 1448 + let top = 0;
  1449 + if (zscw?.type && yscw?.type) {
  1450 + const z = pick(zscw, dZ);
  1451 + const y = pick(yscw, dY);
  1452 + top = Math.max(z, y, sfhs?.value || 0);
1269 } else if (yscw?.type) { 1453 } 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 - } 1454 + top = Math.max(pick(yscw, dY), sfhs?.value || 0);
1292 } else if (zscw?.type) { 1455 } 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 - } 1456 + top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
1315 } else { 1457 } else {
1316 - top = sfhs?.value; 1458 + top = sfhs?.value || 0;
1317 } 1459 }
1318 1460
1319 - // 处理天地盒默认加上高  
1320 - if (Number(svgType) === 4) {  
1321 - top = top + height;  
1322 - } 1461 + if (svg === 4) top += height;
1323 return isNaN(top) ? 0 : top; 1462 return isNaN(top) ? 0 : top;
1324 }; 1463 };
1325 const bottomOffect = (list, length, width, height) => { 1464 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; 1465 + const val = list.filter(x => x.type);
  1466 + const sfhs = val.find(x => x.sName === "下方盒舌");
  1467 + const zscw = val.find(x => x.sName === "左(下)插位组件");
  1468 + const yscw = val.find(x => x.sName === "右(下)插位组件");
  1469 + const hdzj = val.find(x => x.sName === "盒底组件");
  1470 + const box = val.find(x => x.sName === "盒身");
  1471 + const svg = Number(box?.type);
  1472 +
  1473 + if (svg === 6) return 0;
  1474 + if (hdzj?.type) return Number(hdzj.value);
  1475 +
  1476 + const dZ = Number(zscw?.value) || 0;
  1477 + const dY = Number(yscw?.value) || 0;
  1478 + if (svg === 8) {
  1479 + const zxcw = val.find(x => x.sName === "左下插位组件");
  1480 + const yxcw = val.find(x => x.sName === "右下插位组件");
  1481 + const topsMap = {
  1482 + 14001: width + Number(zxcw?.value),
  1483 + 14002: Number(zxcw?.value),
  1484 + 14003: Number(zxcw?.value),
  1485 + 14004: Number(zxcw?.value) + width * 2,
  1486 + 14005: width * 2,
  1487 + 14006: Number(zxcw?.value) + width,
  1488 + 14007: Number(zxcw?.value) + width,
  1489 + };
  1490 + const topsMapRight = {
  1491 + 16001: width + Number(yxcw?.value),
  1492 + 16002: Number(yxcw?.value),
  1493 + 16003: Number(yxcw?.value),
  1494 + 16004: Number(yxcw?.value) + width * 2,
  1495 + 16005: width * 2,
  1496 + 16006: Number(yxcw?.value) + width,
  1497 + 16007: Number(yxcw?.value) + width,
  1498 + };
  1499 + return Math.max(topsMap[zxcw?.type], topsMapRight[yxcw?.type]) ?? 0;
  1500 + }
1337 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; 1501 const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
1338 const four = ["6004", "3004", "4004", "7004"]; 1502 const four = ["6004", "3004", "4004", "7004"];
1339 const five = ["6005", "3005", "4005", "7005"]; 1503 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 - } 1504 +
  1505 + const coef = box?.type === "5" ? height : width;
  1506 +
  1507 + const pick = (cw, d) => {
  1508 + const t = cw?.type;
  1509 + if (five.includes(t)) return 2 * coef;
  1510 + if (four.includes(t)) return 2 * coef + d;
  1511 + if (one.includes(t)) return coef + d;
  1512 + return d;
  1513 + };
  1514 +
  1515 + let top = 0;
1346 if (zscw?.type && yscw?.type) { 1516 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 - } 1517 + const z = pick(zscw, dZ);
  1518 + const y = pick(yscw, dY);
  1519 + top = Math.max(z, y, sfhs?.value || 0);
1371 } else if (yscw?.type) { 1520 } 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 - } 1521 + top = Math.max(pick(yscw, dY), sfhs?.value || 0);
1394 } else if (zscw?.type) { 1522 } 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 - } 1523 + top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
1417 } else { 1524 } 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; 1525 + top = sfhs?.value || 0;
1452 } 1526 }
  1527 +
  1528 + if (svg === 4) top += height;
1453 return isNaN(top) ? 0 : top; 1529 return isNaN(top) ? 0 : top;
1454 }; 1530 };
1455 // 上方盒舌左边 1531 // 上方盒舌左边
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; 1532 + const createUpperBoxTongueLeft = (type, w, h, ox, oy) => {
  1533 + if (!h) return createNoneProject();
  1534 + const fnMap = {
  1535 + 1001: createLineWeltTop,
  1536 + 1002: createIsoscelesTrapezoidWeltTop,
  1537 + 1003: createTrapezoidWeltTop,
  1538 + 1004: createFoldWeltTop,
  1539 + 1005: createRoundedCornersWeltTop,
  1540 + 2001: createLineWeltTop,
  1541 + 2002: createIsoscelesTrapezoidWeltTop,
  1542 + 2003: createTrapezoidWeltTop,
  1543 + 2004: createFoldWeltTop,
  1544 + 2005: createRoundedCornersWeltTop,
  1545 + };
  1546 + return (fnMap[type] || createNoneProject)(w, h, ox, oy);
1514 }; 1547 };
  1548 +
1515 // 右上方盒舌 1549 // 右上方盒舌
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 1550
1551 // 左边贴位 1551 // 左边贴位
1552 const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { 1552 const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => {
1553 if (!size) return createNoneProject(); 1553 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; 1554 + const fnMap = {
  1555 + 8001: createWelt,
  1556 + 8002: createWelt1,
  1557 + 8003: createWelt2,
  1558 + 8004: createWelt3,
  1559 + 8005: createWelt4,
  1560 + };
  1561 + const fn = fnMap[trapezoidLeftType];
  1562 + return fn
  1563 + ? trapezoidLeftType === "8005"
  1564 + ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS)
  1565 + : fn(height, size, offsetX, offsetY)
  1566 + : createNoneProject();
1576 }; 1567 };
1577 // 右边贴位 1568 // 右边贴位
1578 const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { 1569 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; 1570 + const suffix = trapezoidLeftType;
  1571 + const fnMap = {
  1572 + 9001: createWelt,
  1573 + 9002: createWelt1,
  1574 + 9003: createWelt2Right,
  1575 + 9004: createWelt3Right,
  1576 + 9005: createWelt4Right,
  1577 + };
  1578 + const fn = fnMap[suffix];
  1579 + return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject();
1602 }; 1580 };
1603 // 左上部件 1581 // 左上部件
1604 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { 1582 const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => {
1605 if (!size) return createNoneProject(); 1583 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; 1584 +
  1585 + const suffix = trapezoidLeftType?.slice(-2);
  1586 + const fnMap = {
  1587 + "01": createBoxComponentNew,
  1588 + "02": createBoxComponentNew1,
  1589 + "03": createBoxComponentNew2,
  1590 + "04": createBoxComponentNew3,
  1591 + "05": createBoxComponentNew4,
  1592 + "06": createBoxComponentNew5,
  1593 + "07": createBoxComponentNew6,
  1594 + };
  1595 +
  1596 + const fn = fnMap[suffix];
  1597 + return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject();
1713 }; 1598 };
  1599 +
1714 // 盒底组件 特殊的盒底组件 1600 // 盒底组件 特殊的盒底组件
1715 const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { 1601 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; 1602 + const suffix = trapezoidLeftType?.slice(-2);
  1603 + const fnMap = {
  1604 + "01": createRightAngleBoxBottomComponent,
  1605 + "02": createBoxBottomComponent1,
  1606 + "03": createBoxBottomComponent2,
  1607 + "04": createBoxBottomComponent3,
  1608 + "05": createBoxBottomComponent4,
  1609 + "06": createBoxBottomComponent5,
  1610 + "07": createBoxBottomComponent6,
  1611 + };
  1612 + return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY);
1744 }; 1613 };
1745 -  
1746 // 天地盒部件 1614 // 天地盒部件
1747 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { 1615 const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => {
1748 - let data = {};  
1749 if (!size) return createNoneProject(); 1616 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; 1617 +
  1618 + const suffix = trapezoidLeftType?.slice(-2);
  1619 + switch (suffix) {
  1620 + case "01": // 4001,10001,12001,13001,15001,6001
  1621 + return createBoxComponentNewFull(width, deep, size, offsetX, offsetY);
  1622 + case "02": // 4002,10002,11002,12002,13002,15002,6002
  1623 + return createBoxComponentNewFull1(width, size, offsetX, offsetY);
  1624 + case "03": // 4003,6003
  1625 + return createBoxComponentNewFull2(width, size, offsetX, offsetY);
  1626 + case "04": // 4004,6004
  1627 + return createBoxComponentNewFul3(width, deep, size, offsetX, offsetY);
  1628 + case "05": // 4005,6005
  1629 + return createBoxComponentNewFul4(width, deep, size, offsetX, offsetY);
  1630 + case "06": // 4006,6006
  1631 + return createBoxComponentNewFul5(width, deep, size, offsetX, offsetY);
  1632 + case "07": // 4007,6007
  1633 + return createBoxComponentNewFul6(width, deep, size, offsetX, offsetY);
1793 default: 1634 default:
1794 - data = createNoneProject();  
1795 - break; 1635 + return createNoneProject();
1796 } 1636 }
1797 - return data;  
1798 }; 1637 };
1799 return ( 1638 return (
1800 <div 1639 <div
src/components/Common/CommonComponent/index.js
@@ -23,7 +23,16 @@ import { @@ -23,7 +23,16 @@ import {
23 Tooltip, 23 Tooltip,
24 Modal, 24 Modal,
25 } from "antd-v4"; 25 } from "antd-v4";
26 -import {DeleteOutlined, EyeOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FileOutlined, RightOutlined, PlaySquareOutlined } from "@ant-design/icons"; 26 +import {
  27 + DeleteOutlined,
  28 + EyeOutlined,
  29 + FilePdfOutlined,
  30 + FileWordOutlined,
  31 + FileExcelOutlined,
  32 + FileOutlined,
  33 + RightOutlined,
  34 + PlaySquareOutlined,
  35 +} from "@ant-design/icons";
27 import * as commonUtils from "@/utils/utils"; 36 import * as commonUtils from "@/utils/utils";
28 import styles from "@/index.less"; 37 import styles from "@/index.less";
29 import Provinces from "@/assets/provinces.json"; 38 import Provinces from "@/assets/provinces.json";
@@ -1282,26 +1291,26 @@ export default class CommonComponent extends Component { @@ -1282,26 +1291,26 @@ export default class CommonComponent extends Component {
1282 showUploadList: false, 1291 showUploadList: false,
1283 openFileDialogOnClick: this.props.enabled, 1292 openFileDialogOnClick: this.props.enabled,
1284 }; 1293 };
1285 - const imageUrl = sName === "sPackPath" ? this.props.record.sPackPath : sName === "sPackDetailPathUpLoad" ? this.props.record.sPackDetailPathUpLoad : this.props.record.sSvgPath; 1294 + const imageUrl =
  1295 + sName === "sPackPath"
  1296 + ? this.props.record.sPackPath
  1297 + : sName === "sPackDetailPathUpLoad"
  1298 + ? this.props.record.sPackDetailPathUpLoad
  1299 + : this.props.record.sSvgPath;
1286 return ( 1300 return (
1287 <div> 1301 <div>
1288 - <Upload {...uploadProps}>  
1289 - {imageUrl ? (  
1290 - <Image  
1291 - key={imageUrl}  
1292 - src={imageUrl}  
1293 - alt="avatar"  
1294 - style={{ width: '100%' }}  
1295 - preview={!this.props.enabled}  
1296 - />  
1297 - 1302 + <Upload {...uploadProps}>
  1303 + {imageUrl ? (
  1304 + <Image key={imageUrl} src={imageUrl} alt="avatar" style={{ width: "100%" }} preview={!this.props.enabled} />
1298 ) : ( 1305 ) : (
1299 <div> 1306 <div>
1300 <div style={{ marginTop: 8 }}>上传</div> 1307 <div style={{ marginTop: 8 }}>上传</div>
1301 </div> 1308 </div>
1302 )} 1309 )}
1303 - </Upload>  
1304 - <Button {...this.getUploadButtonProps()}><DeleteOutlined /></Button> 1310 + </Upload>
  1311 + <Button {...this.getUploadButtonProps()}>
  1312 + <DeleteOutlined />
  1313 + </Button>
1305 </div> 1314 </div>
1306 ); 1315 );
1307 } 1316 }
@@ -1326,10 +1335,28 @@ export default class CommonComponent extends Component { @@ -1326,10 +1335,28 @@ export default class CommonComponent extends Component {
1326 { name: "右贴边位", value: "dYTBW" }, 1335 { name: "右贴边位", value: "dYTBW" },
1327 { name: "右(下)插位组件", value: "dYXCW" }, 1336 { name: "右(下)插位组件", value: "dYXCW" },
1328 ]; 1337 ];
1329 - slaveData.forEach(x => { 1338 + const doubleTitlieList1 = [
  1339 + { name: "左上插位组件", value: "dZSCW" },
  1340 + { name: "上插位组件", value: "dSCW" },
  1341 + { name: "右上插位组件", value: "dYSCW" },
  1342 + { name: "左偏移", value: "dZPY" },
  1343 + { name: "左插位组件", value: "dZCW" },
  1344 + { name: "左下插位组件", value: "dZXCW" },
  1345 + { name: "右偏移", value: "dYPY" },
  1346 + { name: "右插位组件", value: "dYCW" },
  1347 + { name: "右下插位组件", value: "dYXCW" },
  1348 + { name: "首盒长", value: "dSHC" },
  1349 + { name: "首盒宽", value: "dSHK" },
  1350 + { name: "次盒长", value: "dCHC" },
  1351 + { name: "次盒宽", value: "dCHK" },
  1352 + ];
  1353 + const boxTypes = this.props.record.sTypes;
  1354 + const srcList = Number(boxTypes) === 8 ? doubleTitlieList1 : titleList1;
  1355 +
  1356 + slaveData.forEach(x =>
1330 boxList.push({ 1357 boxList.push({
1331 value: x.iValue, 1358 value: x.iValue,
1332 - sName: titleList1.find(item => item.value === x.sCode)?.name || "", 1359 + sName: srcList.find(item => item.value === x.sCode)?.name || "",
1333 isEditable: true, 1360 isEditable: true,
1334 isSelect: false, 1361 isSelect: false,
1335 selectValue: null, 1362 selectValue: null,
@@ -1337,9 +1364,10 @@ export default class CommonComponent extends Component { @@ -1337,9 +1364,10 @@ export default class CommonComponent extends Component {
1337 selectImage: null, 1364 selectImage: null,
1338 type: x.sTypes || null, 1365 type: x.sTypes || null,
1339 show: true, 1366 show: true,
1340 - showName: x.sName, // 参数名称  
1341 - });  
1342 - }); 1367 + showName: x.sName,
  1368 + })
  1369 + );
  1370 +
1343 tables.forEach(x => { 1371 tables.forEach(x => {
1344 boxList.push({ 1372 boxList.push({
1345 value: x.value, 1373 value: x.value,
@@ -1354,6 +1382,23 @@ export default class CommonComponent extends Component { @@ -1354,6 +1382,23 @@ export default class CommonComponent extends Component {
1354 showName: x.name, // 参数名称 1382 showName: x.name, // 参数名称
1355 }); 1383 });
1356 }); 1384 });
  1385 + // if (sDoubleSizeList && sDoubleSizeList.length) {
  1386 + // const titles = ["首盒长", "首盒宽", "次盒长", "次盒宽"];
  1387 + // sDoubleSizeList.forEach((x, i) => {
  1388 + // boxList.push({
  1389 + // value: x,
  1390 + // sName: titles[i],
  1391 + // isEditable: true,
  1392 + // isSelect: false,
  1393 + // selectValue: null,
  1394 + // selectLabel: "",
  1395 + // selectImage: null,
  1396 + // type: null,
  1397 + // show: true,
  1398 + // showName: titles[i], // 参数名称
  1399 + // });
  1400 + // });
  1401 + // }
1357 const svgProps = { 1402 const svgProps = {
1358 ...this.props, 1403 ...this.props,
1359 boxList, 1404 boxList,
@@ -1361,6 +1406,7 @@ export default class CommonComponent extends Component { @@ -1361,6 +1406,7 @@ export default class CommonComponent extends Component {
1361 dSvgBoxHeight: 100, 1406 dSvgBoxHeight: 100,
1362 showNew: 1, 1407 showNew: 1,
1363 }; 1408 };
  1409 +
1364 return ( 1410 return (
1365 <div style={{ width: "100px", height: "100px" }}> 1411 <div style={{ width: "100px", height: "100px" }}>
1366 <SvgBox {...svgProps} /> 1412 <SvgBox {...svgProps} />
@@ -2928,7 +2974,7 @@ export default class CommonComponent extends Component { @@ -2928,7 +2974,7 @@ export default class CommonComponent extends Component {
2928 const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString()); 2974 const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString());
2929 if (!commonUtils.isEmpty(sAssignField)) { 2975 if (!commonUtils.isEmpty(sAssignField)) {
2930 /* 赋值数组 */ 2976 /* 赋值数组 */
2931 - 2977 +
2932 const sAssignFieldObj = sAssignField.split(","); 2978 const sAssignFieldObj = sAssignField.split(",");
2933 if (commonUtils.isNotEmptyObject(changeData)) { 2979 if (commonUtils.isNotEmptyObject(changeData)) {
2934 for (const child of sAssignFieldObj) { 2980 for (const child of sAssignFieldObj) {
@@ -3526,7 +3572,7 @@ export default class CommonComponent extends Component { @@ -3526,7 +3572,7 @@ export default class CommonComponent extends Component {
3526 ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` 3572 ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}`
3527 : picAddr[0]; /* 缩略图 */ 3573 : picAddr[0]; /* 缩略图 */
3528 // const dataPriviewUrl = `${commonConfig.server_host}file/download?savePathStr=${picAddr}&width=800&&height=500&sModelsId=100&token=${token}`; /* 预览 */ 3574 // const dataPriviewUrl = `${commonConfig.server_host}file/download?savePathStr=${picAddr}&width=800&&height=500&sModelsId=100&token=${token}`; /* 预览 */
3529 - const officeFileTypeList = ['PDF', 'DOCX', 'XLSX', 'MP4', 'WEBM', 'OGG']; 3575 + const officeFileTypeList = ["PDF", "DOCX", "XLSX", "MP4", "WEBM", "OGG"];
3530 const imgTypeList = ["PNG", "SVG", "JPG", "JPEG", "GIF", "BMP", "TIFF", "ICO"]; 3576 const imgTypeList = ["PNG", "SVG", "JPG", "JPEG", "GIF", "BMP", "TIFF", "ICO"];
3531 const officeFileType = picAddr[0].split(".").pop().toUpperCase(); 3577 const officeFileType = picAddr[0].split(".").pop().toUpperCase();
3532 let fileIcon = <FilePdfOutlined />; 3578 let fileIcon = <FilePdfOutlined />;
@@ -3534,7 +3580,7 @@ export default class CommonComponent extends Component { @@ -3534,7 +3580,7 @@ export default class CommonComponent extends Component {
3534 fileIcon = <FileWordOutlined />; 3580 fileIcon = <FileWordOutlined />;
3535 } else if (officeFileType === "XLSX") { 3581 } else if (officeFileType === "XLSX") {
3536 fileIcon = <FileExcelOutlined />; 3582 fileIcon = <FileExcelOutlined />;
3537 - } else if (['MP4', 'WEBM', 'OGG'].includes(officeFileType)) { 3583 + } else if (["MP4", "WEBM", "OGG"].includes(officeFileType)) {
3538 fileIcon = <PlaySquareOutlined />; 3584 fileIcon = <PlaySquareOutlined />;
3539 } 3585 }
3540 let imgBox1 = ""; 3586 let imgBox1 = "";
src/components/Common/Typesetting/typesetting.js
@@ -143,6 +143,22 @@ const Typesetting = props =&gt; { @@ -143,6 +143,22 @@ const Typesetting = props =&gt; {
143 { name: "右贴边位", value: "dYTBW" }, 143 { name: "右贴边位", value: "dYTBW" },
144 { name: "右(下)插位组件", value: "dYXCW" }, 144 { name: "右(下)插位组件", value: "dYXCW" },
145 ]; 145 ];
  146 + const doubleTitlieList1 = [
  147 + { name: "左上插位组件", value: "dZSCW" },
  148 + { name: "上插位组件", value: "dSCW" },
  149 + { name: "右上插位组件", value: "dYSCW" },
  150 + { name: "左偏移", value: "dZPY" },
  151 + { name: "左插位组件", value: "dZCW" },
  152 + { name: "左下插位组件", value: "dZXCW" },
  153 + { name: "右偏移", value: "dYPY" },
  154 + { name: "右插位组件", value: "dYCW" },
  155 + { name: "右下插位组件", value: "dYXCW" },
  156 + { name: "首盒长", value: "dSHC" },
  157 + { name: "首盒宽", value: "dSHK" },
  158 + { name: "次盒长", value: "dCHC" },
  159 + { name: "次盒宽", value: "dCHK" },
  160 + ];
  161 + const srcList = Number(slaveRowData.sTypes) === 8 ? doubleTitlieList1 : titleList1;
146 slaveNewData.forEach(x => { 162 slaveNewData.forEach(x => {
147 let key = 0; 163 let key = 0;
148 if (x.sAssignFormula) { 164 if (x.sAssignFormula) {
@@ -152,7 +168,7 @@ const Typesetting = props =&gt; { @@ -152,7 +168,7 @@ const Typesetting = props =&gt; {
152 } 168 }
153 boxList.push({ 169 boxList.push({
154 value: key, 170 value: key,
155 - sName: titleList1.find(item => item.value === x.sName)?.name || "", 171 + sName: srcList.find(item => item.value === x.sName)?.name || "",
156 isEditable: true, 172 isEditable: true,
157 isSelect: false, 173 isSelect: false,
158 selectValue: null, 174 selectValue: null,
@@ -160,7 +176,7 @@ const Typesetting = props =&gt; { @@ -160,7 +176,7 @@ const Typesetting = props =&gt; {
160 selectImage: null, 176 selectImage: null,
161 type: x.sTypes || null, 177 type: x.sTypes || null,
162 show: true, 178 show: true,
163 - sCode: titleList1.find(item => item.value === x.sName)?.value || "", 179 + sCode: srcList.find(item => item.value === x.sName)?.value || "",
164 showName: x.showName, // 参数名称 180 showName: x.showName, // 参数名称
165 }); 181 });
166 }); 182 });
@@ -455,12 +471,12 @@ const Typesetting = props =&gt; { @@ -455,12 +471,12 @@ const Typesetting = props =&gt; {
455 const calculateLeftPosition = (col, reference, isVertical, leftPosition, dYBJJ, dSLengthOffset) => { 471 const calculateLeftPosition = (col, reference, isVertical, leftPosition, dYBJJ, dSLengthOffset) => {
456 if (isVertical) { 472 if (isVertical) {
457 if (reference) { 473 if (reference) {
458 - return col === 0 ? leftPosition : leftPosition + (dYBJJ * col); 474 + return col === 0 ? leftPosition : leftPosition + dYBJJ * col;
459 } 475 }
460 return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col; 476 return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col;
461 } else { 477 } else {
462 if (reference) { 478 if (reference) {
463 - return col === 0 ? leftPosition : leftPosition + (dYBJJ * col); 479 + return col === 0 ? leftPosition : leftPosition + dYBJJ * col;
464 } 480 }
465 return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col + dSLengthOffset * col; 481 return col === 0 ? leftPosition : leftPosition + (boxLengthOffset + dYBJJ) * col + dSLengthOffset * col;
466 } 482 }
@@ -549,9 +565,8 @@ const Typesetting = props =&gt; { @@ -549,9 +565,8 @@ const Typesetting = props =&gt; {
549 leftPosition = cols * (innerWidthCombined + boxLengthOffset); 565 leftPosition = cols * (innerWidthCombined + boxLengthOffset);
550 } else { 566 } else {
551 topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset); 567 topPosition = index * (innerHeightCombined + boxWidthOffset + dSWidthOffset);
552 -  
553 - leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset+dYBJJ) ;  
554 568
  569 + leftPosition = cols * (innerWidthCombined + boxLengthOffset + dSLengthOffset + dYBJJ);
555 } 570 }
556 innerDivs.push(createDiv(cols - 1, index, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon)); 571 innerDivs.push(createDiv(cols - 1, index, 3, leftPosition, topPosition, iFAngle, DisableMateriallIcon));
557 } 572 }
@@ -576,7 +591,9 @@ const Typesetting = props =&gt; { @@ -576,7 +591,9 @@ const Typesetting = props =&gt; {
576 // 判断列是否是单独的 591 // 判断列是否是单独的
577 592
578 const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长 593 const newMaterialLength = parseFloat(propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined) + dZBLB + dYBLB).toFixed(2); // 原纸长
579 - const newMaterialWidth = parseFloat(propsDataTop + propsDataHeight + dSBLB + dXBLB - (isVertical ? 0 : rows >= 1 ? (remaining ? 0 : dXBJJ) : 0)).toFixed(2); 594 + const newMaterialWidth = parseFloat(
  595 + propsDataTop + propsDataHeight + dSBLB + dXBLB - (isVertical ? 0 : rows >= 1 ? (remaining ? 0 : dXBJJ) : 0)
  596 + ).toFixed(2);
580 597
581 // 计算开数 598 // 计算开数
582 let dSinglePQty = isVertical 599 let dSinglePQty = isVertical
@@ -1085,7 +1102,7 @@ const Typesetting = props =&gt; { @@ -1085,7 +1102,7 @@ const Typesetting = props =&gt; {
1085 width: `${modalWidth}`, 1102 width: `${modalWidth}`,
1086 padding: "1px", 1103 padding: "1px",
1087 }} 1104 }}
1088 - style={{top: 0}} 1105 + style={{ top: 0 }}
1089 onCancel={handleCancel} 1106 onCancel={handleCancel}
1090 > 1107 >
1091 <div 1108 <div
src/components/QuickQuote/index.jsx
@@ -1875,7 +1875,7 @@ const BoxComponent = props =&gt; { @@ -1875,7 +1875,7 @@ const BoxComponent = props =&gt; {
1875 } 1875 }
1876 const UlToolPosition = commonFunc.showLocalMessage(props, "UlToolPosition", "上下刀位"); 1876 const UlToolPosition = commonFunc.showLocalMessage(props, "UlToolPosition", "上下刀位");
1877 const RLToolPosition = commonFunc.showLocalMessage(props, "RLToolPosition", "左右刀位"); 1877 const RLToolPosition = commonFunc.showLocalMessage(props, "RLToolPosition", "左右刀位");
1878 - const LeftMargin = commonFunc.showLocalMessage(props, "LeftMargin", "左右刀位"); 1878 + const LeftMargin = commonFunc.showLocalMessage(props, "LeftMargin", "左右留白");
1879 boxConfigList = boxConfig?.gdsconfigformslave?.filter(item => item.bVisible && showNameKeyList.includes(item.sName)) || []; 1879 boxConfigList = boxConfig?.gdsconfigformslave?.filter(item => item.bVisible && showNameKeyList.includes(item.sName)) || [];
1880 if (selectedNode.sTypeKey === "juantong") { 1880 if (selectedNode.sTypeKey === "juantong") {
1881 const mappings = { 1881 const mappings = {
@@ -2304,6 +2304,7 @@ const BoxComponent = props =&gt; { @@ -2304,6 +2304,7 @@ const BoxComponent = props =&gt; {
2304 { name: "盒宽", value: slaveRowData.dW ? slaveRowData.dW : masterData.dWidth ? Number(masterData.dWidth) : 0, type: null }, 2304 { name: "盒宽", value: slaveRowData.dW ? slaveRowData.dW : masterData.dWidth ? Number(masterData.dWidth) : 0, type: null },
2305 { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null }, 2305 { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null },
2306 ]; 2306 ];
  2307 + const boxTypes = slaveRowData.sTypes;
2307 const titleList1 = [ 2308 const titleList1 = [
2308 { name: "上方盒舌", value: "dSFHS" }, 2309 { name: "上方盒舌", value: "dSFHS" },
2309 { name: "盒底组件", value: "dHDC" }, 2310 { name: "盒底组件", value: "dHDC" },
@@ -2315,6 +2316,22 @@ const BoxComponent = props =&gt; { @@ -2315,6 +2316,22 @@ const BoxComponent = props =&gt; {
2315 { name: "右贴边位", value: "dYTBW" }, 2316 { name: "右贴边位", value: "dYTBW" },
2316 { name: "右(下)插位组件", value: "dYXCW" }, 2317 { name: "右(下)插位组件", value: "dYXCW" },
2317 ]; 2318 ];
  2319 + const doubleTitlieList1 = [
  2320 + { name: "左上插位组件", value: "dZSCW" },
  2321 + { name: "上插位组件", value: "dSCW" },
  2322 + { name: "右上插位组件", value: "dYSCW" },
  2323 + { name: "左偏移", value: "dZPY" },
  2324 + { name: "左插位组件", value: "dZCW" },
  2325 + { name: "左下插位组件", value: "dZXCW" },
  2326 + { name: "右偏移", value: "dYPY" },
  2327 + { name: "右插位组件", value: "dYCW" },
  2328 + { name: "右下插位组件", value: "dYXCW" },
  2329 + { name: "首盒长", value: "dSHC" },
  2330 + { name: "首盒宽", value: "dSHK" },
  2331 + { name: "次盒长", value: "dCHC" },
  2332 + { name: "次盒宽", value: "dCHK" },
  2333 + ];
  2334 + const srcList = Number(boxTypes) === 8 ? doubleTitlieList1 : titleList1;
2318 const evaluateFormula = (formula, variables) => { 2335 const evaluateFormula = (formula, variables) => {
2319 if (!formula) return 0; // 如果公式为空,返回0 2336 if (!formula) return 0; // 如果公式为空,返回0
2320 try { 2337 try {
@@ -2357,7 +2374,7 @@ const BoxComponent = props =&gt; { @@ -2357,7 +2374,7 @@ const BoxComponent = props =&gt; {
2357 } 2374 }
2358 boxList.push({ 2375 boxList.push({
2359 value: key, 2376 value: key,
2360 - sName: titleList1.find(item => item.value === x.sName)?.name || "", 2377 + sName: srcList.find(item => item.value === x.sName)?.name || "",
2361 isEditable: true, 2378 isEditable: true,
2362 isSelect: false, 2379 isSelect: false,
2363 selectValue: null, 2380 selectValue: null,
@@ -2383,7 +2400,6 @@ const BoxComponent = props =&gt; { @@ -2383,7 +2400,6 @@ const BoxComponent = props =&gt; {
2383 }); 2400 });
2384 }); 2401 });
2385 } 2402 }
2386 -  
2387 const svgProps = { 2403 const svgProps = {
2388 ...props, 2404 ...props,
2389 boxList, 2405 boxList,
@@ -3229,10 +3245,26 @@ const BoxModelSelectedModal = props =&gt; { @@ -3229,10 +3245,26 @@ const BoxModelSelectedModal = props =&gt; {
3229 { name: "右贴边位", value: "dYTBW" }, 3245 { name: "右贴边位", value: "dYTBW" },
3230 { name: "右(下)插位组件", value: "dYXCW" }, 3246 { name: "右(下)插位组件", value: "dYXCW" },
3231 ]; 3247 ];
  3248 + const doubleTitlieList1 = [
  3249 + { name: "左上插位组件", value: "dZSCW" },
  3250 + { name: "上插位组件", value: "dSCW" },
  3251 + { name: "右上插位组件", value: "dYSCW" },
  3252 + { name: "左偏移", value: "dZPY" },
  3253 + { name: "左插位组件", value: "dZCW" },
  3254 + { name: "左下插位组件", value: "dZXCW" },
  3255 + { name: "右偏移", value: "dYPY" },
  3256 + { name: "右插位组件", value: "dYCW" },
  3257 + { name: "右下插位组件", value: "dYXCW" },
  3258 + { name: "首盒长", value: "dSHC" },
  3259 + { name: "首盒宽", value: "dSHK" },
  3260 + { name: "次盒长", value: "dCHC" },
  3261 + { name: "次盒宽", value: "dCHK" },
  3262 + ];
  3263 + const srcList = Number(sTypes) === 8 ? doubleTitlieList1 : titleList1;
3232 slaveData.forEach(x => { 3264 slaveData.forEach(x => {
3233 boxList.push({ 3265 boxList.push({
3234 value: x.iValue || x.sDefault, 3266 value: x.iValue || x.sDefault,
3235 - sName: titleList1.find(item => item.value === x.sCode || item.value === x.sName)?.name || "", 3267 + sName: srcList.find(item => item.value === x.sCode || item.value === x.sName)?.name || "",
3236 isEditable: true, 3268 isEditable: true,
3237 isSelect: false, 3269 isSelect: false,
3238 selectValue: null, 3270 selectValue: null,
@@ -3264,6 +3296,7 @@ const BoxModelSelectedModal = props =&gt; { @@ -3264,6 +3296,7 @@ const BoxModelSelectedModal = props =&gt; {
3264 dSvgBoxHeight: 100, 3296 dSvgBoxHeight: 100,
3265 showNew: 1, 3297 showNew: 1,
3266 }; 3298 };
  3299 +
3267 return svgProps; 3300 return svgProps;
3268 }; 3301 };
3269 const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected)); 3302 const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected));
@@ -3586,6 +3619,7 @@ const GetBestAlgorithm = props =&gt; { @@ -3586,6 +3619,7 @@ const GetBestAlgorithm = props =&gt; {
3586 { name: "盒宽", value: W, type: null }, 3619 { name: "盒宽", value: W, type: null },
3587 { name: "盒高", value: D, type: null }, 3620 { name: "盒高", value: D, type: null },
3588 ]; 3621 ];
  3622 + const boxTypes = slaveRowData.sTypes;
3589 const titleList1 = [ 3623 const titleList1 = [
3590 { name: "上方盒舌", value: "dSFHS" }, 3624 { name: "上方盒舌", value: "dSFHS" },
3591 { name: "盒底组件", value: "dHDC" }, 3625 { name: "盒底组件", value: "dHDC" },
@@ -3597,6 +3631,22 @@ const GetBestAlgorithm = props =&gt; { @@ -3597,6 +3631,22 @@ const GetBestAlgorithm = props =&gt; {
3597 { name: "右贴边位", value: "dYTBW" }, 3631 { name: "右贴边位", value: "dYTBW" },
3598 { name: "右(下)插位组件", value: "dYXCW" }, 3632 { name: "右(下)插位组件", value: "dYXCW" },
3599 ]; 3633 ];
  3634 + const doubleTitlieList1 = [
  3635 + { name: "左上插位组件", value: "dZSCW" },
  3636 + { name: "上插位组件", value: "dSCW" },
  3637 + { name: "右上插位组件", value: "dYSCW" },
  3638 + { name: "左偏移", value: "dZPY" },
  3639 + { name: "左插位组件", value: "dZCW" },
  3640 + { name: "左下插位组件", value: "dZXCW" },
  3641 + { name: "右偏移", value: "dYPY" },
  3642 + { name: "右插位组件", value: "dYCW" },
  3643 + { name: "右下插位组件", value: "dYXCW" },
  3644 + { name: "首盒长", value: "dSHC" },
  3645 + { name: "首盒宽", value: "dSHK" },
  3646 + { name: "次盒长", value: "dCHC" },
  3647 + { name: "次盒宽", value: "dCHK" },
  3648 + ];
  3649 + const srcList = Number(boxTypes) === 8 ? doubleTitlieList1 : titleList1;
3600 slaveNewData.forEach(x => { 3650 slaveNewData.forEach(x => {
3601 let key = 0; 3651 let key = 0;
3602 if (x.sAssignFormula) { 3652 if (x.sAssignFormula) {
@@ -3606,7 +3656,7 @@ const GetBestAlgorithm = props =&gt; { @@ -3606,7 +3656,7 @@ const GetBestAlgorithm = props =&gt; {
3606 } 3656 }
3607 boxList.push({ 3657 boxList.push({
3608 value: key, 3658 value: key,
3609 - sName: titleList1.find(item => item.value === x.sName)?.name || "", 3659 + sName: srcList.find(item => item.value === x.sName)?.name || "",
3610 isEditable: true, 3660 isEditable: true,
3611 isSelect: false, 3661 isSelect: false,
3612 selectValue: null, 3662 selectValue: null,
@@ -3614,7 +3664,7 @@ const GetBestAlgorithm = props =&gt; { @@ -3614,7 +3664,7 @@ const GetBestAlgorithm = props =&gt; {
3614 selectImage: null, 3664 selectImage: null,
3615 type: x.sTypes || null, 3665 type: x.sTypes || null,
3616 show: true, 3666 show: true,
3617 - sCode: titleList1.find(item => item.value === x.sName)?.value || "", 3667 + sCode: srcList.find(item => item.value === x.sName)?.value || "",
3618 showName: x.showName, // 参数名称 3668 showName: x.showName, // 参数名称
3619 }); 3669 });
3620 }); 3670 });