Commit 74147346ea1d3d9f1b108c82b98597f7b13feaad
1 parent
d7224e72
盒型双盒
Showing
6 changed files
with
4941 additions
and
674 deletions
src/components/Common/BoxDesign/createAirplaneBox.js
| ... | ... | @@ -106,6 +106,36 @@ export const createPathElements = (x, y, width, height, id, wrapperId) => { |
| 106 | 106 | // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 |
| 107 | 107 | return svg; |
| 108 | 108 | }; |
| 109 | +export const createPathElementTrapezoid = (x, y, width, height) => { | |
| 110 | + const d = `M ${x + width * 0.1} ${y} L ${x} ${y + height} L ${x + width} ${y + height} L ${x + width * 0.9} ${y} L ${x + width * 0.2} ${y} `; | |
| 111 | + const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); | |
| 112 | + svg.setAttribute("d", d); | |
| 113 | + svg.setAttribute("fill", "transparent"); | |
| 114 | + svg.setAttribute("stroke", "#7588B9"); | |
| 115 | + svg.setAttribute("stroke-width", "1"); | |
| 116 | + // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 | |
| 117 | + return svg; | |
| 118 | +}; | |
| 119 | +export const createPathElementTrapezoids = (x, y, width, height) => { | |
| 120 | + const d = `M ${x} ${y + height * 0.1} L ${x + width} ${y} L ${x + width} ${y + height} L ${x} ${y + height * 0.9} L ${x} ${y + height * 0.1}`; | |
| 121 | + const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); | |
| 122 | + svg.setAttribute("d", d); | |
| 123 | + svg.setAttribute("fill", "transparent"); | |
| 124 | + svg.setAttribute("stroke", "#7588B9"); | |
| 125 | + svg.setAttribute("stroke-width", "1"); | |
| 126 | + // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 | |
| 127 | + return svg; | |
| 128 | +}; | |
| 129 | +export const createPathElementTrapezoidRight = (x, y, width, height) => { | |
| 130 | + const d = `M ${x} ${y} L ${x + width} ${y + height * 0.1} L ${x + width} ${y + height * 0.9} L ${x} ${y + height} L ${x} ${y}`; | |
| 131 | + const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); | |
| 132 | + svg.setAttribute("d", d); | |
| 133 | + svg.setAttribute("fill", "transparent"); | |
| 134 | + svg.setAttribute("stroke", "#7588B9"); | |
| 135 | + svg.setAttribute("stroke-width", "1"); | |
| 136 | + // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 | |
| 137 | + return svg; | |
| 138 | +}; | |
| 109 | 139 | // |
| 110 | 140 | // 左边斜线贴边 |
| 111 | 141 | export const createTrapezoid = (height, offsetX, offsetY, size) => { |
| ... | ... | @@ -917,9 +947,13 @@ export const createWelt1 = (height, size, offsetX, offsetY) => { |
| 917 | 947 | }; |
| 918 | 948 | // 贴边2 |
| 919 | 949 | export const createWelt2 = (height, size, offsetX, offsetY) => { |
| 920 | - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size *0.3} ${size * 0.3} 0 0 1 ${offsetX } ${offsetY } L ${offsetX} ${offsetY + height} L | |
| 921 | - ${offsetX + size} ${offsetY + height} A ${size *0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} | |
| 922 | - ` | |
| 950 | + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.3} ${size * 0.3} 0 0 1 ${offsetX} ${offsetY} L ${offsetX} ${ | |
| 951 | + offsetY + height | |
| 952 | + } L | |
| 953 | + ${offsetX + size} ${offsetY + height} A ${size * 0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY + height} L ${offsetX + size} ${ | |
| 954 | + offsetY + height | |
| 955 | + } L ${offsetX + size} ${offsetY} | |
| 956 | + `; | |
| 923 | 957 | // A ${ size * 0.5 } ${size} 0 0 1 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 1 ${offsetX + size * 0.5} ${ |
| 924 | 958 | // offsetY + height + Math.abs(size) |
| 925 | 959 | // } A ${size * 0.5} ${size} 0 0 1 ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} L ${offsetX + size} ${ |
| ... | ... | @@ -928,8 +962,12 @@ export const createWelt2 = (height, size, offsetX, offsetY) => { |
| 928 | 962 | return createSvg(d); |
| 929 | 963 | }; |
| 930 | 964 | export const createWelt2Right = (height, size, offsetX, offsetY) => { |
| 931 | - const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} | |
| 932 | - L ${offsetX + size} ${offsetY + height} A ${size *0.3} ${size * 0.3} 0 0 1 ${offsetX} ${offsetY + height} L ${offsetX + size} ${offsetY + height} L ${offsetX + size} ${offsetY} ` | |
| 965 | + const d = `M ${offsetX} ${offsetY} L ${offsetX + size} ${offsetY} A ${size * 0.3} ${size * 0.3} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${ | |
| 966 | + offsetY + height | |
| 967 | + } | |
| 968 | + L ${offsetX + size} ${offsetY + height} A ${size * 0.3} ${size * 0.3} 0 0 1 ${offsetX} ${offsetY + height} L ${offsetX + size} ${ | |
| 969 | + offsetY + height | |
| 970 | + } L ${offsetX + size} ${offsetY} `; | |
| 933 | 971 | // A ${ |
| 934 | 972 | // size * 0.5 |
| 935 | 973 | // } ${size} 0 0 0 ${offsetX} ${offsetY} L ${offsetX} ${offsetY + height} A ${size * 0.5} ${size} 0 0 0 ${offsetX + size * 0.5} ${ |
| ... | ... | @@ -946,8 +984,10 @@ export const createWelt3 = (height, size, offsetX, offsetY) => { |
| 946 | 984 | return createSvg(d); |
| 947 | 985 | }; |
| 948 | 986 | export const createWelt4 = (height, size, offsetX, offsetY, dSFHS, dXFHS) => { |
| 949 | - const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY + height+dXFHS} | |
| 950 | - L ${offsetX} ${offsetY + height+dXFHS} L ${offsetX} ${offsetY + height}`; | |
| 987 | + const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY - dSFHS} L ${offsetX + size} ${ | |
| 988 | + offsetY + height + dXFHS | |
| 989 | + } | |
| 990 | + L ${offsetX} ${offsetY + height + dXFHS} L ${offsetX} ${offsetY + height}`; | |
| 951 | 991 | return createSvg(d); |
| 952 | 992 | }; |
| 953 | 993 | export const createWelt3Right = (height, size, offsetX, offsetY) => { |
| ... | ... | @@ -958,7 +998,7 @@ export const createWelt3Right = (height, size, offsetX, offsetY) => { |
| 958 | 998 | }; |
| 959 | 999 | export const createWelt4Right = (height, size, offsetX, offsetY, dSFHS, dXFHS) => { |
| 960 | 1000 | const d = `M ${offsetX} ${offsetY} L ${offsetX} ${offsetY - dSFHS} L ${offsetX + size} ${offsetY - dSFHS} |
| 961 | - L ${offsetX + size} ${offsetY + height + dXFHS} L ${offsetX } ${offsetY + height + dXFHS} L ${offsetX} ${offsetY + height}`; | |
| 1001 | + L ${offsetX + size} ${offsetY + height + dXFHS} L ${offsetX} ${offsetY + height + dXFHS} L ${offsetX} ${offsetY + height}`; | |
| 962 | 1002 | return createSvg(d); |
| 963 | 1003 | }; |
| 964 | 1004 | // 天地盒 | ... | ... |
src/components/Common/BoxDesignCompontent/index.js
| ... | ... | @@ -8,9 +8,6 @@ import * as commonBusiness from "@/components/Common/commonBusiness"; |
| 8 | 8 | import * as commonServices from "@/services/services"; |
| 9 | 9 | import CommonBase from "@/components/Common/CommonBase"; |
| 10 | 10 | import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; |
| 11 | -import CommonViewTable from "@/components/Common/CommonViewTable"; | |
| 12 | -import StaticEditTable from "@/components/Common/CommonTable"; | |
| 13 | -import jsPreviewPdf from "@js-preview/pdf"; | |
| 14 | 11 | import commonConfig from "@/utils/config"; |
| 15 | 12 | import SvgBox from "./svg"; |
| 16 | 13 | import styles from "./index.less"; |
| ... | ... | @@ -494,7 +491,7 @@ const BoxDesignCompontent = baseProps => { |
| 494 | 491 | updatedBoxList[index].selectImage = selectConfig.image; |
| 495 | 492 | // 选择盒身数据全部清空 |
| 496 | 493 | |
| 497 | - const typeList = [1, 2, 3, 4]; | |
| 494 | + const typeList = [1, 2, 3, 4, 5, 6, 7, 8, 9]; | |
| 498 | 495 | if (typeList.includes(type)) { |
| 499 | 496 | const table1 = tableColum.map(x => x.showName); |
| 500 | 497 | const table2 = boxBodyList.map(x => x.showName); |
| ... | ... | @@ -506,6 +503,18 @@ const BoxDesignCompontent = baseProps => { |
| 506 | 503 | x.type = null; |
| 507 | 504 | x.selectValue = null; |
| 508 | 505 | x.selectImage = null; |
| 506 | + x.sLength = null; | |
| 507 | + x.sWidth = null; | |
| 508 | + x.sType = null; | |
| 509 | + x.sTypeName = null; | |
| 510 | + x.sOffset = null; | |
| 511 | + x.sQuantity = null; | |
| 512 | + x.cLength = null; | |
| 513 | + x.cWidth = null; | |
| 514 | + x.cType = null; | |
| 515 | + x.cTypeName = null; | |
| 516 | + x.cOffset = null; | |
| 517 | + x.cQuantity = null; | |
| 509 | 518 | // x.showName = |
| 510 | 519 | } |
| 511 | 520 | }); |
| ... | ... | @@ -518,10 +527,10 @@ const BoxDesignCompontent = baseProps => { |
| 518 | 527 | let updatedBoxList = [...boxList]; |
| 519 | 528 | if (doubleType === 0) { |
| 520 | 529 | updatedBoxList[index].sTypeName = Number(name) === 0 ? "矩形" : "梯形"; |
| 521 | - updatedBoxList[index].sType = Number(name) | |
| 530 | + updatedBoxList[index].sType = Number(name); | |
| 522 | 531 | } else { |
| 523 | 532 | updatedBoxList[index].cTypeName = Number(name) === 0 ? "矩形" : "梯形"; |
| 524 | - updatedBoxList[index].cType = Number(name) | |
| 533 | + updatedBoxList[index].cType = Number(name); | |
| 525 | 534 | } |
| 526 | 535 | setBoxList(updatedBoxList); |
| 527 | 536 | }; |
| ... | ... | @@ -593,7 +602,7 @@ const BoxDesignCompontent = baseProps => { |
| 593 | 602 | sLength: item.sLength, |
| 594 | 603 | sWidth: item.sWidth, |
| 595 | 604 | sType: item.sType, |
| 596 | - sTypeName: item.sTypeName, | |
| 605 | + sTypeName: Number(item.sType) === 0 ? "矩形" : "梯形", | |
| 597 | 606 | sOffset: item.sOffset, |
| 598 | 607 | sQuantity: item.sQuantity, |
| 599 | 608 | cLength: item.cLength, |
| ... | ... | @@ -1490,8 +1499,9 @@ const BoxDesignCompontent = baseProps => { |
| 1490 | 1499 | > |
| 1491 | 1500 | {!loading ? options.map(option => renderOptionWithImage(option)) : ""} |
| 1492 | 1501 | </Select> |
| 1493 | - {item?.type && item?.type.includes("09") ? ( | |
| 1494 | - <div> | |
| 1502 | + | |
| 1503 | + {/* {item?.type && item?.type.includes("09") ? ( | |
| 1504 | + <div className={styles.boxInput}> | |
| 1495 | 1505 | <div className={styles.boxInput}> |
| 1496 | 1506 | <div className={styles.text} style={{ width: " 100%" }}> |
| 1497 | 1507 | 层1{" "} |
| ... | ... | @@ -1646,7 +1656,165 @@ const BoxDesignCompontent = baseProps => { |
| 1646 | 1656 | style={{ width: " 80%" }} |
| 1647 | 1657 | /> |
| 1648 | 1658 | </div> |
| 1649 | - )} | |
| 1659 | + )} */} | |
| 1660 | + <div className={styles.boxInput}> | |
| 1661 | + {item?.selectImage ? ( | |
| 1662 | + <img | |
| 1663 | + src={item?.selectImage} | |
| 1664 | + alt={item.value} | |
| 1665 | + style={{ | |
| 1666 | + width: 40, | |
| 1667 | + height: 30, | |
| 1668 | + marginRight: 8, | |
| 1669 | + position: "absolute", | |
| 1670 | + left: 20, | |
| 1671 | + top: -35, | |
| 1672 | + zIndex: 10, | |
| 1673 | + }} | |
| 1674 | + /> | |
| 1675 | + ) : ( | |
| 1676 | + "" | |
| 1677 | + )} | |
| 1678 | + {item.type && item.type.includes("09") ? ( | |
| 1679 | + <div> | |
| 1680 | + <div className={styles.boxInput}> | |
| 1681 | + <div className={styles.text} style={{ width: " 100%" }}> | |
| 1682 | + 层1{" "} | |
| 1683 | + </div> | |
| 1684 | + <Input | |
| 1685 | + value={item?.sLength} | |
| 1686 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "sLength")} | |
| 1687 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1688 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1689 | + readOnly={!item?.isEditable} | |
| 1690 | + style={{ width: " 80%" }} | |
| 1691 | + placeholder="长" | |
| 1692 | + /> | |
| 1693 | + <Input | |
| 1694 | + value={item?.sWidth} | |
| 1695 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "sWidth")} | |
| 1696 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1697 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1698 | + readOnly={!item?.isEditable} | |
| 1699 | + style={{ width: " 80%" }} | |
| 1700 | + placeholder="宽" | |
| 1701 | + /> | |
| 1702 | + </div> | |
| 1703 | + <div className={styles.boxInput}> | |
| 1704 | + <Select | |
| 1705 | + optionLabelProp="label" | |
| 1706 | + className="mySelectsDouble" | |
| 1707 | + style={{ width: 180, color: "#000" }} | |
| 1708 | + defaultValue={options.length ? options[0].value : ""} | |
| 1709 | + value={item?.sTypeName || ""} | |
| 1710 | + onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 0)} | |
| 1711 | + onDropdownVisibleChange={async open => { | |
| 1712 | + if (open) { | |
| 1713 | + props.getSqlOptions(null); // 在下拉菜单打开时调用 getSqlOptions | |
| 1714 | + } | |
| 1715 | + }} | |
| 1716 | + > | |
| 1717 | + {!loading ? options.map(option => renderOptionWithText(option)) : ""} | |
| 1718 | + </Select> | |
| 1719 | + <Input | |
| 1720 | + value={item?.sQuantity} | |
| 1721 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "sQuantity")} | |
| 1722 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1723 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1724 | + readOnly={!item?.isEditable} | |
| 1725 | + style={{ width: " 80%" }} | |
| 1726 | + placeholder="个数" | |
| 1727 | + /> | |
| 1728 | + <Input | |
| 1729 | + value={item?.sOffset} | |
| 1730 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "sOffset")} | |
| 1731 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1732 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1733 | + readOnly={!item?.isEditable} | |
| 1734 | + style={{ width: " 80%" }} | |
| 1735 | + placeholder="偏移" | |
| 1736 | + /> | |
| 1737 | + </div> | |
| 1738 | + <div className={styles.boxInput}> | |
| 1739 | + <div className={styles.text} style={{ width: " 100%" }}> | |
| 1740 | + 层2{" "} | |
| 1741 | + </div> | |
| 1742 | + <Input | |
| 1743 | + value={item?.cLength} | |
| 1744 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "cLength")} | |
| 1745 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1746 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1747 | + readOnly={!item?.isEditable} | |
| 1748 | + style={{ width: " 80%" }} | |
| 1749 | + placeholder="长" | |
| 1750 | + /> | |
| 1751 | + <Input | |
| 1752 | + value={item?.cWidth} | |
| 1753 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "cWidth")} | |
| 1754 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1755 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1756 | + readOnly={!item?.isEditable} | |
| 1757 | + style={{ width: " 80%" }} | |
| 1758 | + placeholder="宽" | |
| 1759 | + /> | |
| 1760 | + </div> | |
| 1761 | + <div className={styles.boxInput}> | |
| 1762 | + <Select | |
| 1763 | + optionLabelProp="label" | |
| 1764 | + className="mySelectsDouble" | |
| 1765 | + style={{ width: 180, color: "#000" }} | |
| 1766 | + defaultValue={options.length ? options[0].value : ""} | |
| 1767 | + value={item?.cTypeName || ""} | |
| 1768 | + onSelect={(value, option) => handleSelects(value, option, findIndexBySname(item.sName), 0, 1)} | |
| 1769 | + onDropdownVisibleChange={async open => { | |
| 1770 | + if (open) { | |
| 1771 | + props.getSqlOptions(null); // 在下拉菜单打开时调用 getSqlOptions | |
| 1772 | + } | |
| 1773 | + }} | |
| 1774 | + > | |
| 1775 | + {!loading ? options.map(option => renderOptionWithText(option)) : ""} | |
| 1776 | + </Select> | |
| 1777 | + <Input | |
| 1778 | + value={item?.cQuantity} | |
| 1779 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "cQuantity")} | |
| 1780 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1781 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1782 | + readOnly={!item?.isEditable} | |
| 1783 | + style={{ width: " 80%" }} | |
| 1784 | + placeholder="个数" | |
| 1785 | + /> | |
| 1786 | + <Input | |
| 1787 | + value={item?.cOffset} | |
| 1788 | + onChange={e => handleChange(e, findIndexBySname(item.sName), "cOffset")} | |
| 1789 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1790 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1791 | + readOnly={!item?.isEditable} | |
| 1792 | + style={{ width: " 80%" }} | |
| 1793 | + placeholder="偏移" | |
| 1794 | + /> | |
| 1795 | + </div> | |
| 1796 | + </div> | |
| 1797 | + ) : ( | |
| 1798 | + <div className={styles.boxInput}> | |
| 1799 | + <Input | |
| 1800 | + value={item?.showName} | |
| 1801 | + onChange={e => handleChangeName(e, findIndexBySname(item.sName))} | |
| 1802 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1803 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1804 | + readOnly={!item?.isEditable} | |
| 1805 | + className={styles.text} | |
| 1806 | + /> | |
| 1807 | + <Input | |
| 1808 | + value={item?.value} | |
| 1809 | + onChange={e => handleChange(e, findIndexBySname(item.sName))} | |
| 1810 | + onFocus={e => handleFocus(e, findIndexBySname(item.sName))} | |
| 1811 | + onBlur={e => handleBlur(e, findIndexBySname(item.sName))} | |
| 1812 | + readOnly={!item?.isEditable} | |
| 1813 | + style={{ width: " 80%" }} | |
| 1814 | + /> | |
| 1815 | + </div> | |
| 1816 | + )} | |
| 1817 | + </div> | |
| 1650 | 1818 | </div> |
| 1651 | 1819 | ))} |
| 1652 | 1820 | {boxType === "8" && | ... | ... |
src/components/Common/BoxDesignCompontent/svg.js
Changes suppressed. Click to show
| ... | ... | @@ -49,6 +49,9 @@ import { |
| 49 | 49 | createBoxComponentNewFul4, |
| 50 | 50 | createBoxComponentNewFul5, |
| 51 | 51 | createBoxComponentNewFul6, |
| 52 | + createPathElementTrapezoid, | |
| 53 | + createPathElementTrapezoids, | |
| 54 | + createPathElementTrapezoidRight, | |
| 52 | 55 | } from "../BoxDesign/createAirplaneBox"; |
| 53 | 56 | const SvgBox = props => { |
| 54 | 57 | const svgContainerRef = useRef(null); |
| ... | ... | @@ -99,7 +102,6 @@ const SvgBox = props => { |
| 99 | 102 | orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0; |
| 100 | 103 | orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0; |
| 101 | 104 | } |
| 102 | - | |
| 103 | 105 | // 计算视口宽度和高度 |
| 104 | 106 | const zbtb = boxList.find(x => x.sName === "左贴边位"); |
| 105 | 107 | const ybtb = boxList.find(x => x.sName === "右贴边位"); |
| ... | ... | @@ -127,7 +129,6 @@ const SvgBox = props => { |
| 127 | 129 | // 展宽 |
| 128 | 130 | if (boxList && boxList.length) { |
| 129 | 131 | // 如果存在部件和盒舌 取最大的 |
| 130 | - | |
| 131 | 132 | const top = topOffect(boxList, boxLength, boxWidth, boxHeight); |
| 132 | 133 | const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); |
| 133 | 134 | max = Number(top) + Number(bottom); |
| ... | ... | @@ -173,6 +174,8 @@ const SvgBox = props => { |
| 173 | 174 | leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; |
| 174 | 175 | } else if (zxcwType === "4005") { |
| 175 | 176 | leftValue = boxHeight * 3; |
| 177 | + } else if (zxcwType === "4009") { | |
| 178 | + leftValue = Number(zxcw?.sLength) + Number(zxcw?.cLength); | |
| 176 | 179 | } |
| 177 | 180 | if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { |
| 178 | 181 | rightValue = rightValue + Number(yscwValue) + boxHeight * 2; |
| ... | ... | @@ -182,6 +185,8 @@ const SvgBox = props => { |
| 182 | 185 | rightValue = rightValue + Number(yscwValue) + boxHeight * 3; |
| 183 | 186 | } else if (yscwType === "6005") { |
| 184 | 187 | rightValue = boxHeight * 3; |
| 188 | + } else if (yscwType === "6009") { | |
| 189 | + rightValue = Number(yscw?.sLength) + Number(yscw?.cLength); | |
| 185 | 190 | } |
| 186 | 191 | if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { |
| 187 | 192 | topValue = topValue + Number(zscwValue) + boxHeight * 2; |
| ... | ... | @@ -191,6 +196,8 @@ const SvgBox = props => { |
| 191 | 196 | topValue = topValue + Number(zscwValue) + boxHeight * 3; |
| 192 | 197 | } else if (zscwType === "3005") { |
| 193 | 198 | topValue = boxHeight * 3; |
| 199 | + } else if (zscwType === "3009") { | |
| 200 | + topValue = Number(zscw?.sLength) + Number(zscw?.cLength); | |
| 194 | 201 | } |
| 195 | 202 | if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { |
| 196 | 203 | bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; |
| ... | ... | @@ -200,6 +207,8 @@ const SvgBox = props => { |
| 200 | 207 | bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; |
| 201 | 208 | } else if (yxcwType === "7005") { |
| 202 | 209 | bottomValue = boxHeight * 3; |
| 210 | + } else if (yxcwType === "7009") { | |
| 211 | + bottomValue = Number(yxcw?.sLength) + Number(yxcw?.cLength); | |
| 203 | 212 | } |
| 204 | 213 | viewBoxWidth = Number(boxLength) + leftValue + rightValue; |
| 205 | 214 | viewBoxHeight = Number(boxWidth) + topValue + bottomValue; |
| ... | ... | @@ -269,18 +278,28 @@ const SvgBox = props => { |
| 269 | 278 | // viewBoxHeight = boxLength + dZSCW + dYXCW; |
| 270 | 279 | } else if (Number(svgType) === 8) { |
| 271 | 280 | 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; // 根据偏移量统一处理 | |
| 281 | + if (!item || !item?.type) return 0; | |
| 282 | + const key = Number(item.type - offset); | |
| 283 | + if (!Number.isFinite(key)) return 0; | |
| 284 | + const value = Number(item?.value) || 0; | |
| 285 | + const headWidthNum = Number(headWidth) || 0; | |
| 286 | + switch (key) { | |
| 287 | + case 10001: | |
| 288 | + return headWidthNum + value; | |
| 289 | + case 10002: | |
| 290 | + case 10003: | |
| 291 | + return value; | |
| 292 | + case 10004: | |
| 293 | + return value + headWidthNum * 2; | |
| 294 | + case 10005: | |
| 295 | + return headWidthNum * 2; | |
| 296 | + case 10006: | |
| 297 | + case 10007: | |
| 298 | + return value + headWidthNum; | |
| 299 | + default: | |
| 300 | + return 0; | |
| 301 | + } | |
| 282 | 302 | }; |
| 283 | - | |
| 284 | 303 | const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); |
| 285 | 304 | const topRight = getTop( |
| 286 | 305 | boxList.find(x => x.sName === "右上插位组件"), |
| ... | ... | @@ -301,7 +320,6 @@ const SvgBox = props => { |
| 301 | 320 | viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect); |
| 302 | 321 | viewBoxHeight = Number(headWidth) + Number(orderWidth) + max; |
| 303 | 322 | } |
| 304 | - | |
| 305 | 323 | // 计算缩放比例 |
| 306 | 324 | let scale = 1; |
| 307 | 325 | if (props.showNew === 0) { |
| ... | ... | @@ -313,34 +331,52 @@ const SvgBox = props => { |
| 313 | 331 | ? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale |
| 314 | 332 | : topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; |
| 315 | 333 | let bottom = 0; |
| 334 | + let xSvg = 0; | |
| 316 | 335 | if (Number(svgType) !== 8) { |
| 317 | 336 | bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight); |
| 318 | 337 | } else { |
| 319 | 338 | bottom = bottomOffect(boxList, orderLength, orderWidth); |
| 320 | 339 | } |
| 321 | 340 | if (Number(svgType) === 4) { |
| 322 | - ySvg = ySvg + boxHeight * scale; | |
| 341 | + // ySvg = ySvg + boxHeight * scale; | |
| 323 | 342 | } else if (Number(svgType) === 8) { |
| 324 | 343 | ySvg = topOffect(boxList, headLength, headWidth) * scale; |
| 325 | 344 | } |
| 326 | 345 | ySvg = ySvg + 50 * scale; |
| 327 | - let xSvg = 0; | |
| 346 | + | |
| 328 | 347 | if (Number(svgType) === 7) { |
| 329 | 348 | xSvg = scaledWidth + dZXCW * scale; |
| 330 | 349 | } else if (Number(svgType) === 8) { |
| 331 | 350 | const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; |
| 332 | 351 | // 计算首盒部件与次盒部件尺寸 |
| 333 | 352 | 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; // 根据偏移量统一处理 | |
| 353 | + // 确保 headWidth 和 item?.value 是有效的数字 | |
| 354 | + const headWidthNum = Number(headWidth) || 0; | |
| 355 | + const itemValue = Number(item?.value) || 0; | |
| 356 | + | |
| 357 | + // 确保 item?.type 是数字 | |
| 358 | + const type = Number(item?.type); | |
| 359 | + if (!Number.isFinite(type)) return 0; | |
| 360 | + | |
| 361 | + const key = type - offset; | |
| 362 | + | |
| 363 | + // 使用 switch-case 替代 map | |
| 364 | + switch (key) { | |
| 365 | + case 10001: | |
| 366 | + return headWidthNum + itemValue; | |
| 367 | + case 10002: | |
| 368 | + case 10003: | |
| 369 | + return itemValue; | |
| 370 | + case 10004: | |
| 371 | + return itemValue + headWidthNum * 2; | |
| 372 | + case 10005: | |
| 373 | + return headWidthNum * 2; | |
| 374 | + case 10006: | |
| 375 | + case 10007: | |
| 376 | + return itemValue + headWidthNum; | |
| 377 | + default: | |
| 378 | + return 0; // 默认返回值,避免 unreachable | |
| 379 | + } | |
| 344 | 380 | }; |
| 345 | 381 | const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); |
| 346 | 382 | const topLength = headLength + topLeft; |
| ... | ... | @@ -350,6 +386,8 @@ const SvgBox = props => { |
| 350 | 386 | ); |
| 351 | 387 | const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); |
| 352 | 388 | xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); |
| 389 | + } else if (Number(svgType) === 4) { | |
| 390 | + xSvg = 100 * scale; | |
| 353 | 391 | } else { |
| 354 | 392 | xSvg = zbtb?.value; |
| 355 | 393 | } |
| ... | ... | @@ -367,7 +405,7 @@ const SvgBox = props => { |
| 367 | 405 | scale = 0.5; |
| 368 | 406 | let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; |
| 369 | 407 | if (Number(svgType) === 4) { |
| 370 | - ySvg = ySvg + boxHeight; | |
| 408 | + // ySvg = ySvg + boxHeight; | |
| 371 | 409 | } else if (Number(svgType) === 8) { |
| 372 | 410 | ySvg = topOffect(boxList, headLength, headWidth) * scale; |
| 373 | 411 | } |
| ... | ... | @@ -379,16 +417,33 @@ const SvgBox = props => { |
| 379 | 417 | const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; |
| 380 | 418 | // 计算首盒部件与次盒部件尺寸 |
| 381 | 419 | 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; // 根据偏移量统一处理 | |
| 420 | + // 确保 headWidth 和 item?.value 是有效的数字 | |
| 421 | + const headWidthNum = Number(headWidth) || 0; | |
| 422 | + const itemValue = Number(item?.value) || 0; | |
| 423 | + | |
| 424 | + // 确保 item?.type 是数字 | |
| 425 | + const type = Number(item?.type); | |
| 426 | + if (!Number.isFinite(type)) return 0; | |
| 427 | + | |
| 428 | + const key = type - offset; | |
| 429 | + | |
| 430 | + // 使用 switch-case 替代 map | |
| 431 | + switch (key) { | |
| 432 | + case 10001: | |
| 433 | + return headWidthNum + itemValue; | |
| 434 | + case 10002: | |
| 435 | + case 10003: | |
| 436 | + return itemValue; | |
| 437 | + case 10004: | |
| 438 | + return itemValue + headWidthNum * 2; | |
| 439 | + case 10005: | |
| 440 | + return headWidthNum * 2; | |
| 441 | + case 10006: | |
| 442 | + case 10007: | |
| 443 | + return itemValue + headWidthNum; | |
| 444 | + default: | |
| 445 | + return 0; // 默认返回值,避免 unreachable | |
| 446 | + } | |
| 392 | 447 | }; |
| 393 | 448 | const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); |
| 394 | 449 | const topLength = headLength + topLeft; |
| ... | ... | @@ -398,14 +453,17 @@ const SvgBox = props => { |
| 398 | 453 | ); |
| 399 | 454 | const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect); |
| 400 | 455 | xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength)); |
| 456 | + } else if (Number(svgType) === 4) { | |
| 457 | + xSvg = 100; | |
| 401 | 458 | } else { |
| 402 | 459 | xSvg = zbtb?.value; |
| 403 | 460 | } |
| 461 | + if (!dSvgBoxWidth) { | |
| 462 | + xSvg = viewBoxWidth / 2 + 100 * scale; | |
| 463 | + } | |
| 404 | 464 | svg.setAttribute( |
| 405 | 465 | "viewBox", |
| 406 | - `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ | |
| 407 | - dSvgBoxHeight ? dSvgBoxHeight : 250 | |
| 408 | - }` | |
| 466 | + `${-xSvg} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${dSvgBoxHeight ? dSvgBoxHeight : 250}` | |
| 409 | 467 | ); |
| 410 | 468 | svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`); |
| 411 | 469 | svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`); |
| ... | ... | @@ -413,6 +471,8 @@ const SvgBox = props => { |
| 413 | 471 | svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`; |
| 414 | 472 | } |
| 415 | 473 | } else if (props.showNew === 1) { |
| 474 | + console.log("props.showNew === 1"); | |
| 475 | + | |
| 416 | 476 | let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; |
| 417 | 477 | let leftSize = 0; |
| 418 | 478 | let topSize = 0; |
| ... | ... | @@ -448,16 +508,30 @@ const SvgBox = props => { |
| 448 | 508 | const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; |
| 449 | 509 | // 计算首盒部件与次盒部件尺寸 |
| 450 | 510 | 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; // 根据偏移量统一处理 | |
| 511 | + if (!item) return 0; | |
| 512 | + | |
| 513 | + const type = Number(item.type); | |
| 514 | + const key = type - offset; | |
| 515 | + | |
| 516 | + const headWidthNum = Number(headWidth) || 0; | |
| 517 | + const itemValue = Number(item.value) || 0; | |
| 518 | + | |
| 519 | + switch (key) { | |
| 520 | + case 10001: | |
| 521 | + return headWidthNum + itemValue; | |
| 522 | + case 10002: | |
| 523 | + case 10003: | |
| 524 | + return itemValue; | |
| 525 | + case 10004: | |
| 526 | + return itemValue + headWidthNum * 2; | |
| 527 | + case 10005: | |
| 528 | + return headWidthNum * 2; | |
| 529 | + case 10006: | |
| 530 | + case 10007: | |
| 531 | + return itemValue + headWidthNum; | |
| 532 | + default: | |
| 533 | + return 0; | |
| 534 | + } | |
| 461 | 535 | }; |
| 462 | 536 | const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); |
| 463 | 537 | const topLength = topLeft; |
| ... | ... | @@ -470,6 +544,9 @@ const SvgBox = props => { |
| 470 | 544 | ySvg = topOffect(boxList, headLength, headWidth); |
| 471 | 545 | } else { |
| 472 | 546 | leftSize = zbtb?.value; |
| 547 | + if (zbtb?.type === "8009") { | |
| 548 | + leftSize = (Number(zbtb?.sLength) + Number(zbtb?.cLength) * scale) || 0; | |
| 549 | + } | |
| 473 | 550 | } |
| 474 | 551 | |
| 475 | 552 | svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`); |
| ... | ... | @@ -524,16 +601,27 @@ const SvgBox = props => { |
| 524 | 601 | const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0; |
| 525 | 602 | // 计算首盒部件与次盒部件尺寸 |
| 526 | 603 | 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; // 根据偏移量统一处理 | |
| 604 | + if (!item || !item.type) return 0; | |
| 605 | + | |
| 606 | + const key = item.type - offset; | |
| 607 | + const itemValue = Number(item.value) || 0; | |
| 608 | + | |
| 609 | + switch (key) { | |
| 610 | + case 10001: | |
| 611 | + return headWidth + itemValue; | |
| 612 | + case 10002: | |
| 613 | + case 10003: | |
| 614 | + return itemValue; | |
| 615 | + case 10004: | |
| 616 | + return itemValue + headWidth * 2; | |
| 617 | + case 10005: | |
| 618 | + return headWidth * 2; | |
| 619 | + case 10006: | |
| 620 | + case 10007: | |
| 621 | + return itemValue + headWidth; | |
| 622 | + default: | |
| 623 | + return 0; | |
| 624 | + } | |
| 537 | 625 | }; |
| 538 | 626 | const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件")); |
| 539 | 627 | const topLength = topLeft; |
| ... | ... | @@ -572,11 +660,151 @@ const SvgBox = props => { |
| 572 | 660 | |
| 573 | 661 | let pathList = []; |
| 574 | 662 | // 上方盒舌 |
| 575 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); | |
| 576 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledHeight, -dSFHS * scale, scaledWidth * 2 + scaledHeight * 2, 0)); | |
| 577 | - if (sfhs?.type && dSFHS) { | |
| 578 | - pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 579 | - pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 663 | + if (sfhs?.type && sfhs.type === "1009") { | |
| 664 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs; | |
| 665 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 666 | + const addLayer = params => { | |
| 667 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 668 | + if (type === null) return; | |
| 669 | + | |
| 670 | + if (!quantity) return; | |
| 671 | + | |
| 672 | + const numQuantity = Number(quantity); | |
| 673 | + const totalLength = Number(length) * scale; | |
| 674 | + const totalWidth = Number(width) * scale; | |
| 675 | + const numOffset = Number(offset) * scale; | |
| 676 | + | |
| 677 | + // 选择绘制函数 | |
| 678 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 679 | + | |
| 680 | + let rectangles = []; | |
| 681 | + | |
| 682 | + if (numQuantity === 1) { | |
| 683 | + rectangles = [ | |
| 684 | + { | |
| 685 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth, | |
| 686 | + y: -totalWidth + yExtraOffset, | |
| 687 | + width: totalLength, | |
| 688 | + height: totalWidth, | |
| 689 | + }, | |
| 690 | + ]; | |
| 691 | + } else if (numQuantity === 2) { | |
| 692 | + const halfLength = totalLength; | |
| 693 | + rectangles = [ | |
| 694 | + { | |
| 695 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 696 | + y: -totalWidth + yExtraOffset, | |
| 697 | + width: halfLength, | |
| 698 | + height: totalWidth, | |
| 699 | + }, | |
| 700 | + { | |
| 701 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 702 | + y: -totalWidth + yExtraOffset, | |
| 703 | + width: halfLength, | |
| 704 | + height: totalWidth, | |
| 705 | + }, | |
| 706 | + ]; | |
| 707 | + } | |
| 708 | + | |
| 709 | + rectangles.forEach(rect => { | |
| 710 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 711 | + }); | |
| 712 | + }; | |
| 713 | + const addLayers = params => { | |
| 714 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 715 | + if (type === null) return; | |
| 716 | + | |
| 717 | + if (!quantity) return; | |
| 718 | + | |
| 719 | + const numQuantity = Number(quantity); | |
| 720 | + const totalLength = Number(length) * scale; | |
| 721 | + const totalWidth = Number(width) * scale; | |
| 722 | + const numOffset = Number(offset) * scale; | |
| 723 | + | |
| 724 | + // 选择绘制函数 | |
| 725 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 726 | + | |
| 727 | + let rectangles = []; | |
| 728 | + | |
| 729 | + if (numQuantity === 1) { | |
| 730 | + rectangles = [ | |
| 731 | + { | |
| 732 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledWidth + scaledHeight, | |
| 733 | + y: -totalWidth + yExtraOffset, | |
| 734 | + width: totalLength, | |
| 735 | + height: totalWidth, | |
| 736 | + }, | |
| 737 | + ]; | |
| 738 | + } else if (numQuantity === 2) { | |
| 739 | + const halfLength = totalLength; | |
| 740 | + rectangles = [ | |
| 741 | + { | |
| 742 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledWidth + scaledHeight, | |
| 743 | + y: -totalWidth + yExtraOffset, | |
| 744 | + width: halfLength, | |
| 745 | + height: totalWidth, | |
| 746 | + }, | |
| 747 | + { | |
| 748 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledWidth + scaledHeight, | |
| 749 | + y: -totalWidth + yExtraOffset, | |
| 750 | + width: halfLength, | |
| 751 | + height: totalWidth, | |
| 752 | + }, | |
| 753 | + ]; | |
| 754 | + } | |
| 755 | + | |
| 756 | + rectangles.forEach(rect => { | |
| 757 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 758 | + }); | |
| 759 | + }; | |
| 760 | + // === 绘制 sType 层 === | |
| 761 | + addLayer({ | |
| 762 | + type: sType, | |
| 763 | + length: sLength, | |
| 764 | + width: sWidth, | |
| 765 | + offset: sOffset, | |
| 766 | + quantity: sQuantity, | |
| 767 | + isTrapezoid: Number(sType) !== 0, | |
| 768 | + }); | |
| 769 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 770 | + addLayer({ | |
| 771 | + type: cType, | |
| 772 | + length: cLength, | |
| 773 | + width: cWidth, | |
| 774 | + offset: cOffset, | |
| 775 | + quantity: cQuantity, | |
| 776 | + isTrapezoid: Number(cType) !== 0, | |
| 777 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 778 | + }); | |
| 779 | + addLayers({ | |
| 780 | + type: sType, | |
| 781 | + length: sLength, | |
| 782 | + width: sWidth, | |
| 783 | + offset: sOffset, | |
| 784 | + quantity: sQuantity, | |
| 785 | + isTrapezoid: Number(sType) !== 0, | |
| 786 | + }); | |
| 787 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 788 | + addLayers({ | |
| 789 | + type: cType, | |
| 790 | + length: cLength, | |
| 791 | + width: cWidth, | |
| 792 | + offset: cOffset, | |
| 793 | + quantity: cQuantity, | |
| 794 | + isTrapezoid: Number(cType) !== 0, | |
| 795 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 796 | + }); | |
| 797 | + // 将 group 添加到 svg | |
| 798 | + svg.appendChild(g); | |
| 799 | + } else { | |
| 800 | + // 非 1009 类型的兜底逻辑 | |
| 801 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); | |
| 802 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledHeight, -dSFHS * scale, scaledWidth * 2 + scaledHeight * 2, 0)); | |
| 803 | + | |
| 804 | + if (sfhs?.type && dSFHS) { | |
| 805 | + pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 806 | + pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 807 | + } | |
| 580 | 808 | } |
| 581 | 809 | // 盒底组件 |
| 582 | 810 | if (hdzj && hdzj.type) { |
| ... | ... | @@ -585,38 +813,396 @@ const SvgBox = props => { |
| 585 | 813 | pathList.push(createText(scaledWidth / 2, scaledDeep + (Number(hdzj?.value) / 2) * scales, 10 * scales, Number(hdzj?.value))); |
| 586 | 814 | } else { |
| 587 | 815 | // 下方盒舌 |
| 816 | + if (xfhs?.type && xfhs.type === "2009") { | |
| 817 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs; | |
| 818 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 819 | + const addLayer = params => { | |
| 820 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 821 | + if (type === null) return; | |
| 588 | 822 | |
| 589 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); | |
| 590 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledHeight, dXFHS * scale, scaledWidth * 2 + scaledHeight * 2, scaledDeep)); | |
| 591 | - if (xfhs?.type && dXFHS) { | |
| 592 | - pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); | |
| 593 | - pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); | |
| 823 | + if (!quantity) return; | |
| 824 | + | |
| 825 | + const numQuantity = Number(quantity); | |
| 826 | + const totalLength = Number(length) * scale; | |
| 827 | + const totalWidth = Number(width) * scale; | |
| 828 | + const numOffset = Number(offset) * scale; | |
| 829 | + | |
| 830 | + // 选择绘制函数 | |
| 831 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 832 | + | |
| 833 | + let rectangles = []; | |
| 834 | + | |
| 835 | + if (numQuantity === 1) { | |
| 836 | + rectangles = [ | |
| 837 | + { | |
| 838 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth, | |
| 839 | + y: scaledDeep - yExtraOffset, | |
| 840 | + width: totalLength, | |
| 841 | + height: totalWidth, | |
| 842 | + }, | |
| 843 | + ]; | |
| 844 | + } else if (numQuantity === 2) { | |
| 845 | + const halfLength = totalLength; | |
| 846 | + rectangles = [ | |
| 847 | + { | |
| 848 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 849 | + y: scaledDeep - yExtraOffset, | |
| 850 | + width: halfLength, | |
| 851 | + height: totalWidth, | |
| 852 | + }, | |
| 853 | + { | |
| 854 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 855 | + y: scaledDeep - yExtraOffset, | |
| 856 | + width: halfLength, | |
| 857 | + height: totalWidth, | |
| 858 | + }, | |
| 859 | + ]; | |
| 860 | + } | |
| 861 | + | |
| 862 | + rectangles.forEach(rect => { | |
| 863 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 864 | + }); | |
| 865 | + }; | |
| 866 | + const addLayers = params => { | |
| 867 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 868 | + if (type === null) return; | |
| 869 | + | |
| 870 | + if (!quantity) return; | |
| 871 | + | |
| 872 | + const numQuantity = Number(quantity); | |
| 873 | + const totalLength = Number(length) * scale; | |
| 874 | + const totalWidth = Number(width) * scale; | |
| 875 | + const numOffset = Number(offset) * scale; | |
| 876 | + | |
| 877 | + // 选择绘制函数 | |
| 878 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 879 | + | |
| 880 | + let rectangles = []; | |
| 881 | + | |
| 882 | + if (numQuantity === 1) { | |
| 883 | + rectangles = [ | |
| 884 | + { | |
| 885 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledWidth + scaledHeight, | |
| 886 | + y: scaledDeep - yExtraOffset, | |
| 887 | + width: totalLength, | |
| 888 | + height: totalWidth, | |
| 889 | + }, | |
| 890 | + ]; | |
| 891 | + } else if (numQuantity === 2) { | |
| 892 | + const halfLength = totalLength; | |
| 893 | + rectangles = [ | |
| 894 | + { | |
| 895 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledWidth + scaledHeight, | |
| 896 | + y: scaledDeep - yExtraOffset, | |
| 897 | + width: halfLength, | |
| 898 | + height: totalWidth, | |
| 899 | + }, | |
| 900 | + { | |
| 901 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledWidth + scaledHeight, | |
| 902 | + y: scaledDeep - yExtraOffset, | |
| 903 | + width: halfLength, | |
| 904 | + height: totalWidth, | |
| 905 | + }, | |
| 906 | + ]; | |
| 907 | + } | |
| 908 | + | |
| 909 | + rectangles.forEach(rect => { | |
| 910 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 911 | + }); | |
| 912 | + }; | |
| 913 | + // === 绘制 sType 层 === | |
| 914 | + addLayer({ | |
| 915 | + type: sType, | |
| 916 | + length: sLength, | |
| 917 | + width: sWidth, | |
| 918 | + offset: sOffset, | |
| 919 | + quantity: sQuantity, | |
| 920 | + isTrapezoid: Number(sType) !== 0, | |
| 921 | + }); | |
| 922 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 923 | + addLayer({ | |
| 924 | + type: cType, | |
| 925 | + length: cLength, | |
| 926 | + width: cWidth, | |
| 927 | + offset: cOffset, | |
| 928 | + quantity: cQuantity, | |
| 929 | + isTrapezoid: Number(cType) !== 0, | |
| 930 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 931 | + }); | |
| 932 | + addLayers({ | |
| 933 | + type: sType, | |
| 934 | + length: sLength, | |
| 935 | + width: sWidth, | |
| 936 | + offset: sOffset, | |
| 937 | + quantity: sQuantity, | |
| 938 | + isTrapezoid: Number(sType) !== 0, | |
| 939 | + }); | |
| 940 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 941 | + addLayers({ | |
| 942 | + type: cType, | |
| 943 | + length: cLength, | |
| 944 | + width: cWidth, | |
| 945 | + offset: cOffset, | |
| 946 | + quantity: cQuantity, | |
| 947 | + isTrapezoid: Number(cType) !== 0, | |
| 948 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 949 | + }); | |
| 950 | + // 将 group 添加到 svg | |
| 951 | + svg.appendChild(g); | |
| 952 | + } else { | |
| 953 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); | |
| 954 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledHeight, dXFHS * scale, scaledWidth * 2 + scaledHeight * 2, scaledDeep)); | |
| 955 | + if (xfhs?.type && dXFHS) { | |
| 956 | + pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); | |
| 957 | + pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS)); | |
| 958 | + } | |
| 594 | 959 | } |
| 595 | 960 | } |
| 596 | 961 | |
| 597 | 962 | // 左边贴边 |
| 598 | - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 599 | - if (zbtb?.type && dZTBW) { | |
| 600 | - pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 963 | + if (zbtb?.type === "8009") { | |
| 964 | + // 先放层1的盒型 | |
| 965 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb; | |
| 966 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 967 | + const addLayer = params => { | |
| 968 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 969 | + if (type === null) return; | |
| 970 | + if (!quantity) return; | |
| 971 | + | |
| 972 | + const numQuantity = Number(quantity); | |
| 973 | + const totalLength = Number(length) * scale; | |
| 974 | + const totalWidth = Number(width) * scale; | |
| 975 | + const numOffset = Number(offset) * scale; | |
| 976 | + | |
| 977 | + // 选择绘制函数 | |
| 978 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 979 | + | |
| 980 | + let rectangles = []; | |
| 981 | + | |
| 982 | + if (numQuantity === 1) { | |
| 983 | + rectangles = [ | |
| 984 | + { | |
| 985 | + x: -totalLength - yExtraOffset, | |
| 986 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 987 | + width: totalLength, | |
| 988 | + height: totalWidth, | |
| 989 | + }, | |
| 990 | + ]; | |
| 991 | + } else if (numQuantity === 2) { | |
| 992 | + const halfLength = totalLength; | |
| 993 | + const halfWidth = totalWidth * 2; | |
| 994 | + rectangles = [ | |
| 995 | + { | |
| 996 | + x: -totalLength - yExtraOffset, | |
| 997 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 998 | + width: halfLength, | |
| 999 | + height: totalWidth, | |
| 1000 | + }, | |
| 1001 | + { | |
| 1002 | + x: -totalLength - yExtraOffset, | |
| 1003 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 1004 | + width: halfLength, | |
| 1005 | + height: totalWidth, | |
| 1006 | + }, | |
| 1007 | + ]; | |
| 1008 | + } | |
| 1009 | + | |
| 1010 | + rectangles.forEach(rect => { | |
| 1011 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1012 | + }); | |
| 1013 | + }; | |
| 1014 | + | |
| 1015 | + // === 绘制 sType 层 === | |
| 1016 | + addLayer({ | |
| 1017 | + type: sType, | |
| 1018 | + length: sLength, | |
| 1019 | + width: sWidth, | |
| 1020 | + offset: sOffset, | |
| 1021 | + quantity: sQuantity, | |
| 1022 | + isTrapezoid: Number(sType) !== 0, | |
| 1023 | + }); | |
| 1024 | + | |
| 1025 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1026 | + addLayer({ | |
| 1027 | + type: cType, | |
| 1028 | + length: cLength, | |
| 1029 | + width: cWidth, | |
| 1030 | + offset: cOffset, | |
| 1031 | + quantity: cQuantity, | |
| 1032 | + isTrapezoid: Number(cType) !== 0, | |
| 1033 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 1034 | + }); | |
| 1035 | + | |
| 1036 | + // 将分组添加到 SVG | |
| 1037 | + svg.appendChild(g); | |
| 1038 | + } else { | |
| 1039 | + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 1040 | + if (zbtb?.type && dZTBW) { | |
| 1041 | + pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 1042 | + } | |
| 601 | 1043 | } |
| 602 | 1044 | // 右边贴边 |
| 1045 | + if (ybtb?.type === "9009") { | |
| 1046 | + // 先放层1的盒型 | |
| 1047 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 1048 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1049 | + const addLayer = params => { | |
| 1050 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1051 | + if (type === null) return; | |
| 1052 | + | |
| 1053 | + if (!quantity) return; | |
| 1054 | + | |
| 1055 | + const numQuantity = Number(quantity); | |
| 1056 | + const totalLength = Number(length) * scale; | |
| 1057 | + const totalWidth = Number(width) * scale; | |
| 1058 | + const numOffset = Number(offset) * scale; | |
| 1059 | + | |
| 1060 | + // 选择绘制函数 | |
| 1061 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 1062 | + | |
| 1063 | + let rectangles = []; | |
| 1064 | + | |
| 1065 | + if (numQuantity === 1) { | |
| 1066 | + rectangles = [ | |
| 1067 | + { | |
| 1068 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 1069 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 1070 | + width: totalLength, | |
| 1071 | + height: totalWidth, | |
| 1072 | + }, | |
| 1073 | + ]; | |
| 1074 | + } else if (numQuantity === 2) { | |
| 1075 | + const halfLength = totalLength; | |
| 1076 | + const halfWidth = totalWidth * 2; | |
| 1077 | + rectangles = [ | |
| 1078 | + { | |
| 1079 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 1080 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 1081 | + width: halfLength, | |
| 1082 | + height: totalWidth, | |
| 1083 | + }, | |
| 1084 | + { | |
| 1085 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 1086 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 1087 | + width: halfLength, | |
| 1088 | + height: totalWidth, | |
| 1089 | + }, | |
| 1090 | + ]; | |
| 1091 | + } | |
| 1092 | + | |
| 1093 | + rectangles.forEach(rect => { | |
| 1094 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1095 | + }); | |
| 1096 | + }; | |
| 1097 | + | |
| 1098 | + // === 绘制 sType 层 === | |
| 1099 | + addLayer({ | |
| 1100 | + type: sType, | |
| 1101 | + length: sLength, | |
| 1102 | + width: sWidth, | |
| 1103 | + offset: sOffset, | |
| 1104 | + quantity: sQuantity, | |
| 1105 | + isTrapezoid: Number(sType) !== 0, | |
| 1106 | + }); | |
| 603 | 1107 | |
| 604 | - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); | |
| 605 | - if (ybtb?.type && dYTBW) { | |
| 606 | - pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 1108 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1109 | + addLayer({ | |
| 1110 | + type: cType, | |
| 1111 | + length: cLength, | |
| 1112 | + width: cWidth, | |
| 1113 | + offset: cOffset, | |
| 1114 | + quantity: cQuantity, | |
| 1115 | + isTrapezoid: Number(cType) !== 0, | |
| 1116 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 1117 | + }); | |
| 1118 | + | |
| 1119 | + // 将分组添加到 SVG | |
| 1120 | + svg.appendChild(g); | |
| 1121 | + } else { | |
| 1122 | + pathList.push( | |
| 1123 | + createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale) | |
| 1124 | + ); | |
| 1125 | + if (ybtb?.type && dYTBW) { | |
| 1126 | + pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 1127 | + } | |
| 607 | 1128 | } |
| 608 | 1129 | // 左上部件 |
| 609 | 1130 | if (zsbj?.type && zsbj?.type === "3009") { |
| 610 | - console.log(zsbj, boxList, "zsbj"); | |
| 611 | 1131 | // 先放层1的盒型 |
| 612 | 1132 | const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj; |
| 613 | - if (Number(sType) === 0) { | |
| 614 | - const rectangles = [{ x: -sLength * scale, y: ((scaledDeep - (Number(sWidth) * scale)) / 2) + Number(sOffset), width: sLength * scale, height: sWidth * scale }]; | |
| 1133 | + | |
| 1134 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1135 | + const addLayer = params => { | |
| 1136 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1137 | + if (type === null) return; | |
| 1138 | + | |
| 1139 | + if (!quantity) return; | |
| 1140 | + | |
| 1141 | + const numQuantity = Number(quantity); | |
| 1142 | + const totalLength = Number(length) * scale; | |
| 1143 | + const totalWidth = Number(width) * scale; | |
| 1144 | + const numOffset = Number(offset) * scale; | |
| 1145 | + | |
| 1146 | + // 选择绘制函数 | |
| 1147 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1148 | + | |
| 1149 | + let rectangles = []; | |
| 1150 | + | |
| 1151 | + if (numQuantity === 1) { | |
| 1152 | + rectangles = [ | |
| 1153 | + { | |
| 1154 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 1155 | + y: -totalWidth + yExtraOffset, | |
| 1156 | + width: totalLength, | |
| 1157 | + height: totalWidth, | |
| 1158 | + }, | |
| 1159 | + ]; | |
| 1160 | + } else if (numQuantity === 2) { | |
| 1161 | + const halfLength = totalLength; | |
| 1162 | + rectangles = [ | |
| 1163 | + { | |
| 1164 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 1165 | + y: -totalWidth + yExtraOffset, | |
| 1166 | + width: halfLength, | |
| 1167 | + height: totalWidth, | |
| 1168 | + }, | |
| 1169 | + { | |
| 1170 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 1171 | + y: -totalWidth + yExtraOffset, | |
| 1172 | + width: halfLength, | |
| 1173 | + height: totalWidth, | |
| 1174 | + }, | |
| 1175 | + ]; | |
| 1176 | + } | |
| 1177 | + | |
| 615 | 1178 | rectangles.forEach(rect => { |
| 616 | - g.appendChild(createPathElements(rect.x, rect.y, rect.width, rect.height)); | |
| 1179 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 617 | 1180 | }); |
| 618 | - svg.appendChild(g); | |
| 619 | - } | |
| 1181 | + }; | |
| 1182 | + | |
| 1183 | + // === 绘制 sType 层 === | |
| 1184 | + addLayer({ | |
| 1185 | + type: sType, | |
| 1186 | + length: sLength, | |
| 1187 | + width: sWidth, | |
| 1188 | + offset: sOffset, | |
| 1189 | + quantity: sQuantity, | |
| 1190 | + isTrapezoid: Number(sType) !== 0, | |
| 1191 | + }); | |
| 1192 | + | |
| 1193 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1194 | + addLayer({ | |
| 1195 | + type: cType, | |
| 1196 | + length: cLength, | |
| 1197 | + width: cWidth, | |
| 1198 | + offset: cOffset, | |
| 1199 | + quantity: cQuantity, | |
| 1200 | + isTrapezoid: Number(cType) !== 0, | |
| 1201 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 1202 | + }); | |
| 1203 | + | |
| 1204 | + // 将分组添加到 SVG | |
| 1205 | + svg.appendChild(g); | |
| 620 | 1206 | } else { |
| 621 | 1207 | pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); |
| 622 | 1208 | if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { |
| ... | ... | @@ -645,95 +1231,337 @@ const SvgBox = props => { |
| 645 | 1231 | } |
| 646 | 1232 | |
| 647 | 1233 | // 右上部件 |
| 648 | - pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); | |
| 649 | - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 650 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 651 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 652 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 653 | - } else if (ysbj?.type === "6002" && dYSCW) { | |
| 654 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 655 | - } else if (ysbj?.type === "6003" && dYSCW) { | |
| 656 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 657 | - } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 658 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 659 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 660 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 661 | - pathList.push( | |
| 662 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 663 | - ); | |
| 664 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 665 | - } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 666 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 667 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 668 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 669 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 670 | - } else if (ysbj?.type && dYSCW) { | |
| 671 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1234 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 1235 | + // 先放层1的盒型 | |
| 1236 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj; | |
| 1237 | + | |
| 1238 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1239 | + const addLayer = params => { | |
| 1240 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1241 | + if (type === null) return; | |
| 1242 | + | |
| 1243 | + if (!quantity) return; | |
| 1244 | + | |
| 1245 | + const numQuantity = Number(quantity); | |
| 1246 | + const totalLength = Number(length) * scale; | |
| 1247 | + const totalWidth = Number(width) * scale; | |
| 1248 | + const numOffset = Number(offset) * scale; | |
| 1249 | + | |
| 1250 | + // 选择绘制函数 | |
| 1251 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1252 | + | |
| 1253 | + let rectangles = []; | |
| 1254 | + | |
| 1255 | + if (numQuantity === 1) { | |
| 1256 | + rectangles = [ | |
| 1257 | + { | |
| 1258 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth, | |
| 1259 | + y: -totalWidth + yExtraOffset, | |
| 1260 | + width: totalLength, | |
| 1261 | + height: totalWidth, | |
| 1262 | + }, | |
| 1263 | + ]; | |
| 1264 | + } else if (numQuantity === 2) { | |
| 1265 | + const halfLength = totalLength; | |
| 1266 | + rectangles = [ | |
| 1267 | + { | |
| 1268 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth, | |
| 1269 | + y: -totalWidth + yExtraOffset, | |
| 1270 | + width: halfLength, | |
| 1271 | + height: totalWidth, | |
| 1272 | + }, | |
| 1273 | + { | |
| 1274 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth, | |
| 1275 | + y: -totalWidth + yExtraOffset, | |
| 1276 | + width: halfLength, | |
| 1277 | + height: totalWidth, | |
| 1278 | + }, | |
| 1279 | + ]; | |
| 1280 | + } | |
| 1281 | + | |
| 1282 | + rectangles.forEach(rect => { | |
| 1283 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1284 | + }); | |
| 1285 | + }; | |
| 1286 | + | |
| 1287 | + // === 绘制 sType 层 === | |
| 1288 | + addLayer({ | |
| 1289 | + type: sType, | |
| 1290 | + length: sLength, | |
| 1291 | + width: sWidth, | |
| 1292 | + offset: sOffset, | |
| 1293 | + quantity: sQuantity, | |
| 1294 | + isTrapezoid: Number(sType) !== 0, | |
| 1295 | + }); | |
| 1296 | + | |
| 1297 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1298 | + addLayer({ | |
| 1299 | + type: cType, | |
| 1300 | + length: cLength, | |
| 1301 | + width: cWidth, | |
| 1302 | + offset: cOffset, | |
| 1303 | + quantity: cQuantity, | |
| 1304 | + isTrapezoid: Number(cType) !== 0, | |
| 1305 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 1306 | + }); | |
| 1307 | + | |
| 1308 | + // 将分组添加到 SVG | |
| 1309 | + svg.appendChild(g); | |
| 1310 | + } else { | |
| 1311 | + // 右上部件 | |
| 1312 | + pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); | |
| 1313 | + if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 1314 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 1315 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1316 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 1317 | + } else if (ysbj?.type === "6002" && dYSCW) { | |
| 1318 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1319 | + } else if (ysbj?.type === "6003" && dYSCW) { | |
| 1320 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1321 | + } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 1322 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 1323 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1324 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 1325 | + pathList.push( | |
| 1326 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 1327 | + ); | |
| 1328 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1329 | + } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 1330 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 1331 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1332 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 1333 | + pathList.push( | |
| 1334 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 1335 | + ); | |
| 1336 | + } else if (ysbj?.type && dYSCW) { | |
| 1337 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1338 | + } | |
| 672 | 1339 | } |
| 1340 | + | |
| 673 | 1341 | // 左下部件- |
| 674 | 1342 | |
| 675 | 1343 | if (!(hdzj && hdzj.type)) { |
| 676 | - pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); | |
| 677 | - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 678 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 679 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 680 | - pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 681 | - } else if (zxbj?.type === "4002" && dZXCW) { | |
| 682 | - pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 683 | - } else if (zxbj?.type === "4003" && dZXCW) { | |
| 684 | - pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 685 | - } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 686 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 687 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 688 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 689 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 690 | - pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 691 | - } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 692 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 693 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 694 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 695 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 696 | - } else if (zxbj?.type && dZXCW) { | |
| 697 | - pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1344 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 1345 | + // 先放层1的盒型 | |
| 1346 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 1347 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1348 | + const addLayer = params => { | |
| 1349 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1350 | + if (type === null) return; | |
| 1351 | + | |
| 1352 | + if (!quantity) return; | |
| 1353 | + | |
| 1354 | + const numQuantity = Number(quantity); | |
| 1355 | + const totalLength = Number(length) * scale; | |
| 1356 | + const totalWidth = Number(width) * scale; | |
| 1357 | + const numOffset = Number(offset) * scale; | |
| 1358 | + | |
| 1359 | + // 选择绘制函数 | |
| 1360 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1361 | + | |
| 1362 | + let rectangles = []; | |
| 1363 | + | |
| 1364 | + if (numQuantity === 1) { | |
| 1365 | + rectangles = [ | |
| 1366 | + { | |
| 1367 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 1368 | + y: scaledDeep - yExtraOffset, | |
| 1369 | + width: totalLength, | |
| 1370 | + height: totalWidth, | |
| 1371 | + }, | |
| 1372 | + ]; | |
| 1373 | + } else if (numQuantity === 2) { | |
| 1374 | + const halfLength = totalLength; | |
| 1375 | + rectangles = [ | |
| 1376 | + { | |
| 1377 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 1378 | + y: scaledDeep - yExtraOffset, | |
| 1379 | + width: halfLength, | |
| 1380 | + height: totalWidth, | |
| 1381 | + }, | |
| 1382 | + { | |
| 1383 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 1384 | + y: scaledDeep - yExtraOffset, | |
| 1385 | + width: halfLength, | |
| 1386 | + height: totalWidth, | |
| 1387 | + }, | |
| 1388 | + ]; | |
| 1389 | + } | |
| 1390 | + | |
| 1391 | + rectangles.forEach(rect => { | |
| 1392 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1393 | + }); | |
| 1394 | + }; | |
| 1395 | + | |
| 1396 | + // === 绘制 sType 层 === | |
| 1397 | + addLayer({ | |
| 1398 | + type: sType, | |
| 1399 | + length: sLength, | |
| 1400 | + width: sWidth, | |
| 1401 | + offset: sOffset, | |
| 1402 | + quantity: sQuantity, | |
| 1403 | + isTrapezoid: Number(sType) !== 0, | |
| 1404 | + }); | |
| 1405 | + | |
| 1406 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1407 | + addLayer({ | |
| 1408 | + type: cType, | |
| 1409 | + length: cLength, | |
| 1410 | + width: cWidth, | |
| 1411 | + offset: cOffset, | |
| 1412 | + quantity: cQuantity, | |
| 1413 | + isTrapezoid: Number(cType) !== 0, | |
| 1414 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 1415 | + }); | |
| 1416 | + | |
| 1417 | + // 将分组添加到 SVG | |
| 1418 | + svg.appendChild(g); | |
| 1419 | + } else { | |
| 1420 | + pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); | |
| 1421 | + if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 1422 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 1423 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1424 | + pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1425 | + } else if (zxbj?.type === "4002" && dZXCW) { | |
| 1426 | + pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1427 | + } else if (zxbj?.type === "4003" && dZXCW) { | |
| 1428 | + pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1429 | + } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 1430 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 1431 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1432 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 1433 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 1434 | + pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1435 | + } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 1436 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 1437 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1438 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 1439 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 1440 | + } else if (zxbj?.type && dZXCW) { | |
| 1441 | + pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1442 | + } | |
| 698 | 1443 | } |
| 699 | 1444 | } |
| 1445 | + // 右下部件 | |
| 700 | 1446 | if (!(hdzj && hdzj.type)) { |
| 701 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep)); | |
| 702 | - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 703 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 704 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 705 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW)); | |
| 706 | - } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 707 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 708 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 709 | - pathList.push( | |
| 710 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 711 | - ); | |
| 712 | - pathList.push( | |
| 713 | - createText( | |
| 714 | - scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, | |
| 715 | - scaledDeep + (scaledHeight + scaledHeight / 2), | |
| 716 | - 10 * scales, | |
| 717 | - "W" | |
| 718 | - ) | |
| 719 | - ); | |
| 720 | - pathList.push( | |
| 721 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW) | |
| 722 | - ); | |
| 723 | - } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 724 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 725 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 726 | - pathList.push( | |
| 727 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 728 | - ); | |
| 729 | - pathList.push( | |
| 730 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 731 | - ); | |
| 732 | - } else if (dYXCW && yxbj?.type) { | |
| 733 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 1447 | + if (yxbj?.type && yxbj?.type === "7009") { | |
| 1448 | + // 先放层1的盒型 | |
| 1449 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj; | |
| 1450 | + | |
| 1451 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1452 | + const addLayer = params => { | |
| 1453 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1454 | + if (type === null) return; | |
| 1455 | + | |
| 1456 | + if (!quantity) return; | |
| 1457 | + | |
| 1458 | + const numQuantity = Number(quantity); | |
| 1459 | + const totalLength = Number(length) * scale; | |
| 1460 | + const totalWidth = Number(width) * scale; | |
| 1461 | + const numOffset = Number(offset) * scale; | |
| 1462 | + | |
| 1463 | + // 选择绘制函数 | |
| 1464 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1465 | + | |
| 1466 | + let rectangles = []; | |
| 1467 | + | |
| 1468 | + if (numQuantity === 1) { | |
| 1469 | + rectangles = [ | |
| 1470 | + { | |
| 1471 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth, | |
| 1472 | + y: scaledDeep - yExtraOffset, | |
| 1473 | + width: totalLength, | |
| 1474 | + height: totalWidth, | |
| 1475 | + }, | |
| 1476 | + ]; | |
| 1477 | + } else if (numQuantity === 2) { | |
| 1478 | + const halfLength = totalLength; | |
| 1479 | + rectangles = [ | |
| 1480 | + { | |
| 1481 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth, | |
| 1482 | + y: scaledDeep - yExtraOffset, | |
| 1483 | + width: halfLength, | |
| 1484 | + height: totalWidth, | |
| 1485 | + }, | |
| 1486 | + { | |
| 1487 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth, | |
| 1488 | + y: scaledDeep - yExtraOffset, | |
| 1489 | + width: halfLength, | |
| 1490 | + height: totalWidth, | |
| 1491 | + }, | |
| 1492 | + ]; | |
| 1493 | + } | |
| 1494 | + | |
| 1495 | + rectangles.forEach(rect => { | |
| 1496 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1497 | + }); | |
| 1498 | + }; | |
| 1499 | + | |
| 1500 | + // === 绘制 sType 层 === | |
| 1501 | + addLayer({ | |
| 1502 | + type: sType, | |
| 1503 | + length: sLength, | |
| 1504 | + width: sWidth, | |
| 1505 | + offset: sOffset, | |
| 1506 | + quantity: sQuantity, | |
| 1507 | + isTrapezoid: Number(sType) !== 0, | |
| 1508 | + }); | |
| 1509 | + | |
| 1510 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1511 | + addLayer({ | |
| 1512 | + type: cType, | |
| 1513 | + length: cLength, | |
| 1514 | + width: cWidth, | |
| 1515 | + offset: cOffset, | |
| 1516 | + quantity: cQuantity, | |
| 1517 | + isTrapezoid: Number(cType) !== 0, | |
| 1518 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 1519 | + }); | |
| 1520 | + | |
| 1521 | + // 将分组添加到 SVG | |
| 1522 | + svg.appendChild(g); | |
| 1523 | + } else { | |
| 1524 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep)); | |
| 1525 | + if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 1526 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 1527 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1528 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW)); | |
| 1529 | + } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 1530 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 1531 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1532 | + pathList.push( | |
| 1533 | + createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 1534 | + ); | |
| 1535 | + pathList.push( | |
| 1536 | + createText( | |
| 1537 | + scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, | |
| 1538 | + scaledDeep + (scaledHeight + scaledHeight / 2), | |
| 1539 | + 10 * scales, | |
| 1540 | + "W" | |
| 1541 | + ) | |
| 1542 | + ); | |
| 1543 | + pathList.push( | |
| 1544 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW) | |
| 1545 | + ); | |
| 1546 | + } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 1547 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 1548 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 1549 | + pathList.push( | |
| 1550 | + createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 1551 | + ); | |
| 1552 | + pathList.push( | |
| 1553 | + createText( | |
| 1554 | + scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, | |
| 1555 | + scaledDeep + (scaledHeight + scaledHeight / 2), | |
| 1556 | + 10 * scales, | |
| 1557 | + "W" | |
| 1558 | + ) | |
| 1559 | + ); | |
| 1560 | + } else if (dYXCW && yxbj?.type) { | |
| 1561 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 1562 | + } | |
| 734 | 1563 | } |
| 735 | 1564 | } |
| 736 | - // 右下部件 | |
| 737 | 1565 | |
| 738 | 1566 | // 纵向 D |
| 739 | 1567 | if (scaledDeep && scaledWidth && scaledHeight) { |
| ... | ... | @@ -764,116 +1592,741 @@ const SvgBox = props => { |
| 764 | 1592 | svg.appendChild(g); |
| 765 | 1593 | let pathList = []; |
| 766 | 1594 | // 上方盒舌 |
| 767 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); | |
| 768 | - if (sfhs?.type && dSFHS) { | |
| 769 | - pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1595 | + if (sfhs?.type && sfhs.type === "1009") { | |
| 1596 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs; | |
| 1597 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 1598 | + const addLayer = params => { | |
| 1599 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1600 | + if (type === null) return; | |
| 1601 | + if (!quantity) return; | |
| 1602 | + | |
| 1603 | + const numQuantity = Number(quantity); | |
| 1604 | + const totalLength = Number(length) * scale; | |
| 1605 | + const totalWidth = Number(width) * scale; | |
| 1606 | + const numOffset = Number(offset) * scale; | |
| 1607 | + | |
| 1608 | + // 选择绘制函数 | |
| 1609 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1610 | + | |
| 1611 | + let rectangles = []; | |
| 1612 | + | |
| 1613 | + if (numQuantity === 1) { | |
| 1614 | + rectangles = [ | |
| 1615 | + { | |
| 1616 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth, | |
| 1617 | + y: -totalWidth + yExtraOffset, | |
| 1618 | + width: totalLength, | |
| 1619 | + height: totalWidth, | |
| 1620 | + }, | |
| 1621 | + ]; | |
| 1622 | + } else if (numQuantity === 2) { | |
| 1623 | + const halfLength = totalLength; | |
| 1624 | + rectangles = [ | |
| 1625 | + { | |
| 1626 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 1627 | + y: -totalWidth + yExtraOffset, | |
| 1628 | + width: halfLength, | |
| 1629 | + height: totalWidth, | |
| 1630 | + }, | |
| 1631 | + { | |
| 1632 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 1633 | + y: -totalWidth + yExtraOffset, | |
| 1634 | + width: halfLength, | |
| 1635 | + height: totalWidth, | |
| 1636 | + }, | |
| 1637 | + ]; | |
| 1638 | + } | |
| 1639 | + | |
| 1640 | + rectangles.forEach(rect => { | |
| 1641 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1642 | + }); | |
| 1643 | + }; | |
| 1644 | + // === 绘制 sType 层 === | |
| 1645 | + addLayer({ | |
| 1646 | + type: sType, | |
| 1647 | + length: sLength, | |
| 1648 | + width: sWidth, | |
| 1649 | + offset: sOffset, | |
| 1650 | + quantity: sQuantity, | |
| 1651 | + isTrapezoid: Number(sType) !== 0, | |
| 1652 | + }); | |
| 1653 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 1654 | + addLayer({ | |
| 1655 | + type: cType, | |
| 1656 | + length: cLength, | |
| 1657 | + width: cWidth, | |
| 1658 | + offset: cOffset, | |
| 1659 | + quantity: cQuantity, | |
| 1660 | + isTrapezoid: Number(cType) !== 0, | |
| 1661 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 1662 | + }); | |
| 1663 | + // 将 group 添加到 svg | |
| 1664 | + svg.appendChild(g); | |
| 1665 | + } else { | |
| 1666 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0)); | |
| 1667 | + if (sfhs?.type && dSFHS) { | |
| 1668 | + pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1669 | + } | |
| 770 | 1670 | } |
| 1671 | + | |
| 771 | 1672 | // 下方盒舌 |
| 772 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); | |
| 773 | - if (xfhs?.type && dXFHS) { | |
| 774 | - pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1673 | + if (xfhs?.type && xfhs.type === "2009") { | |
| 1674 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs; | |
| 1675 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 1676 | + const addLayer = params => { | |
| 1677 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1678 | + if (type === null) return; | |
| 1679 | + if (!quantity) return; | |
| 1680 | + | |
| 1681 | + const numQuantity = Number(quantity); | |
| 1682 | + const totalLength = Number(length) * scale; | |
| 1683 | + const totalWidth = Number(width) * scale; | |
| 1684 | + const numOffset = Number(offset) * scale; | |
| 1685 | + | |
| 1686 | + // 选择绘制函数 | |
| 1687 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1688 | + | |
| 1689 | + let rectangles = []; | |
| 1690 | + | |
| 1691 | + if (numQuantity === 1) { | |
| 1692 | + rectangles = [ | |
| 1693 | + { | |
| 1694 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth, | |
| 1695 | + y: scaledDeep - yExtraOffset, | |
| 1696 | + width: totalLength, | |
| 1697 | + height: totalWidth, | |
| 1698 | + }, | |
| 1699 | + ]; | |
| 1700 | + } else if (numQuantity === 2) { | |
| 1701 | + const halfLength = totalLength; | |
| 1702 | + rectangles = [ | |
| 1703 | + { | |
| 1704 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 1705 | + y: scaledDeep - yExtraOffset, | |
| 1706 | + width: halfLength, | |
| 1707 | + height: totalWidth, | |
| 1708 | + }, | |
| 1709 | + { | |
| 1710 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 1711 | + y: scaledDeep - yExtraOffset, | |
| 1712 | + width: halfLength, | |
| 1713 | + height: totalWidth, | |
| 1714 | + }, | |
| 1715 | + ]; | |
| 1716 | + } | |
| 1717 | + | |
| 1718 | + rectangles.forEach(rect => { | |
| 1719 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1720 | + }); | |
| 1721 | + }; | |
| 1722 | + addLayer({ | |
| 1723 | + type: sType, | |
| 1724 | + length: sLength, | |
| 1725 | + width: sWidth, | |
| 1726 | + offset: sOffset, | |
| 1727 | + quantity: sQuantity, | |
| 1728 | + isTrapezoid: Number(sType) !== 0, | |
| 1729 | + }); | |
| 1730 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 1731 | + addLayer({ | |
| 1732 | + type: cType, | |
| 1733 | + length: cLength, | |
| 1734 | + width: cWidth, | |
| 1735 | + offset: cOffset, | |
| 1736 | + quantity: cQuantity, | |
| 1737 | + isTrapezoid: Number(cType) !== 0, | |
| 1738 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 1739 | + }); | |
| 1740 | + // 将 group 添加到 svg | |
| 1741 | + svg.appendChild(g); | |
| 1742 | + } else { | |
| 1743 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep)); | |
| 1744 | + if (xfhs?.type && dXFHS) { | |
| 1745 | + pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1746 | + } | |
| 775 | 1747 | } |
| 1748 | + | |
| 776 | 1749 | // 左边贴边 |
| 777 | - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 778 | - if (zbtb?.type && dZTBW) { | |
| 779 | - pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 1750 | + if (zbtb?.type === "8009") { | |
| 1751 | + // 先放层1的盒型 | |
| 1752 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb; | |
| 1753 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1754 | + const addLayer = params => { | |
| 1755 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1756 | + if (type === null) return; | |
| 1757 | + if (!quantity) return; | |
| 1758 | + | |
| 1759 | + const numQuantity = Number(quantity); | |
| 1760 | + const totalLength = Number(length) * scale; | |
| 1761 | + const totalWidth = Number(width) * scale; | |
| 1762 | + const numOffset = Number(offset) * scale; | |
| 1763 | + | |
| 1764 | + // 选择绘制函数 | |
| 1765 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 1766 | + | |
| 1767 | + let rectangles = []; | |
| 1768 | + | |
| 1769 | + if (numQuantity === 1) { | |
| 1770 | + rectangles = [ | |
| 1771 | + { | |
| 1772 | + x: -totalLength - yExtraOffset, | |
| 1773 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 1774 | + width: totalLength, | |
| 1775 | + height: totalWidth, | |
| 1776 | + }, | |
| 1777 | + ]; | |
| 1778 | + } else if (numQuantity === 2) { | |
| 1779 | + const halfLength = totalLength; | |
| 1780 | + const halfWidth = totalWidth * 2; | |
| 1781 | + rectangles = [ | |
| 1782 | + { | |
| 1783 | + x: -totalLength - yExtraOffset, | |
| 1784 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 1785 | + width: halfLength, | |
| 1786 | + height: totalWidth, | |
| 1787 | + }, | |
| 1788 | + { | |
| 1789 | + x: -totalLength - yExtraOffset, | |
| 1790 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 1791 | + width: halfLength, | |
| 1792 | + height: totalWidth, | |
| 1793 | + }, | |
| 1794 | + ]; | |
| 1795 | + } | |
| 1796 | + | |
| 1797 | + rectangles.forEach(rect => { | |
| 1798 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1799 | + }); | |
| 1800 | + }; | |
| 1801 | + | |
| 1802 | + // === 绘制 sType 层 === | |
| 1803 | + addLayer({ | |
| 1804 | + type: sType, | |
| 1805 | + length: sLength, | |
| 1806 | + width: sWidth, | |
| 1807 | + offset: sOffset, | |
| 1808 | + quantity: sQuantity, | |
| 1809 | + isTrapezoid: Number(sType) !== 0, | |
| 1810 | + }); | |
| 1811 | + | |
| 1812 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1813 | + addLayer({ | |
| 1814 | + type: cType, | |
| 1815 | + length: cLength, | |
| 1816 | + width: cWidth, | |
| 1817 | + offset: cOffset, | |
| 1818 | + quantity: cQuantity, | |
| 1819 | + isTrapezoid: Number(cType) !== 0, | |
| 1820 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 1821 | + }); | |
| 1822 | + | |
| 1823 | + // 将分组添加到 SVG | |
| 1824 | + svg.appendChild(g); | |
| 1825 | + } else { | |
| 1826 | + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 1827 | + if (zbtb?.type && dZTBW) { | |
| 1828 | + pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 1829 | + } | |
| 780 | 1830 | } |
| 1831 | + | |
| 781 | 1832 | // 右边贴边 |
| 782 | - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale)); | |
| 783 | - if (zbtb?.type && dYTBW) { | |
| 784 | - pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 785 | - } | |
| 786 | - // 左上部件 | |
| 787 | - pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); | |
| 788 | - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 789 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 790 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 791 | - pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 792 | - } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 793 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 794 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 795 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 796 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 797 | - pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 798 | - } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 799 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 800 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 801 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 802 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 803 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 804 | - } else if (zsbj?.type && dZSCW) { | |
| 805 | - pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); | |
| 806 | - } | |
| 807 | - // 右上部件 | |
| 808 | - pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); | |
| 809 | - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 810 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 811 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 812 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 813 | - } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 814 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 815 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 816 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 817 | - pathList.push( | |
| 818 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 819 | - ); | |
| 820 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 821 | - } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 822 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 823 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 824 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 825 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 826 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 827 | - } else if (ysbj?.type && dYSCW) { | |
| 828 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1833 | + if (ybtb?.type === "9009") { | |
| 1834 | + // 先放层1的盒型 | |
| 1835 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 1836 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1837 | + const addLayer = params => { | |
| 1838 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1839 | + if (type === null) return; | |
| 1840 | + | |
| 1841 | + if (!quantity) return; | |
| 1842 | + | |
| 1843 | + const numQuantity = Number(quantity); | |
| 1844 | + const totalLength = Number(length) * scale; | |
| 1845 | + const totalWidth = Number(width) * scale; | |
| 1846 | + const numOffset = Number(offset) * scale; | |
| 1847 | + | |
| 1848 | + // 选择绘制函数 | |
| 1849 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 1850 | + | |
| 1851 | + let rectangles = []; | |
| 1852 | + | |
| 1853 | + if (numQuantity === 1) { | |
| 1854 | + rectangles = [ | |
| 1855 | + { | |
| 1856 | + x: scaledWidth * 2 + scaledHeight + yExtraOffset, | |
| 1857 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 1858 | + width: totalLength, | |
| 1859 | + height: totalWidth, | |
| 1860 | + }, | |
| 1861 | + ]; | |
| 1862 | + } else if (numQuantity === 2) { | |
| 1863 | + const halfLength = totalLength; | |
| 1864 | + const halfWidth = totalWidth * 2; | |
| 1865 | + rectangles = [ | |
| 1866 | + { | |
| 1867 | + x: scaledWidth * 2 + scaledHeight + yExtraOffset, | |
| 1868 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 1869 | + width: halfLength, | |
| 1870 | + height: totalWidth, | |
| 1871 | + }, | |
| 1872 | + { | |
| 1873 | + x: scaledWidth * 2 + scaledHeight + yExtraOffset, | |
| 1874 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 1875 | + width: halfLength, | |
| 1876 | + height: totalWidth, | |
| 1877 | + }, | |
| 1878 | + ]; | |
| 1879 | + } | |
| 1880 | + | |
| 1881 | + rectangles.forEach(rect => { | |
| 1882 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1883 | + }); | |
| 1884 | + }; | |
| 1885 | + | |
| 1886 | + // === 绘制 sType 层 === | |
| 1887 | + addLayer({ | |
| 1888 | + type: sType, | |
| 1889 | + length: sLength, | |
| 1890 | + width: sWidth, | |
| 1891 | + offset: sOffset, | |
| 1892 | + quantity: sQuantity, | |
| 1893 | + isTrapezoid: Number(sType) !== 0, | |
| 1894 | + }); | |
| 1895 | + | |
| 1896 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1897 | + addLayer({ | |
| 1898 | + type: cType, | |
| 1899 | + length: cLength, | |
| 1900 | + width: cWidth, | |
| 1901 | + offset: cOffset, | |
| 1902 | + quantity: cQuantity, | |
| 1903 | + isTrapezoid: Number(cType) !== 0, | |
| 1904 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 1905 | + }); | |
| 1906 | + | |
| 1907 | + // 将分组添加到 SVG | |
| 1908 | + svg.appendChild(g); | |
| 1909 | + } else { | |
| 1910 | + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale)); | |
| 1911 | + if (ybtb?.type && dYTBW) { | |
| 1912 | + pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 1913 | + } | |
| 1914 | + } | |
| 1915 | + // 左上部件 | |
| 1916 | + if (zsbj?.type && zsbj?.type === "3009") { | |
| 1917 | + // 先放层1的盒型 | |
| 1918 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj; | |
| 1919 | + | |
| 1920 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 1921 | + const addLayer = params => { | |
| 1922 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 1923 | + if (type === null) return; | |
| 1924 | + | |
| 1925 | + if (!quantity) return; | |
| 1926 | + | |
| 1927 | + const numQuantity = Number(quantity); | |
| 1928 | + const totalLength = Number(length) * scale; | |
| 1929 | + const totalWidth = Number(width) * scale; | |
| 1930 | + const numOffset = Number(offset) * scale; | |
| 1931 | + | |
| 1932 | + // 选择绘制函数 | |
| 1933 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 1934 | + | |
| 1935 | + let rectangles = []; | |
| 1936 | + | |
| 1937 | + if (numQuantity === 1) { | |
| 1938 | + rectangles = [ | |
| 1939 | + { | |
| 1940 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 1941 | + y: -totalWidth + yExtraOffset, | |
| 1942 | + width: totalLength, | |
| 1943 | + height: totalWidth, | |
| 1944 | + }, | |
| 1945 | + ]; | |
| 1946 | + } else if (numQuantity === 2) { | |
| 1947 | + const halfLength = totalLength; | |
| 1948 | + rectangles = [ | |
| 1949 | + { | |
| 1950 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 1951 | + y: -totalWidth + yExtraOffset, | |
| 1952 | + width: halfLength, | |
| 1953 | + height: totalWidth, | |
| 1954 | + }, | |
| 1955 | + { | |
| 1956 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 1957 | + y: -totalWidth + yExtraOffset, | |
| 1958 | + width: halfLength, | |
| 1959 | + height: totalWidth, | |
| 1960 | + }, | |
| 1961 | + ]; | |
| 1962 | + } | |
| 1963 | + | |
| 1964 | + rectangles.forEach(rect => { | |
| 1965 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 1966 | + }); | |
| 1967 | + }; | |
| 1968 | + | |
| 1969 | + // === 绘制 sType 层 === | |
| 1970 | + addLayer({ | |
| 1971 | + type: sType, | |
| 1972 | + length: sLength, | |
| 1973 | + width: sWidth, | |
| 1974 | + offset: sOffset, | |
| 1975 | + quantity: sQuantity, | |
| 1976 | + isTrapezoid: Number(sType) !== 0, | |
| 1977 | + }); | |
| 1978 | + | |
| 1979 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 1980 | + addLayer({ | |
| 1981 | + type: cType, | |
| 1982 | + length: cLength, | |
| 1983 | + width: cWidth, | |
| 1984 | + offset: cOffset, | |
| 1985 | + quantity: cQuantity, | |
| 1986 | + isTrapezoid: Number(cType) !== 0, | |
| 1987 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 1988 | + }); | |
| 1989 | + | |
| 1990 | + // 将分组添加到 SVG | |
| 1991 | + svg.appendChild(g); | |
| 1992 | + } else { | |
| 1993 | + pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); | |
| 1994 | + if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 1995 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 1996 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1997 | + pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1998 | + } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 1999 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 2000 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 2001 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 2002 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2003 | + pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 2004 | + } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 2005 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 2006 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 2007 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 2008 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2009 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2010 | + } else if (zsbj?.type && dZSCW) { | |
| 2011 | + pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); | |
| 2012 | + } | |
| 2013 | + } | |
| 2014 | + // 右上部件 | |
| 2015 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 2016 | + // 先放层1的盒型 | |
| 2017 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj; | |
| 2018 | + | |
| 2019 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2020 | + const addLayer = params => { | |
| 2021 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2022 | + if (type === null) return; | |
| 2023 | + | |
| 2024 | + if (!quantity) return; | |
| 2025 | + | |
| 2026 | + const numQuantity = Number(quantity); | |
| 2027 | + const totalLength = Number(length) * scale; | |
| 2028 | + const totalWidth = Number(width) * scale; | |
| 2029 | + const numOffset = Number(offset) * scale; | |
| 2030 | + | |
| 2031 | + // 选择绘制函数 | |
| 2032 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2033 | + | |
| 2034 | + let rectangles = []; | |
| 2035 | + | |
| 2036 | + if (numQuantity === 1) { | |
| 2037 | + rectangles = [ | |
| 2038 | + { | |
| 2039 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth, | |
| 2040 | + y: -totalWidth + yExtraOffset, | |
| 2041 | + width: totalLength, | |
| 2042 | + height: totalWidth, | |
| 2043 | + }, | |
| 2044 | + ]; | |
| 2045 | + } else if (numQuantity === 2) { | |
| 2046 | + const halfLength = totalLength; | |
| 2047 | + rectangles = [ | |
| 2048 | + { | |
| 2049 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth, | |
| 2050 | + y: -totalWidth + yExtraOffset, | |
| 2051 | + width: halfLength, | |
| 2052 | + height: totalWidth, | |
| 2053 | + }, | |
| 2054 | + { | |
| 2055 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth, | |
| 2056 | + y: -totalWidth + yExtraOffset, | |
| 2057 | + width: halfLength, | |
| 2058 | + height: totalWidth, | |
| 2059 | + }, | |
| 2060 | + ]; | |
| 2061 | + } | |
| 2062 | + | |
| 2063 | + rectangles.forEach(rect => { | |
| 2064 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2065 | + }); | |
| 2066 | + }; | |
| 2067 | + | |
| 2068 | + // === 绘制 sType 层 === | |
| 2069 | + addLayer({ | |
| 2070 | + type: sType, | |
| 2071 | + length: sLength, | |
| 2072 | + width: sWidth, | |
| 2073 | + offset: sOffset, | |
| 2074 | + quantity: sQuantity, | |
| 2075 | + isTrapezoid: Number(sType) !== 0, | |
| 2076 | + }); | |
| 2077 | + | |
| 2078 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2079 | + addLayer({ | |
| 2080 | + type: cType, | |
| 2081 | + length: cLength, | |
| 2082 | + width: cWidth, | |
| 2083 | + offset: cOffset, | |
| 2084 | + quantity: cQuantity, | |
| 2085 | + isTrapezoid: Number(cType) !== 0, | |
| 2086 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 2087 | + }); | |
| 2088 | + | |
| 2089 | + // 将分组添加到 SVG | |
| 2090 | + svg.appendChild(g); | |
| 2091 | + } else { | |
| 2092 | + pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0)); | |
| 2093 | + if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 2094 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 2095 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 2096 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 2097 | + } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 2098 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 2099 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 2100 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 2101 | + pathList.push( | |
| 2102 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 2103 | + ); | |
| 2104 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 2105 | + } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 2106 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 2107 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 2108 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 2109 | + pathList.push( | |
| 2110 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 2111 | + ); | |
| 2112 | + pathList.push( | |
| 2113 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 2114 | + ); | |
| 2115 | + } else if (ysbj?.type && dYSCW) { | |
| 2116 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 2117 | + } | |
| 829 | 2118 | } |
| 2119 | + | |
| 830 | 2120 | // 左下部件- |
| 831 | - pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); | |
| 832 | - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 833 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 834 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 835 | - pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW)); | |
| 836 | - } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 837 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 838 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 839 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 840 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 841 | - pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 842 | - } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 843 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 844 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 845 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 846 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 847 | - } else if (zxbj?.type && dZXCW) { | |
| 848 | - pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2121 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 2122 | + // 先放层1的盒型 | |
| 2123 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 2124 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2125 | + const addLayer = params => { | |
| 2126 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2127 | + if (type === null) return; | |
| 2128 | + | |
| 2129 | + if (!quantity) return; | |
| 2130 | + | |
| 2131 | + const numQuantity = Number(quantity); | |
| 2132 | + const totalLength = Number(length) * scale; | |
| 2133 | + const totalWidth = Number(width) * scale; | |
| 2134 | + const numOffset = Number(offset) * scale; | |
| 2135 | + | |
| 2136 | + // 选择绘制函数 | |
| 2137 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2138 | + | |
| 2139 | + let rectangles = []; | |
| 2140 | + | |
| 2141 | + if (numQuantity === 1) { | |
| 2142 | + rectangles = [ | |
| 2143 | + { | |
| 2144 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 2145 | + y: scaledDeep - yExtraOffset, | |
| 2146 | + width: totalLength, | |
| 2147 | + height: totalWidth, | |
| 2148 | + }, | |
| 2149 | + ]; | |
| 2150 | + } else if (numQuantity === 2) { | |
| 2151 | + const halfLength = totalLength; | |
| 2152 | + rectangles = [ | |
| 2153 | + { | |
| 2154 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 2155 | + y: scaledDeep - yExtraOffset, | |
| 2156 | + width: halfLength, | |
| 2157 | + height: totalWidth, | |
| 2158 | + }, | |
| 2159 | + { | |
| 2160 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 2161 | + y: scaledDeep - yExtraOffset, | |
| 2162 | + width: halfLength, | |
| 2163 | + height: totalWidth, | |
| 2164 | + }, | |
| 2165 | + ]; | |
| 2166 | + } | |
| 2167 | + | |
| 2168 | + rectangles.forEach(rect => { | |
| 2169 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2170 | + }); | |
| 2171 | + }; | |
| 2172 | + | |
| 2173 | + // === 绘制 sType 层 === | |
| 2174 | + addLayer({ | |
| 2175 | + type: sType, | |
| 2176 | + length: sLength, | |
| 2177 | + width: sWidth, | |
| 2178 | + offset: sOffset, | |
| 2179 | + quantity: sQuantity, | |
| 2180 | + isTrapezoid: Number(sType) !== 0, | |
| 2181 | + }); | |
| 2182 | + | |
| 2183 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2184 | + addLayer({ | |
| 2185 | + type: cType, | |
| 2186 | + length: cLength, | |
| 2187 | + width: cWidth, | |
| 2188 | + offset: cOffset, | |
| 2189 | + quantity: cQuantity, | |
| 2190 | + isTrapezoid: Number(cType) !== 0, | |
| 2191 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 2192 | + }); | |
| 2193 | + | |
| 2194 | + // 将分组添加到 SVG | |
| 2195 | + svg.appendChild(g); | |
| 2196 | + } else { | |
| 2197 | + pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep)); | |
| 2198 | + if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 2199 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2200 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2201 | + pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW)); | |
| 2202 | + } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 2203 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2204 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2205 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 2206 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2207 | + pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2208 | + } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 2209 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 2210 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2211 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 2212 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2213 | + } else if (zxbj?.type && dZXCW) { | |
| 2214 | + pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2215 | + } | |
| 849 | 2216 | } |
| 2217 | + | |
| 850 | 2218 | // 右下部件 |
| 851 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep)); | |
| 852 | - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 853 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 854 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 855 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 856 | - } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 857 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 858 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 859 | - pathList.push( | |
| 860 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 861 | - ); | |
| 862 | - pathList.push( | |
| 863 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 864 | - ); | |
| 865 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 866 | - } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 867 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 868 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 869 | - pathList.push( | |
| 870 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 871 | - ); | |
| 872 | - pathList.push( | |
| 873 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W") | |
| 874 | - ); | |
| 875 | - } else if (dYXCW && yxbj?.type) { | |
| 876 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 2219 | + if (yxbj?.type && yxbj?.type === "7009") { | |
| 2220 | + // 先放层1的盒型 | |
| 2221 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj; | |
| 2222 | + | |
| 2223 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2224 | + const addLayer = params => { | |
| 2225 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2226 | + if (type === null) return; | |
| 2227 | + | |
| 2228 | + if (!quantity) return; | |
| 2229 | + | |
| 2230 | + const numQuantity = Number(quantity); | |
| 2231 | + const totalLength = Number(length) * scale; | |
| 2232 | + const totalWidth = Number(width) * scale; | |
| 2233 | + const numOffset = Number(offset) * scale; | |
| 2234 | + | |
| 2235 | + // 选择绘制函数 | |
| 2236 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2237 | + | |
| 2238 | + let rectangles = []; | |
| 2239 | + | |
| 2240 | + if (numQuantity === 1) { | |
| 2241 | + rectangles = [ | |
| 2242 | + { | |
| 2243 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth, | |
| 2244 | + y: scaledDeep - yExtraOffset, | |
| 2245 | + width: totalLength, | |
| 2246 | + height: totalWidth, | |
| 2247 | + }, | |
| 2248 | + ]; | |
| 2249 | + } else if (numQuantity === 2) { | |
| 2250 | + const halfLength = totalLength; | |
| 2251 | + rectangles = [ | |
| 2252 | + { | |
| 2253 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth, | |
| 2254 | + y: scaledDeep - yExtraOffset, | |
| 2255 | + width: halfLength, | |
| 2256 | + height: totalWidth, | |
| 2257 | + }, | |
| 2258 | + { | |
| 2259 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth, | |
| 2260 | + y: scaledDeep - yExtraOffset, | |
| 2261 | + width: halfLength, | |
| 2262 | + height: totalWidth, | |
| 2263 | + }, | |
| 2264 | + ]; | |
| 2265 | + } | |
| 2266 | + | |
| 2267 | + rectangles.forEach(rect => { | |
| 2268 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2269 | + }); | |
| 2270 | + }; | |
| 2271 | + | |
| 2272 | + // === 绘制 sType 层 === | |
| 2273 | + addLayer({ | |
| 2274 | + type: sType, | |
| 2275 | + length: sLength, | |
| 2276 | + width: sWidth, | |
| 2277 | + offset: sOffset, | |
| 2278 | + quantity: sQuantity, | |
| 2279 | + isTrapezoid: Number(sType) !== 0, | |
| 2280 | + }); | |
| 2281 | + | |
| 2282 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2283 | + addLayer({ | |
| 2284 | + type: cType, | |
| 2285 | + length: cLength, | |
| 2286 | + width: cWidth, | |
| 2287 | + offset: cOffset, | |
| 2288 | + quantity: cQuantity, | |
| 2289 | + isTrapezoid: Number(cType) !== 0, | |
| 2290 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 2291 | + }); | |
| 2292 | + | |
| 2293 | + // 将分组添加到 SVG | |
| 2294 | + svg.appendChild(g); | |
| 2295 | + } else { | |
| 2296 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep)); | |
| 2297 | + if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 2298 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2299 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2300 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 2301 | + } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 2302 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2303 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2304 | + pathList.push( | |
| 2305 | + createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 2306 | + ); | |
| 2307 | + pathList.push( | |
| 2308 | + createText( | |
| 2309 | + scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, | |
| 2310 | + scaledDeep + (scaledHeight + scaledHeight / 2), | |
| 2311 | + 10 * scales, | |
| 2312 | + "W" | |
| 2313 | + ) | |
| 2314 | + ); | |
| 2315 | + pathList.push( | |
| 2316 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW) | |
| 2317 | + ); | |
| 2318 | + } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 2319 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 2320 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2321 | + pathList.push( | |
| 2322 | + createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | |
| 2323 | + ); | |
| 2324 | + pathList.push( | |
| 2325 | + createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W") | |
| 2326 | + ); | |
| 2327 | + } else if (dYXCW && yxbj?.type) { | |
| 2328 | + pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 2329 | + } | |
| 877 | 2330 | } |
| 878 | 2331 | if (scaledDeep && scaledWidth && scaledHeight) { |
| 879 | 2332 | // 纵向 D |
| ... | ... | @@ -905,69 +2358,662 @@ const SvgBox = props => { |
| 905 | 2358 | svg.appendChild(g); |
| 906 | 2359 | let pathList = []; |
| 907 | 2360 | // 上方盒舌 |
| 908 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0)); | |
| 909 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth + scaledHeight, 0)); | |
| 910 | - if (sfhs?.type && dSFHS) { | |
| 911 | - pathList.push(createText(scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 912 | - pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 2361 | + if (sfhs?.type && sfhs.type === "1009") { | |
| 2362 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs; | |
| 2363 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 2364 | + const addLayer = params => { | |
| 2365 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2366 | + if (type === null) return; | |
| 2367 | + | |
| 2368 | + if (!quantity) return; | |
| 2369 | + | |
| 2370 | + const numQuantity = Number(quantity); | |
| 2371 | + const totalLength = Number(length) * scale; | |
| 2372 | + const totalWidth = Number(width) * scale; | |
| 2373 | + const numOffset = Number(offset) * scale; | |
| 2374 | + | |
| 2375 | + // 选择绘制函数 | |
| 2376 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2377 | + | |
| 2378 | + let rectangles = []; | |
| 2379 | + | |
| 2380 | + if (numQuantity === 1) { | |
| 2381 | + rectangles = [ | |
| 2382 | + { | |
| 2383 | + x: (scaledHeight - totalLength) / 2 + numOffset, | |
| 2384 | + y: -totalWidth + yExtraOffset, | |
| 2385 | + width: totalLength, | |
| 2386 | + height: totalWidth, | |
| 2387 | + }, | |
| 2388 | + ]; | |
| 2389 | + } else if (numQuantity === 2) { | |
| 2390 | + const halfLength = totalLength; | |
| 2391 | + rectangles = [ | |
| 2392 | + { | |
| 2393 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2, | |
| 2394 | + y: -totalWidth + yExtraOffset, | |
| 2395 | + width: halfLength, | |
| 2396 | + height: totalWidth, | |
| 2397 | + }, | |
| 2398 | + { | |
| 2399 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 2400 | + y: -totalWidth + yExtraOffset, | |
| 2401 | + width: halfLength, | |
| 2402 | + height: totalWidth, | |
| 2403 | + }, | |
| 2404 | + ]; | |
| 2405 | + } | |
| 2406 | + | |
| 2407 | + rectangles.forEach(rect => { | |
| 2408 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2409 | + }); | |
| 2410 | + }; | |
| 2411 | + const addLayers = params => { | |
| 2412 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2413 | + if (type === null) return; | |
| 2414 | + | |
| 2415 | + if (!quantity) return; | |
| 2416 | + | |
| 2417 | + const numQuantity = Number(quantity); | |
| 2418 | + const totalLength = Number(length) * scale; | |
| 2419 | + const totalWidth = Number(width) * scale; | |
| 2420 | + const numOffset = Number(offset) * scale; | |
| 2421 | + | |
| 2422 | + // 选择绘制函数 | |
| 2423 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2424 | + | |
| 2425 | + let rectangles = []; | |
| 2426 | + | |
| 2427 | + if (numQuantity === 1) { | |
| 2428 | + rectangles = [ | |
| 2429 | + { | |
| 2430 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight, | |
| 2431 | + y: -totalWidth + yExtraOffset, | |
| 2432 | + width: totalLength, | |
| 2433 | + height: totalWidth, | |
| 2434 | + }, | |
| 2435 | + ]; | |
| 2436 | + } else if (numQuantity === 2) { | |
| 2437 | + const halfLength = totalLength; | |
| 2438 | + rectangles = [ | |
| 2439 | + { | |
| 2440 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight, | |
| 2441 | + y: -totalWidth + yExtraOffset, | |
| 2442 | + width: halfLength, | |
| 2443 | + height: totalWidth, | |
| 2444 | + }, | |
| 2445 | + { | |
| 2446 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight, | |
| 2447 | + y: -totalWidth + yExtraOffset, | |
| 2448 | + width: halfLength, | |
| 2449 | + height: totalWidth, | |
| 2450 | + }, | |
| 2451 | + ]; | |
| 2452 | + } | |
| 2453 | + | |
| 2454 | + rectangles.forEach(rect => { | |
| 2455 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2456 | + }); | |
| 2457 | + }; | |
| 2458 | + // === 绘制 sType 层 === | |
| 2459 | + addLayer({ | |
| 2460 | + type: sType, | |
| 2461 | + length: sLength, | |
| 2462 | + width: sWidth, | |
| 2463 | + offset: sOffset, | |
| 2464 | + quantity: sQuantity, | |
| 2465 | + isTrapezoid: Number(sType) !== 0, | |
| 2466 | + }); | |
| 2467 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 2468 | + addLayer({ | |
| 2469 | + type: cType, | |
| 2470 | + length: cLength, | |
| 2471 | + width: cWidth, | |
| 2472 | + offset: cOffset, | |
| 2473 | + quantity: cQuantity, | |
| 2474 | + isTrapezoid: Number(cType) !== 0, | |
| 2475 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 2476 | + }); | |
| 2477 | + addLayers({ | |
| 2478 | + type: sType, | |
| 2479 | + length: sLength, | |
| 2480 | + width: sWidth, | |
| 2481 | + offset: sOffset, | |
| 2482 | + quantity: sQuantity, | |
| 2483 | + isTrapezoid: Number(sType) !== 0, | |
| 2484 | + }); | |
| 2485 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 2486 | + addLayers({ | |
| 2487 | + type: cType, | |
| 2488 | + length: cLength, | |
| 2489 | + width: cWidth, | |
| 2490 | + offset: cOffset, | |
| 2491 | + quantity: cQuantity, | |
| 2492 | + isTrapezoid: Number(cType) !== 0, | |
| 2493 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 2494 | + }); | |
| 2495 | + // 将 group 添加到 svg | |
| 2496 | + svg.appendChild(g); | |
| 2497 | + } else { | |
| 2498 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0)); | |
| 2499 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth + scaledHeight, 0)); | |
| 2500 | + if (sfhs?.type && dSFHS) { | |
| 2501 | + pathList.push(createText(scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 2502 | + pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 2503 | + } | |
| 913 | 2504 | } |
| 2505 | + | |
| 914 | 2506 | // 下方盒舌 |
| 915 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, 0, scaledDeep)); | |
| 916 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth + scaledHeight, scaledDeep)); | |
| 917 | - if (xfhs?.type && dXFHS) { | |
| 918 | - pathList.push(createText(scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 919 | - pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 2507 | + if (xfhs?.type && xfhs.type === "2009") { | |
| 2508 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs; | |
| 2509 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 2510 | + const addLayer = params => { | |
| 2511 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2512 | + if (type === null) return; | |
| 2513 | + | |
| 2514 | + if (!quantity) return; | |
| 2515 | + | |
| 2516 | + const numQuantity = Number(quantity); | |
| 2517 | + const totalLength = Number(length) * scale; | |
| 2518 | + const totalWidth = Number(width) * scale; | |
| 2519 | + const numOffset = Number(offset) * scale; | |
| 2520 | + | |
| 2521 | + // 选择绘制函数 | |
| 2522 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2523 | + | |
| 2524 | + let rectangles = []; | |
| 2525 | + | |
| 2526 | + if (numQuantity === 1) { | |
| 2527 | + rectangles = [ | |
| 2528 | + { | |
| 2529 | + x: (scaledHeight - totalLength) / 2 + numOffset, | |
| 2530 | + y: scaledDeep - yExtraOffset, | |
| 2531 | + width: totalLength, | |
| 2532 | + height: totalWidth, | |
| 2533 | + }, | |
| 2534 | + ]; | |
| 2535 | + } else if (numQuantity === 2) { | |
| 2536 | + const halfLength = totalLength; | |
| 2537 | + rectangles = [ | |
| 2538 | + { | |
| 2539 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2, | |
| 2540 | + y: scaledDeep - yExtraOffset, | |
| 2541 | + width: halfLength, | |
| 2542 | + height: totalWidth, | |
| 2543 | + }, | |
| 2544 | + { | |
| 2545 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 2546 | + y: scaledDeep - yExtraOffset, | |
| 2547 | + width: halfLength, | |
| 2548 | + height: totalWidth, | |
| 2549 | + }, | |
| 2550 | + ]; | |
| 2551 | + } | |
| 2552 | + | |
| 2553 | + rectangles.forEach(rect => { | |
| 2554 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2555 | + }); | |
| 2556 | + }; | |
| 2557 | + const addLayers = params => { | |
| 2558 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2559 | + if (type === null) return; | |
| 2560 | + | |
| 2561 | + if (!quantity) return; | |
| 2562 | + | |
| 2563 | + const numQuantity = Number(quantity); | |
| 2564 | + const totalLength = Number(length) * scale; | |
| 2565 | + const totalWidth = Number(width) * scale; | |
| 2566 | + const numOffset = Number(offset) * scale; | |
| 2567 | + | |
| 2568 | + // 选择绘制函数 | |
| 2569 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2570 | + | |
| 2571 | + let rectangles = []; | |
| 2572 | + | |
| 2573 | + if (numQuantity === 1) { | |
| 2574 | + rectangles = [ | |
| 2575 | + { | |
| 2576 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight, | |
| 2577 | + y: scaledDeep - yExtraOffset, | |
| 2578 | + width: totalLength, | |
| 2579 | + height: totalWidth, | |
| 2580 | + }, | |
| 2581 | + ]; | |
| 2582 | + } else if (numQuantity === 2) { | |
| 2583 | + const halfLength = totalLength; | |
| 2584 | + rectangles = [ | |
| 2585 | + { | |
| 2586 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight, | |
| 2587 | + y: scaledDeep - yExtraOffset, | |
| 2588 | + width: halfLength, | |
| 2589 | + height: totalWidth, | |
| 2590 | + }, | |
| 2591 | + { | |
| 2592 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight, | |
| 2593 | + y: scaledDeep - yExtraOffset, | |
| 2594 | + width: halfLength, | |
| 2595 | + height: totalWidth, | |
| 2596 | + }, | |
| 2597 | + ]; | |
| 2598 | + } | |
| 2599 | + | |
| 2600 | + rectangles.forEach(rect => { | |
| 2601 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2602 | + }); | |
| 2603 | + }; | |
| 2604 | + // === 绘制 sType 层 === | |
| 2605 | + addLayer({ | |
| 2606 | + type: sType, | |
| 2607 | + length: sLength, | |
| 2608 | + width: sWidth, | |
| 2609 | + offset: sOffset, | |
| 2610 | + quantity: sQuantity, | |
| 2611 | + isTrapezoid: Number(sType) !== 0, | |
| 2612 | + }); | |
| 2613 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 2614 | + addLayer({ | |
| 2615 | + type: cType, | |
| 2616 | + length: cLength, | |
| 2617 | + width: cWidth, | |
| 2618 | + offset: cOffset, | |
| 2619 | + quantity: cQuantity, | |
| 2620 | + isTrapezoid: Number(cType) !== 0, | |
| 2621 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 2622 | + }); | |
| 2623 | + addLayers({ | |
| 2624 | + type: sType, | |
| 2625 | + length: sLength, | |
| 2626 | + width: sWidth, | |
| 2627 | + offset: sOffset, | |
| 2628 | + quantity: sQuantity, | |
| 2629 | + isTrapezoid: Number(sType) !== 0, | |
| 2630 | + }); | |
| 2631 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 2632 | + addLayers({ | |
| 2633 | + type: cType, | |
| 2634 | + length: cLength, | |
| 2635 | + width: cWidth, | |
| 2636 | + offset: cOffset, | |
| 2637 | + quantity: cQuantity, | |
| 2638 | + isTrapezoid: Number(cType) !== 0, | |
| 2639 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 2640 | + }); | |
| 2641 | + // 将 group 添加到 svg | |
| 2642 | + svg.appendChild(g); | |
| 2643 | + } else { | |
| 2644 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, 0, scaledDeep)); | |
| 2645 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth + scaledHeight, scaledDeep)); | |
| 2646 | + if (xfhs?.type && dXFHS) { | |
| 2647 | + pathList.push(createText(scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 2648 | + pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 2649 | + } | |
| 920 | 2650 | } |
| 2651 | + | |
| 921 | 2652 | // 左边贴边 |
| 922 | - pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 923 | - if (zbtb?.type && dZTBW) { | |
| 924 | - pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 2653 | + if (zbtb?.type === "8009") { | |
| 2654 | + // 先放层1的盒型 | |
| 2655 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb; | |
| 2656 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2657 | + const addLayer = params => { | |
| 2658 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2659 | + if (type === null) return; | |
| 2660 | + if (!quantity) return; | |
| 2661 | + | |
| 2662 | + const numQuantity = Number(quantity); | |
| 2663 | + const totalLength = Number(length) * scale; | |
| 2664 | + const totalWidth = Number(width) * scale; | |
| 2665 | + const numOffset = Number(offset) * scale; | |
| 2666 | + | |
| 2667 | + // 选择绘制函数 | |
| 2668 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 2669 | + | |
| 2670 | + let rectangles = []; | |
| 2671 | + | |
| 2672 | + if (numQuantity === 1) { | |
| 2673 | + rectangles = [ | |
| 2674 | + { | |
| 2675 | + x: -totalLength - yExtraOffset, | |
| 2676 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 2677 | + width: totalLength, | |
| 2678 | + height: totalWidth, | |
| 2679 | + }, | |
| 2680 | + ]; | |
| 2681 | + } else if (numQuantity === 2) { | |
| 2682 | + const halfLength = totalLength; | |
| 2683 | + const halfWidth = totalWidth * 2; | |
| 2684 | + rectangles = [ | |
| 2685 | + { | |
| 2686 | + x: -totalLength - yExtraOffset, | |
| 2687 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 2688 | + width: halfLength, | |
| 2689 | + height: totalWidth, | |
| 2690 | + }, | |
| 2691 | + { | |
| 2692 | + x: -totalLength - yExtraOffset, | |
| 2693 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 2694 | + width: halfLength, | |
| 2695 | + height: totalWidth, | |
| 2696 | + }, | |
| 2697 | + ]; | |
| 2698 | + } | |
| 2699 | + | |
| 2700 | + rectangles.forEach(rect => { | |
| 2701 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2702 | + }); | |
| 2703 | + }; | |
| 2704 | + | |
| 2705 | + // === 绘制 sType 层 === | |
| 2706 | + addLayer({ | |
| 2707 | + type: sType, | |
| 2708 | + length: sLength, | |
| 2709 | + width: sWidth, | |
| 2710 | + offset: sOffset, | |
| 2711 | + quantity: sQuantity, | |
| 2712 | + isTrapezoid: Number(sType) !== 0, | |
| 2713 | + }); | |
| 2714 | + | |
| 2715 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2716 | + addLayer({ | |
| 2717 | + type: cType, | |
| 2718 | + length: cLength, | |
| 2719 | + width: cWidth, | |
| 2720 | + offset: cOffset, | |
| 2721 | + quantity: cQuantity, | |
| 2722 | + isTrapezoid: Number(cType) !== 0, | |
| 2723 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 2724 | + }); | |
| 2725 | + | |
| 2726 | + // 将分组添加到 SVG | |
| 2727 | + svg.appendChild(g); | |
| 2728 | + } else { | |
| 2729 | + pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 2730 | + if (zbtb?.type && dZTBW) { | |
| 2731 | + pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW)); | |
| 2732 | + } | |
| 925 | 2733 | } |
| 2734 | + | |
| 926 | 2735 | // 右边贴边 |
| 927 | - pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); | |
| 928 | - if (zbtb?.type && dYTBW) { | |
| 929 | - pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 2736 | + if (ybtb?.type === "9009") { | |
| 2737 | + // 先放层1的盒型 | |
| 2738 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 2739 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2740 | + const addLayer = params => { | |
| 2741 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2742 | + if (type === null) return; | |
| 2743 | + | |
| 2744 | + if (!quantity) return; | |
| 2745 | + | |
| 2746 | + const numQuantity = Number(quantity); | |
| 2747 | + const totalLength = Number(length) * scale; | |
| 2748 | + const totalWidth = Number(width) * scale; | |
| 2749 | + const numOffset = Number(offset) * scale; | |
| 2750 | + | |
| 2751 | + // 选择绘制函数 | |
| 2752 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 2753 | + | |
| 2754 | + let rectangles = []; | |
| 2755 | + | |
| 2756 | + if (numQuantity === 1) { | |
| 2757 | + rectangles = [ | |
| 2758 | + { | |
| 2759 | + x: scaledWidth + scaledHeight * 2 + yExtraOffset, | |
| 2760 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 2761 | + width: totalLength, | |
| 2762 | + height: totalWidth, | |
| 2763 | + }, | |
| 2764 | + ]; | |
| 2765 | + } else if (numQuantity === 2) { | |
| 2766 | + const halfLength = totalLength; | |
| 2767 | + const halfWidth = totalWidth * 2; | |
| 2768 | + rectangles = [ | |
| 2769 | + { | |
| 2770 | + x: scaledWidth + scaledHeight * 2 + yExtraOffset, | |
| 2771 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 2772 | + width: halfLength, | |
| 2773 | + height: totalWidth, | |
| 2774 | + }, | |
| 2775 | + { | |
| 2776 | + x: scaledWidth + scaledHeight * 2 + yExtraOffset, | |
| 2777 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 2778 | + width: halfLength, | |
| 2779 | + height: totalWidth, | |
| 2780 | + }, | |
| 2781 | + ]; | |
| 2782 | + } | |
| 2783 | + | |
| 2784 | + rectangles.forEach(rect => { | |
| 2785 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2786 | + }); | |
| 2787 | + }; | |
| 2788 | + | |
| 2789 | + // === 绘制 sType 层 === | |
| 2790 | + addLayer({ | |
| 2791 | + type: sType, | |
| 2792 | + length: sLength, | |
| 2793 | + width: sWidth, | |
| 2794 | + offset: sOffset, | |
| 2795 | + quantity: sQuantity, | |
| 2796 | + isTrapezoid: Number(sType) !== 0, | |
| 2797 | + }); | |
| 2798 | + | |
| 2799 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2800 | + addLayer({ | |
| 2801 | + type: cType, | |
| 2802 | + length: cLength, | |
| 2803 | + width: cWidth, | |
| 2804 | + offset: cOffset, | |
| 2805 | + quantity: cQuantity, | |
| 2806 | + isTrapezoid: Number(cType) !== 0, | |
| 2807 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 2808 | + }); | |
| 2809 | + | |
| 2810 | + // 将分组添加到 SVG | |
| 2811 | + svg.appendChild(g); | |
| 2812 | + } else { | |
| 2813 | + pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)); | |
| 2814 | + if (zbtb?.type && dYTBW) { | |
| 2815 | + pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW)); | |
| 2816 | + } | |
| 930 | 2817 | } |
| 2818 | + | |
| 931 | 2819 | // 左下部件- |
| 932 | - pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep)); | |
| 933 | - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 934 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 935 | - pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 936 | - pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 937 | - pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 938 | - } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 939 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 940 | - pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 941 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 942 | - pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 943 | - pathList.push(createText(scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 944 | - } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 945 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 946 | - pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 947 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 948 | - pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 949 | - } else if (zxbj?.type && dZXCW) { | |
| 950 | - pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2820 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 2821 | + // 先放层1的盒型 | |
| 2822 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 2823 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2824 | + const addLayer = params => { | |
| 2825 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2826 | + if (type === null) return; | |
| 2827 | + | |
| 2828 | + if (!quantity) return; | |
| 2829 | + | |
| 2830 | + const numQuantity = Number(quantity); | |
| 2831 | + const totalLength = Number(length) * scale; | |
| 2832 | + const totalWidth = Number(width) * scale; | |
| 2833 | + const numOffset = Number(offset) * scale; | |
| 2834 | + | |
| 2835 | + // 选择绘制函数 | |
| 2836 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2837 | + | |
| 2838 | + let rectangles = []; | |
| 2839 | + | |
| 2840 | + if (numQuantity === 1) { | |
| 2841 | + rectangles = [ | |
| 2842 | + { | |
| 2843 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight, | |
| 2844 | + y: scaledDeep - yExtraOffset, | |
| 2845 | + width: totalLength, | |
| 2846 | + height: totalWidth, | |
| 2847 | + }, | |
| 2848 | + ]; | |
| 2849 | + } else if (numQuantity === 2) { | |
| 2850 | + const halfLength = totalLength; | |
| 2851 | + rectangles = [ | |
| 2852 | + { | |
| 2853 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight, | |
| 2854 | + y: scaledDeep - yExtraOffset, | |
| 2855 | + width: halfLength, | |
| 2856 | + height: totalWidth, | |
| 2857 | + }, | |
| 2858 | + { | |
| 2859 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight, | |
| 2860 | + y: scaledDeep - yExtraOffset, | |
| 2861 | + width: halfLength, | |
| 2862 | + height: totalWidth, | |
| 2863 | + }, | |
| 2864 | + ]; | |
| 2865 | + } | |
| 2866 | + | |
| 2867 | + rectangles.forEach(rect => { | |
| 2868 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2869 | + }); | |
| 2870 | + }; | |
| 2871 | + | |
| 2872 | + // === 绘制 sType 层 === | |
| 2873 | + addLayer({ | |
| 2874 | + type: sType, | |
| 2875 | + length: sLength, | |
| 2876 | + width: sWidth, | |
| 2877 | + offset: sOffset, | |
| 2878 | + quantity: sQuantity, | |
| 2879 | + isTrapezoid: Number(sType) !== 0, | |
| 2880 | + }); | |
| 2881 | + | |
| 2882 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2883 | + addLayer({ | |
| 2884 | + type: cType, | |
| 2885 | + length: cLength, | |
| 2886 | + width: cWidth, | |
| 2887 | + offset: cOffset, | |
| 2888 | + quantity: cQuantity, | |
| 2889 | + isTrapezoid: Number(cType) !== 0, | |
| 2890 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 2891 | + }); | |
| 2892 | + | |
| 2893 | + // 将分组添加到 SVG | |
| 2894 | + svg.appendChild(g); | |
| 2895 | + } else { | |
| 2896 | + pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep)); | |
| 2897 | + if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 2898 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2899 | + pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2900 | + pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2901 | + pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2902 | + } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 2903 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | |
| 2904 | + pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2905 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 2906 | + pathList.push( | |
| 2907 | + createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") | |
| 2908 | + ); | |
| 2909 | + pathList.push(createText(scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2910 | + } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 2911 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | |
| 2912 | + pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | |
| 2913 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)); | |
| 2914 | + pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 2915 | + } else if (zxbj?.type && dZXCW) { | |
| 2916 | + pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 2917 | + } | |
| 951 | 2918 | } |
| 2919 | + | |
| 952 | 2920 | // 右上部件 |
| 953 | - pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0)); | |
| 954 | - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 955 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 956 | - pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 957 | - pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 958 | - } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 959 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 960 | - pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 961 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 962 | - pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 963 | - pathList.push(createText(scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 964 | - } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 965 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 966 | - pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 967 | - pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 968 | - pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 969 | - } else if (ysbj?.type && dYSCW) { | |
| 970 | - pathList.push(createText(scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 2921 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 2922 | + // 先放层1的盒型 | |
| 2923 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj; | |
| 2924 | + | |
| 2925 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 2926 | + const addLayer = params => { | |
| 2927 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 2928 | + if (type === null) return; | |
| 2929 | + | |
| 2930 | + if (!quantity) return; | |
| 2931 | + | |
| 2932 | + const numQuantity = Number(quantity); | |
| 2933 | + const totalLength = Number(length) * scale; | |
| 2934 | + const totalWidth = Number(width) * scale; | |
| 2935 | + const numOffset = Number(offset) * scale; | |
| 2936 | + | |
| 2937 | + // 选择绘制函数 | |
| 2938 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 2939 | + | |
| 2940 | + let rectangles = []; | |
| 2941 | + | |
| 2942 | + if (numQuantity === 1) { | |
| 2943 | + rectangles = [ | |
| 2944 | + { | |
| 2945 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight, | |
| 2946 | + y: -totalWidth + yExtraOffset, | |
| 2947 | + width: totalLength, | |
| 2948 | + height: totalWidth, | |
| 2949 | + }, | |
| 2950 | + ]; | |
| 2951 | + } else if (numQuantity === 2) { | |
| 2952 | + const halfLength = totalLength; | |
| 2953 | + rectangles = [ | |
| 2954 | + { | |
| 2955 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight, | |
| 2956 | + y: -totalWidth + yExtraOffset, | |
| 2957 | + width: halfLength, | |
| 2958 | + height: totalWidth, | |
| 2959 | + }, | |
| 2960 | + { | |
| 2961 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight, | |
| 2962 | + y: -totalWidth + yExtraOffset, | |
| 2963 | + width: halfLength, | |
| 2964 | + height: totalWidth, | |
| 2965 | + }, | |
| 2966 | + ]; | |
| 2967 | + } | |
| 2968 | + | |
| 2969 | + rectangles.forEach(rect => { | |
| 2970 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 2971 | + }); | |
| 2972 | + }; | |
| 2973 | + | |
| 2974 | + // === 绘制 sType 层 === | |
| 2975 | + addLayer({ | |
| 2976 | + type: sType, | |
| 2977 | + length: sLength, | |
| 2978 | + width: sWidth, | |
| 2979 | + offset: sOffset, | |
| 2980 | + quantity: sQuantity, | |
| 2981 | + isTrapezoid: Number(sType) !== 0, | |
| 2982 | + }); | |
| 2983 | + | |
| 2984 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 2985 | + addLayer({ | |
| 2986 | + type: cType, | |
| 2987 | + length: cLength, | |
| 2988 | + width: cWidth, | |
| 2989 | + offset: cOffset, | |
| 2990 | + quantity: cQuantity, | |
| 2991 | + isTrapezoid: Number(cType) !== 0, | |
| 2992 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 2993 | + }); | |
| 2994 | + | |
| 2995 | + // 将分组添加到 SVG | |
| 2996 | + svg.appendChild(g); | |
| 2997 | + } else { | |
| 2998 | + pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0)); | |
| 2999 | + if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 3000 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 3001 | + pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 3002 | + pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW)); | |
| 3003 | + } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 3004 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 3005 | + pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 3006 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 3007 | + pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 3008 | + pathList.push(createText(scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 3009 | + } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 3010 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 3011 | + pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 3012 | + pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 3013 | + pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 3014 | + } else if (ysbj?.type && dYSCW) { | |
| 3015 | + pathList.push(createText(scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 3016 | + } | |
| 971 | 3017 | } |
| 972 | 3018 | |
| 973 | 3019 | if (scaledDeep && scaledWidth && scaledHeight) { |
| ... | ... | @@ -988,114 +3034,706 @@ const SvgBox = props => { |
| 988 | 3034 | }); |
| 989 | 3035 | svg.appendChild(g); |
| 990 | 3036 | } else if (Number(svgType) === 4) { |
| 3037 | + // 天地盒 | |
| 991 | 3038 | g.appendChild(createFullTelescope(scaledWidth, scaledHeight, scaledDeep, 0, 0)); |
| 992 | 3039 | svg.appendChild(g); |
| 993 | 3040 | // createFullTelescope |
| 994 | 3041 | let pathList = []; |
| 995 | 3042 | // 上方盒舌 |
| 996 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, -scaledDeep, 0)); | |
| 997 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledWidth + scaledDeep, 0)); | |
| 998 | - if (sfhs?.type && dSFHS) { | |
| 999 | - pathList.push(createText(-scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1000 | - pathList.push(createText(scaledWidth + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3043 | + if (sfhs?.type && sfhs.type === "1009") { | |
| 3044 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs; | |
| 3045 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 3046 | + const addLayer = params => { | |
| 3047 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3048 | + if (type === null) return; | |
| 3049 | + | |
| 3050 | + if (!quantity) return; | |
| 3051 | + | |
| 3052 | + const numQuantity = Number(quantity); | |
| 3053 | + const totalLength = Number(length) * scale; | |
| 3054 | + const totalWidth = Number(width) * scale; | |
| 3055 | + const numOffset = Number(offset) * scale; | |
| 3056 | + | |
| 3057 | + // 选择绘制函数 | |
| 3058 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3059 | + | |
| 3060 | + let rectangles = []; | |
| 3061 | + | |
| 3062 | + if (numQuantity === 1) { | |
| 3063 | + rectangles = [ | |
| 3064 | + { | |
| 3065 | + x: (scaledDeep - totalLength) / 2 + numOffset - scaledDeep, | |
| 3066 | + y: -totalWidth + yExtraOffset, | |
| 3067 | + width: totalLength, | |
| 3068 | + height: totalWidth, | |
| 3069 | + }, | |
| 3070 | + ]; | |
| 3071 | + } else if (numQuantity === 2) { | |
| 3072 | + const halfLength = totalLength; | |
| 3073 | + rectangles = [ | |
| 3074 | + { | |
| 3075 | + x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 - scaledDeep, | |
| 3076 | + y: -totalWidth + yExtraOffset, | |
| 3077 | + width: halfLength, | |
| 3078 | + height: totalWidth, | |
| 3079 | + }, | |
| 3080 | + { | |
| 3081 | + x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength - scaledDeep, | |
| 3082 | + y: -totalWidth + yExtraOffset, | |
| 3083 | + width: halfLength, | |
| 3084 | + height: totalWidth, | |
| 3085 | + }, | |
| 3086 | + ]; | |
| 3087 | + } | |
| 3088 | + | |
| 3089 | + rectangles.forEach(rect => { | |
| 3090 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3091 | + }); | |
| 3092 | + }; | |
| 3093 | + const addLayers = params => { | |
| 3094 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3095 | + if (type === null) return; | |
| 3096 | + | |
| 3097 | + if (!quantity) return; | |
| 3098 | + | |
| 3099 | + const numQuantity = Number(quantity); | |
| 3100 | + const totalLength = Number(length) * scale; | |
| 3101 | + const totalWidth = Number(width) * scale; | |
| 3102 | + const numOffset = Number(offset) * scale; | |
| 3103 | + | |
| 3104 | + // 选择绘制函数 | |
| 3105 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3106 | + | |
| 3107 | + let rectangles = []; | |
| 3108 | + | |
| 3109 | + if (numQuantity === 1) { | |
| 3110 | + rectangles = [ | |
| 3111 | + { | |
| 3112 | + x: (scaledDeep - totalLength) / 2 + numOffset + scaledWidth, | |
| 3113 | + y: -totalWidth + yExtraOffset, | |
| 3114 | + width: totalLength, | |
| 3115 | + height: totalWidth, | |
| 3116 | + }, | |
| 3117 | + ]; | |
| 3118 | + } else if (numQuantity === 2) { | |
| 3119 | + const halfLength = totalLength; | |
| 3120 | + rectangles = [ | |
| 3121 | + { | |
| 3122 | + x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 3123 | + y: -totalWidth + yExtraOffset, | |
| 3124 | + width: halfLength, | |
| 3125 | + height: totalWidth, | |
| 3126 | + }, | |
| 3127 | + { | |
| 3128 | + x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 3129 | + y: -totalWidth + yExtraOffset, | |
| 3130 | + width: halfLength, | |
| 3131 | + height: totalWidth, | |
| 3132 | + }, | |
| 3133 | + ]; | |
| 3134 | + } | |
| 3135 | + | |
| 3136 | + rectangles.forEach(rect => { | |
| 3137 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3138 | + }); | |
| 3139 | + }; | |
| 3140 | + // === 绘制 sType 层 === | |
| 3141 | + addLayer({ | |
| 3142 | + type: sType, | |
| 3143 | + length: sLength, | |
| 3144 | + width: sWidth, | |
| 3145 | + offset: sOffset, | |
| 3146 | + quantity: sQuantity, | |
| 3147 | + isTrapezoid: Number(sType) !== 0, | |
| 3148 | + }); | |
| 3149 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3150 | + addLayer({ | |
| 3151 | + type: cType, | |
| 3152 | + length: cLength, | |
| 3153 | + width: cWidth, | |
| 3154 | + offset: cOffset, | |
| 3155 | + quantity: cQuantity, | |
| 3156 | + isTrapezoid: Number(cType) !== 0, | |
| 3157 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3158 | + }); | |
| 3159 | + addLayers({ | |
| 3160 | + type: sType, | |
| 3161 | + length: sLength, | |
| 3162 | + width: sWidth, | |
| 3163 | + offset: sOffset, | |
| 3164 | + quantity: sQuantity, | |
| 3165 | + isTrapezoid: Number(sType) !== 0, | |
| 3166 | + }); | |
| 3167 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3168 | + addLayers({ | |
| 3169 | + type: cType, | |
| 3170 | + length: cLength, | |
| 3171 | + width: cWidth, | |
| 3172 | + offset: cOffset, | |
| 3173 | + quantity: cQuantity, | |
| 3174 | + isTrapezoid: Number(cType) !== 0, | |
| 3175 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3176 | + }); | |
| 3177 | + // 将 group 添加到 svg | |
| 3178 | + svg.appendChild(g); | |
| 3179 | + } else { | |
| 3180 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, -scaledDeep, 0)); | |
| 3181 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledWidth + scaledDeep, 0)); | |
| 3182 | + if (sfhs?.type && dSFHS) { | |
| 3183 | + pathList.push(createText(-scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3184 | + pathList.push(createText(scaledWidth + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3185 | + } | |
| 1001 | 3186 | } |
| 3187 | + | |
| 1002 | 3188 | // 下方盒舌 |
| 1003 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, -scaledDeep, scaledHeight)); | |
| 1004 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledDeep + scaledWidth, scaledHeight)); | |
| 1005 | - if (xfhs?.type && dXFHS) { | |
| 1006 | - pathList.push(createText(-scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 1007 | - pathList.push(createText(scaledWidth + scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 3189 | + if (xfhs?.type && xfhs.type === "2009") { | |
| 3190 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs; | |
| 3191 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 3192 | + const addLayer = params => { | |
| 3193 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3194 | + if (type === null) return; | |
| 3195 | + | |
| 3196 | + if (!quantity) return; | |
| 3197 | + | |
| 3198 | + const numQuantity = Number(quantity); | |
| 3199 | + const totalLength = Number(length) * scale; | |
| 3200 | + const totalWidth = Number(width) * scale; | |
| 3201 | + const numOffset = Number(offset) * scale; | |
| 3202 | + | |
| 3203 | + // 选择绘制函数 | |
| 3204 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3205 | + | |
| 3206 | + let rectangles = []; | |
| 3207 | + | |
| 3208 | + if (numQuantity === 1) { | |
| 3209 | + rectangles = [ | |
| 3210 | + { | |
| 3211 | + x: (scaledDeep - totalLength) / 2 + numOffset - scaledDeep, | |
| 3212 | + y: scaledHeight - yExtraOffset, | |
| 3213 | + width: totalLength, | |
| 3214 | + height: totalWidth, | |
| 3215 | + }, | |
| 3216 | + ]; | |
| 3217 | + } else if (numQuantity === 2) { | |
| 3218 | + const halfLength = totalLength; | |
| 3219 | + rectangles = [ | |
| 3220 | + { | |
| 3221 | + x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 - scaledDeep, | |
| 3222 | + y: scaledHeight - yExtraOffset, | |
| 3223 | + width: halfLength, | |
| 3224 | + height: totalWidth, | |
| 3225 | + }, | |
| 3226 | + { | |
| 3227 | + x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength - scaledDeep, | |
| 3228 | + y: scaledHeight - yExtraOffset, | |
| 3229 | + width: halfLength, | |
| 3230 | + height: totalWidth, | |
| 3231 | + }, | |
| 3232 | + ]; | |
| 3233 | + } | |
| 3234 | + | |
| 3235 | + rectangles.forEach(rect => { | |
| 3236 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3237 | + }); | |
| 3238 | + }; | |
| 3239 | + const addLayers = params => { | |
| 3240 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3241 | + if (type === null) return; | |
| 3242 | + | |
| 3243 | + if (!quantity) return; | |
| 3244 | + | |
| 3245 | + const numQuantity = Number(quantity); | |
| 3246 | + const totalLength = Number(length) * scale; | |
| 3247 | + const totalWidth = Number(width) * scale; | |
| 3248 | + const numOffset = Number(offset) * scale; | |
| 3249 | + | |
| 3250 | + // 选择绘制函数 | |
| 3251 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3252 | + | |
| 3253 | + let rectangles = []; | |
| 3254 | + | |
| 3255 | + if (numQuantity === 1) { | |
| 3256 | + rectangles = [ | |
| 3257 | + { | |
| 3258 | + x: (scaledDeep - totalLength) / 2 + numOffset + scaledWidth, | |
| 3259 | + y: scaledHeight - yExtraOffset, | |
| 3260 | + width: totalLength, | |
| 3261 | + height: totalWidth, | |
| 3262 | + }, | |
| 3263 | + ]; | |
| 3264 | + } else if (numQuantity === 2) { | |
| 3265 | + const halfLength = totalLength; | |
| 3266 | + rectangles = [ | |
| 3267 | + { | |
| 3268 | + x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 + scaledWidth, | |
| 3269 | + y: scaledHeight - yExtraOffset, | |
| 3270 | + width: halfLength, | |
| 3271 | + height: totalWidth, | |
| 3272 | + }, | |
| 3273 | + { | |
| 3274 | + x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth, | |
| 3275 | + y: scaledHeight - yExtraOffset, | |
| 3276 | + width: halfLength, | |
| 3277 | + height: totalWidth, | |
| 3278 | + }, | |
| 3279 | + ]; | |
| 3280 | + } | |
| 3281 | + | |
| 3282 | + rectangles.forEach(rect => { | |
| 3283 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3284 | + }); | |
| 3285 | + }; | |
| 3286 | + // === 绘制 sType 层 === | |
| 3287 | + addLayer({ | |
| 3288 | + type: sType, | |
| 3289 | + length: sLength, | |
| 3290 | + width: sWidth, | |
| 3291 | + offset: sOffset, | |
| 3292 | + quantity: sQuantity, | |
| 3293 | + isTrapezoid: Number(sType) !== 0, | |
| 3294 | + }); | |
| 3295 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3296 | + addLayer({ | |
| 3297 | + type: cType, | |
| 3298 | + length: cLength, | |
| 3299 | + width: cWidth, | |
| 3300 | + offset: cOffset, | |
| 3301 | + quantity: cQuantity, | |
| 3302 | + isTrapezoid: Number(cType) !== 0, | |
| 3303 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3304 | + }); | |
| 3305 | + addLayers({ | |
| 3306 | + type: sType, | |
| 3307 | + length: sLength, | |
| 3308 | + width: sWidth, | |
| 3309 | + offset: sOffset, | |
| 3310 | + quantity: sQuantity, | |
| 3311 | + isTrapezoid: Number(sType) !== 0, | |
| 3312 | + }); | |
| 3313 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3314 | + addLayers({ | |
| 3315 | + type: cType, | |
| 3316 | + length: cLength, | |
| 3317 | + width: cWidth, | |
| 3318 | + offset: cOffset, | |
| 3319 | + quantity: cQuantity, | |
| 3320 | + isTrapezoid: Number(cType) !== 0, | |
| 3321 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3322 | + }); | |
| 3323 | + // 将 group 添加到 svg | |
| 3324 | + svg.appendChild(g); | |
| 3325 | + } else { | |
| 3326 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, -scaledDeep, scaledHeight)); | |
| 3327 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledDeep + scaledWidth, scaledHeight)); | |
| 3328 | + if (xfhs?.type && dXFHS) { | |
| 3329 | + pathList.push(createText(-scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 3330 | + pathList.push(createText(scaledWidth + scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS)); | |
| 3331 | + } | |
| 1008 | 3332 | } |
| 3333 | + | |
| 1009 | 3334 | // 上方部件 |
| 1010 | - pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep)); | |
| 1011 | - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 1012 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); | |
| 1013 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); | |
| 1014 | - // 插位值 | |
| 1015 | - pathList.push(createText(scaledWidth / 2, -scaledDeep * 2 - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1016 | - } else if (zsbj?.type === "3002" && dZSCW) { | |
| 1017 | - pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1018 | - } else if (zsbj?.type === "3003" && dZSCW) { | |
| 1019 | - pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1020 | - } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 1021 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); | |
| 1022 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight - scaledDeep / 2, 10 * scales, "D")); | |
| 1023 | - | |
| 1024 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, -(scaledDeep * 2 + scaledDeep / 2), scales)); | |
| 1025 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); | |
| 1026 | - | |
| 1027 | - pathList.push(createText(scaledWidth * 0.3, -(scaledDeep * 3) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1028 | - } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 1029 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, -scaledDeep - scaledDeep / 2, scales)); | |
| 1030 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); | |
| 1031 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales)); | |
| 1032 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); | |
| 1033 | - } else if (zsbj?.type && dZSCW) { | |
| 1034 | - pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3335 | + if (zsbj?.type && zsbj?.type === "3009") { | |
| 3336 | + // 先放层1的盒型 | |
| 3337 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj; | |
| 3338 | + | |
| 3339 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 3340 | + const addLayer = params => { | |
| 3341 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3342 | + if (type === null) return; | |
| 3343 | + | |
| 3344 | + if (!quantity) return; | |
| 3345 | + | |
| 3346 | + const numQuantity = Number(quantity); | |
| 3347 | + const totalLength = Number(length) * scale; | |
| 3348 | + const totalWidth = Number(width) * scale; | |
| 3349 | + const numOffset = Number(offset) * scale; | |
| 3350 | + | |
| 3351 | + // 选择绘制函数 | |
| 3352 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3353 | + | |
| 3354 | + let rectangles = []; | |
| 3355 | + | |
| 3356 | + if (numQuantity === 1) { | |
| 3357 | + rectangles = [ | |
| 3358 | + { | |
| 3359 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 3360 | + y: -totalWidth - scaledDeep + yExtraOffset, | |
| 3361 | + width: totalLength, | |
| 3362 | + height: totalWidth, | |
| 3363 | + }, | |
| 3364 | + ]; | |
| 3365 | + } else if (numQuantity === 2) { | |
| 3366 | + const halfLength = totalLength; | |
| 3367 | + rectangles = [ | |
| 3368 | + { | |
| 3369 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 3370 | + y: -totalWidth - scaledDeep + yExtraOffset, | |
| 3371 | + width: halfLength, | |
| 3372 | + height: totalWidth, | |
| 3373 | + }, | |
| 3374 | + { | |
| 3375 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 3376 | + y: -totalWidth - scaledDeep + yExtraOffset, | |
| 3377 | + width: halfLength, | |
| 3378 | + height: totalWidth, | |
| 3379 | + }, | |
| 3380 | + ]; | |
| 3381 | + } | |
| 3382 | + | |
| 3383 | + rectangles.forEach(rect => { | |
| 3384 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3385 | + }); | |
| 3386 | + }; | |
| 3387 | + | |
| 3388 | + // === 绘制 sType 层 === | |
| 3389 | + addLayer({ | |
| 3390 | + type: sType, | |
| 3391 | + length: sLength, | |
| 3392 | + width: sWidth, | |
| 3393 | + offset: sOffset, | |
| 3394 | + quantity: sQuantity, | |
| 3395 | + isTrapezoid: Number(sType) !== 0, | |
| 3396 | + }); | |
| 3397 | + | |
| 3398 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 3399 | + addLayer({ | |
| 3400 | + type: cType, | |
| 3401 | + length: cLength, | |
| 3402 | + width: cWidth, | |
| 3403 | + offset: cOffset, | |
| 3404 | + quantity: cQuantity, | |
| 3405 | + isTrapezoid: Number(cType) !== 0, | |
| 3406 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 3407 | + }); | |
| 3408 | + | |
| 3409 | + // 将分组添加到 SVG | |
| 3410 | + svg.appendChild(g); | |
| 3411 | + } else { | |
| 3412 | + pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep)); | |
| 3413 | + if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 3414 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); | |
| 3415 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); | |
| 3416 | + // 插位值 | |
| 3417 | + pathList.push(createText(scaledWidth / 2, -scaledDeep * 2 - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3418 | + } else if (zsbj?.type === "3002" && dZSCW) { | |
| 3419 | + pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3420 | + } else if (zsbj?.type === "3003" && dZSCW) { | |
| 3421 | + pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3422 | + } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 3423 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales)); | |
| 3424 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight - scaledDeep / 2, 10 * scales, "D")); | |
| 3425 | + | |
| 3426 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, -(scaledDeep * 2 + scaledDeep / 2), scales)); | |
| 3427 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); | |
| 3428 | + | |
| 3429 | + pathList.push(createText(scaledWidth * 0.3, -(scaledDeep * 3) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3430 | + } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 3431 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, -scaledDeep - scaledDeep / 2, scales)); | |
| 3432 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D")); | |
| 3433 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales)); | |
| 3434 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D")); | |
| 3435 | + } else if (zsbj?.type && dZSCW) { | |
| 3436 | + pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 3437 | + } | |
| 1035 | 3438 | } |
| 3439 | + | |
| 1036 | 3440 | // 左边部件 |
| 1037 | - pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); | |
| 1038 | - if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) { | |
| 1039 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1040 | - pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1041 | - pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); | |
| 1042 | - } else if (zxbj?.type === "4004") { | |
| 1043 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1044 | - pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1045 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1046 | - pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1047 | - | |
| 1048 | - pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.2, 10 * scales, dZXCW)); | |
| 1049 | - } else if (zxbj?.type === "4005" && dZXCW) { | |
| 1050 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1051 | - pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1052 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1053 | - pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3441 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 3442 | + // 先放层1的盒型 | |
| 3443 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 3444 | + const addLayer = params => { | |
| 3445 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3446 | + if (type === null) return; | |
| 3447 | + if (!quantity) return; | |
| 3448 | + | |
| 3449 | + const numQuantity = Number(quantity); | |
| 3450 | + const totalLength = Number(length) * scale; | |
| 3451 | + const totalWidth = Number(width) * scale; | |
| 3452 | + const numOffset = Number(offset) * scale; | |
| 3453 | + | |
| 3454 | + // 选择绘制函数 | |
| 3455 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 3456 | + | |
| 3457 | + let rectangles = []; | |
| 3458 | + | |
| 3459 | + if (numQuantity === 1) { | |
| 3460 | + rectangles = [ | |
| 3461 | + { | |
| 3462 | + x: -totalLength - yExtraOffset - scaledDeep, | |
| 3463 | + y: (scaledHeight - totalWidth) / 2 + numOffset, | |
| 3464 | + width: totalLength, | |
| 3465 | + height: totalWidth, | |
| 3466 | + }, | |
| 3467 | + ]; | |
| 3468 | + } else if (numQuantity === 2) { | |
| 3469 | + const halfLength = totalLength; | |
| 3470 | + const halfWidth = totalWidth * 2; | |
| 3471 | + rectangles = [ | |
| 3472 | + { | |
| 3473 | + x: -totalLength - yExtraOffset - scaledDeep, | |
| 3474 | + y: (scaledHeight - halfWidth) / 2 - numOffset / 2, | |
| 3475 | + width: halfLength, | |
| 3476 | + height: totalWidth, | |
| 3477 | + }, | |
| 3478 | + { | |
| 3479 | + x: -totalLength - yExtraOffset - scaledDeep, | |
| 3480 | + y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 3481 | + width: halfLength, | |
| 3482 | + height: totalWidth, | |
| 3483 | + }, | |
| 3484 | + ]; | |
| 3485 | + } | |
| 3486 | + | |
| 3487 | + rectangles.forEach(rect => { | |
| 3488 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3489 | + }); | |
| 3490 | + }; | |
| 3491 | + | |
| 3492 | + // === 绘制 sType 层 === | |
| 3493 | + addLayer({ | |
| 3494 | + type: sType, | |
| 3495 | + length: sLength, | |
| 3496 | + width: sWidth, | |
| 3497 | + offset: sOffset, | |
| 3498 | + quantity: sQuantity, | |
| 3499 | + isTrapezoid: Number(sType) !== 0, | |
| 3500 | + }); | |
| 3501 | + | |
| 3502 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 3503 | + addLayer({ | |
| 3504 | + type: cType, | |
| 3505 | + length: cLength, | |
| 3506 | + width: cWidth, | |
| 3507 | + offset: cOffset, | |
| 3508 | + quantity: cQuantity, | |
| 3509 | + isTrapezoid: Number(cType) !== 0, | |
| 3510 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 3511 | + }); | |
| 3512 | + | |
| 3513 | + // 将分组添加到 SVG | |
| 3514 | + svg.appendChild(g); | |
| 1054 | 3515 | } else { |
| 1055 | - pathList.push(createText(-scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); | |
| 3516 | + pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); | |
| 3517 | + if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) { | |
| 3518 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3519 | + pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3520 | + pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); | |
| 3521 | + } else if (zxbj?.type === "4004") { | |
| 3522 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3523 | + pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3524 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3525 | + pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3526 | + | |
| 3527 | + pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.2, 10 * scales, dZXCW)); | |
| 3528 | + } else if (zxbj?.type === "4005" && dZXCW) { | |
| 3529 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3530 | + pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3531 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3532 | + pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3533 | + } else { | |
| 3534 | + pathList.push(createText(-scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); | |
| 3535 | + } | |
| 1056 | 3536 | } |
| 3537 | + | |
| 1057 | 3538 | // 右边 |
| 1058 | - pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0)); | |
| 1059 | - if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) { | |
| 1060 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1061 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1062 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); | |
| 1063 | - } else if (ysbj?.type === "6004" && dYSCW) { | |
| 1064 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1065 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1066 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1067 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1068 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.2, 10 * scales, dYSCW)); | |
| 1069 | - } else if (zxbj?.type === "4005" && dYSCW) { | |
| 1070 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1071 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 1072 | - pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 1073 | - pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3539 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 3540 | + // 先放层1的盒型 | |
| 3541 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 3542 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 3543 | + const addLayer = params => { | |
| 3544 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3545 | + if (type === null) return; | |
| 3546 | + | |
| 3547 | + if (!quantity) return; | |
| 3548 | + | |
| 3549 | + const numQuantity = Number(quantity); | |
| 3550 | + const totalLength = Number(length) * scale; | |
| 3551 | + const totalWidth = Number(width) * scale; | |
| 3552 | + const numOffset = Number(offset) * scale; | |
| 3553 | + | |
| 3554 | + // 选择绘制函数 | |
| 3555 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 3556 | + | |
| 3557 | + let rectangles = []; | |
| 3558 | + | |
| 3559 | + if (numQuantity === 1) { | |
| 3560 | + rectangles = [ | |
| 3561 | + { | |
| 3562 | + x: scaledWidth + scaledDeep + yExtraOffset, | |
| 3563 | + y: (scaledHeight - totalWidth) / 2 + numOffset, | |
| 3564 | + width: totalLength, | |
| 3565 | + height: totalWidth, | |
| 3566 | + }, | |
| 3567 | + ]; | |
| 3568 | + } else if (numQuantity === 2) { | |
| 3569 | + const halfLength = totalLength; | |
| 3570 | + const halfWidth = totalWidth * 2; | |
| 3571 | + rectangles = [ | |
| 3572 | + { | |
| 3573 | + x: scaledWidth + scaledDeep + yExtraOffset, | |
| 3574 | + y: (scaledHeight - halfWidth) / 2 - numOffset / 2, | |
| 3575 | + width: halfLength, | |
| 3576 | + height: totalWidth, | |
| 3577 | + }, | |
| 3578 | + { | |
| 3579 | + x: scaledWidth + scaledDeep + yExtraOffset, | |
| 3580 | + y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 3581 | + width: halfLength, | |
| 3582 | + height: totalWidth, | |
| 3583 | + }, | |
| 3584 | + ]; | |
| 3585 | + } | |
| 3586 | + | |
| 3587 | + rectangles.forEach(rect => { | |
| 3588 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3589 | + }); | |
| 3590 | + }; | |
| 3591 | + | |
| 3592 | + // === 绘制 sType 层 === | |
| 3593 | + addLayer({ | |
| 3594 | + type: sType, | |
| 3595 | + length: sLength, | |
| 3596 | + width: sWidth, | |
| 3597 | + offset: sOffset, | |
| 3598 | + quantity: sQuantity, | |
| 3599 | + isTrapezoid: Number(sType) !== 0, | |
| 3600 | + }); | |
| 3601 | + | |
| 3602 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 3603 | + addLayer({ | |
| 3604 | + type: cType, | |
| 3605 | + length: cLength, | |
| 3606 | + width: cWidth, | |
| 3607 | + offset: cOffset, | |
| 3608 | + quantity: cQuantity, | |
| 3609 | + isTrapezoid: Number(cType) !== 0, | |
| 3610 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 3611 | + }); | |
| 3612 | + | |
| 3613 | + // 将分组添加到 SVG | |
| 3614 | + svg.appendChild(g); | |
| 1074 | 3615 | } else { |
| 1075 | - pathList.push(createText(scaledWidth + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); | |
| 3616 | + pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0)); | |
| 3617 | + if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) { | |
| 3618 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3619 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3620 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); | |
| 3621 | + } else if (ysbj?.type === "6004" && dYSCW) { | |
| 3622 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3623 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3624 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3625 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3626 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.2, 10 * scales, dYSCW)); | |
| 3627 | + } else if (zxbj?.type === "4005" && dYSCW) { | |
| 3628 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3629 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3630 | + pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales)); | |
| 3631 | + pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); | |
| 3632 | + } else { | |
| 3633 | + pathList.push(createText(scaledWidth + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW)); | |
| 3634 | + } | |
| 1076 | 3635 | } |
| 3636 | + | |
| 1077 | 3637 | // 下方部件 |
| 1078 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep)); | |
| 1079 | - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 1080 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 1081 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 1082 | - // 插位值 | |
| 1083 | - pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep * 2 + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 1084 | - } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 1085 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 1086 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 1087 | - | |
| 1088 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); | |
| 1089 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); | |
| 1090 | - | |
| 1091 | - pathList.push(createText(scaledWidth * 0.3, scaledHeight + scaledDeep * 3 + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 1092 | - } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 1093 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 1094 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 1095 | - pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); | |
| 1096 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); | |
| 1097 | - } else if (dYXCW && yxbj?.type) { | |
| 1098 | - pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 3638 | + if (yxbj?.type && yxbj?.type === "7009") { | |
| 3639 | + // 先放层1的盒型 | |
| 3640 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj; | |
| 3641 | + | |
| 3642 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 3643 | + const addLayer = params => { | |
| 3644 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3645 | + if (type === null) return; | |
| 3646 | + | |
| 3647 | + if (!quantity) return; | |
| 3648 | + | |
| 3649 | + const numQuantity = Number(quantity); | |
| 3650 | + const totalLength = Number(length) * scale; | |
| 3651 | + const totalWidth = Number(width) * scale; | |
| 3652 | + const numOffset = Number(offset) * scale; | |
| 3653 | + | |
| 3654 | + // 选择绘制函数 | |
| 3655 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3656 | + | |
| 3657 | + let rectangles = []; | |
| 3658 | + | |
| 3659 | + if (numQuantity === 1) { | |
| 3660 | + rectangles = [ | |
| 3661 | + { | |
| 3662 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 3663 | + y: scaledHeight + scaledDeep - yExtraOffset, | |
| 3664 | + width: totalLength, | |
| 3665 | + height: totalWidth, | |
| 3666 | + }, | |
| 3667 | + ]; | |
| 3668 | + } else if (numQuantity === 2) { | |
| 3669 | + const halfLength = totalLength; | |
| 3670 | + rectangles = [ | |
| 3671 | + { | |
| 3672 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 3673 | + y: scaledHeight + scaledDeep - yExtraOffset, | |
| 3674 | + width: halfLength, | |
| 3675 | + height: totalWidth, | |
| 3676 | + }, | |
| 3677 | + { | |
| 3678 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2, | |
| 3679 | + y: scaledHeight + scaledDeep - yExtraOffset, | |
| 3680 | + width: halfLength, | |
| 3681 | + height: totalWidth, | |
| 3682 | + }, | |
| 3683 | + ]; | |
| 3684 | + } | |
| 3685 | + | |
| 3686 | + rectangles.forEach(rect => { | |
| 3687 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3688 | + }); | |
| 3689 | + }; | |
| 3690 | + | |
| 3691 | + // === 绘制 sType 层 === | |
| 3692 | + addLayer({ | |
| 3693 | + type: sType, | |
| 3694 | + length: sLength, | |
| 3695 | + width: sWidth, | |
| 3696 | + offset: sOffset, | |
| 3697 | + quantity: sQuantity, | |
| 3698 | + isTrapezoid: Number(sType) !== 0, | |
| 3699 | + }); | |
| 3700 | + | |
| 3701 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 3702 | + addLayer({ | |
| 3703 | + type: cType, | |
| 3704 | + length: cLength, | |
| 3705 | + width: cWidth, | |
| 3706 | + offset: cOffset, | |
| 3707 | + quantity: cQuantity, | |
| 3708 | + isTrapezoid: Number(cType) !== 0, | |
| 3709 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 3710 | + }); | |
| 3711 | + | |
| 3712 | + // 将分组添加到 SVG | |
| 3713 | + svg.appendChild(g); | |
| 3714 | + } else { | |
| 3715 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep)); | |
| 3716 | + if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 3717 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 3718 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 3719 | + // 插位值 | |
| 3720 | + pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep * 2 + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 3721 | + } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 3722 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 3723 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 3724 | + | |
| 3725 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); | |
| 3726 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); | |
| 3727 | + | |
| 3728 | + pathList.push(createText(scaledWidth * 0.3, scaledHeight + scaledDeep * 3 + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 3729 | + } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 3730 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, scaledHeight + scaledDeep + scaledDeep / 2, scales)); | |
| 3731 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D")); | |
| 3732 | + pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales)); | |
| 3733 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D")); | |
| 3734 | + } else if (dYXCW && yxbj?.type) { | |
| 3735 | + pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep + dYXCW / 2 - 5, 10 * scales, dYXCW)); | |
| 3736 | + } | |
| 1099 | 3737 | } |
| 1100 | 3738 | |
| 1101 | 3739 | if (scaledDeep && scaledWidth && scaledHeight) { |
| ... | ... | @@ -1129,134 +3767,884 @@ const SvgBox = props => { |
| 1129 | 3767 | svg.appendChild(g); |
| 1130 | 3768 | let pathList = []; |
| 1131 | 3769 | // 上方盒舌 |
| 1132 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0)); | |
| 1133 | - pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0)); | |
| 1134 | - if (sfhs?.type && dSFHS) { | |
| 1135 | - pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 1136 | - pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3770 | + if (sfhs?.type && sfhs.type === "1009") { | |
| 3771 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs; | |
| 3772 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 3773 | + const addLayer = params => { | |
| 3774 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3775 | + if (type === null) return; | |
| 3776 | + | |
| 3777 | + if (!quantity) return; | |
| 3778 | + | |
| 3779 | + const numQuantity = Number(quantity); | |
| 3780 | + const totalLength = Number(length) * scale; | |
| 3781 | + const totalWidth = Number(width) * scale; | |
| 3782 | + const numOffset = Number(offset) * scale; | |
| 3783 | + | |
| 3784 | + // 选择绘制函数 | |
| 3785 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3786 | + | |
| 3787 | + let rectangles = []; | |
| 3788 | + | |
| 3789 | + if (numQuantity === 1) { | |
| 3790 | + rectangles = [ | |
| 3791 | + { | |
| 3792 | + x: (scaledHeight - totalLength) / 2 + numOffset, | |
| 3793 | + y: -totalWidth + yExtraOffset, | |
| 3794 | + width: totalLength, | |
| 3795 | + height: totalWidth, | |
| 3796 | + }, | |
| 3797 | + ]; | |
| 3798 | + } else if (numQuantity === 2) { | |
| 3799 | + const halfLength = totalLength; | |
| 3800 | + rectangles = [ | |
| 3801 | + { | |
| 3802 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2, | |
| 3803 | + y: -totalWidth + yExtraOffset, | |
| 3804 | + width: halfLength, | |
| 3805 | + height: totalWidth, | |
| 3806 | + }, | |
| 3807 | + { | |
| 3808 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 3809 | + y: -totalWidth + yExtraOffset, | |
| 3810 | + width: halfLength, | |
| 3811 | + height: totalWidth, | |
| 3812 | + }, | |
| 3813 | + ]; | |
| 3814 | + } | |
| 3815 | + | |
| 3816 | + rectangles.forEach(rect => { | |
| 3817 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3818 | + }); | |
| 3819 | + }; | |
| 3820 | + const addLayers = params => { | |
| 3821 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3822 | + if (type === null) return; | |
| 3823 | + | |
| 3824 | + if (!quantity) return; | |
| 3825 | + | |
| 3826 | + const numQuantity = Number(quantity); | |
| 3827 | + const totalLength = Number(length) * scale; | |
| 3828 | + const totalWidth = Number(width) * scale; | |
| 3829 | + const numOffset = Number(offset) * scale; | |
| 3830 | + | |
| 3831 | + // 选择绘制函数 | |
| 3832 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3833 | + | |
| 3834 | + let rectangles = []; | |
| 3835 | + | |
| 3836 | + if (numQuantity === 1) { | |
| 3837 | + rectangles = [ | |
| 3838 | + { | |
| 3839 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight, | |
| 3840 | + y: -totalWidth + yExtraOffset, | |
| 3841 | + width: totalLength, | |
| 3842 | + height: totalWidth, | |
| 3843 | + }, | |
| 3844 | + ]; | |
| 3845 | + } else if (numQuantity === 2) { | |
| 3846 | + const halfLength = totalLength; | |
| 3847 | + rectangles = [ | |
| 3848 | + { | |
| 3849 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight, | |
| 3850 | + y: -totalWidth + yExtraOffset, | |
| 3851 | + width: halfLength, | |
| 3852 | + height: totalWidth, | |
| 3853 | + }, | |
| 3854 | + { | |
| 3855 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight, | |
| 3856 | + y: -totalWidth + yExtraOffset, | |
| 3857 | + width: halfLength, | |
| 3858 | + height: totalWidth, | |
| 3859 | + }, | |
| 3860 | + ]; | |
| 3861 | + } | |
| 3862 | + | |
| 3863 | + rectangles.forEach(rect => { | |
| 3864 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3865 | + }); | |
| 3866 | + }; | |
| 3867 | + // === 绘制 sType 层 === | |
| 3868 | + addLayer({ | |
| 3869 | + type: sType, | |
| 3870 | + length: sLength, | |
| 3871 | + width: sWidth, | |
| 3872 | + offset: sOffset, | |
| 3873 | + quantity: sQuantity, | |
| 3874 | + isTrapezoid: Number(sType) !== 0, | |
| 3875 | + }); | |
| 3876 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3877 | + addLayer({ | |
| 3878 | + type: cType, | |
| 3879 | + length: cLength, | |
| 3880 | + width: cWidth, | |
| 3881 | + offset: cOffset, | |
| 3882 | + quantity: cQuantity, | |
| 3883 | + isTrapezoid: Number(cType) !== 0, | |
| 3884 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3885 | + }); | |
| 3886 | + addLayers({ | |
| 3887 | + type: sType, | |
| 3888 | + length: sLength, | |
| 3889 | + width: sWidth, | |
| 3890 | + offset: sOffset, | |
| 3891 | + quantity: sQuantity, | |
| 3892 | + isTrapezoid: Number(sType) !== 0, | |
| 3893 | + }); | |
| 3894 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 3895 | + addLayers({ | |
| 3896 | + type: cType, | |
| 3897 | + length: cLength, | |
| 3898 | + width: cWidth, | |
| 3899 | + offset: cOffset, | |
| 3900 | + quantity: cQuantity, | |
| 3901 | + isTrapezoid: Number(cType) !== 0, | |
| 3902 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 3903 | + }); | |
| 3904 | + // 将 group 添加到 svg | |
| 3905 | + svg.appendChild(g); | |
| 3906 | + } else { | |
| 3907 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0)); | |
| 3908 | + pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0)); | |
| 3909 | + if (sfhs?.type && dSFHS) { | |
| 3910 | + pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3911 | + pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS)); | |
| 3912 | + } | |
| 1137 | 3913 | } |
| 3914 | + | |
| 1138 | 3915 | // 下方盒舌 |
| 3916 | + if (xfhs?.type && xfhs.type === "2009") { | |
| 3917 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs; | |
| 3918 | + // 通用函数:添加矩形层(支持单双数量、矩形/梯形) | |
| 3919 | + const addLayer = params => { | |
| 3920 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3921 | + if (type === null) return; | |
| 3922 | + | |
| 3923 | + if (!quantity) return; | |
| 3924 | + | |
| 3925 | + const numQuantity = Number(quantity); | |
| 3926 | + const totalLength = Number(length) * scale; | |
| 3927 | + const totalWidth = Number(width) * scale; | |
| 3928 | + const numOffset = Number(offset) * scale; | |
| 3929 | + | |
| 3930 | + // 选择绘制函数 | |
| 3931 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3932 | + | |
| 3933 | + let rectangles = []; | |
| 3934 | + | |
| 3935 | + if (numQuantity === 1) { | |
| 3936 | + rectangles = [ | |
| 3937 | + { | |
| 3938 | + x: (scaledHeight - totalLength) / 2 + numOffset, | |
| 3939 | + y: scaledDeep - yExtraOffset, | |
| 3940 | + width: totalLength, | |
| 3941 | + height: totalWidth, | |
| 3942 | + }, | |
| 3943 | + ]; | |
| 3944 | + } else if (numQuantity === 2) { | |
| 3945 | + const halfLength = totalLength; | |
| 3946 | + rectangles = [ | |
| 3947 | + { | |
| 3948 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2, | |
| 3949 | + y: scaledDeep - yExtraOffset, | |
| 3950 | + width: halfLength, | |
| 3951 | + height: totalWidth, | |
| 3952 | + }, | |
| 3953 | + { | |
| 3954 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 3955 | + y: scaledDeep - yExtraOffset, | |
| 3956 | + width: halfLength, | |
| 3957 | + height: totalWidth, | |
| 3958 | + }, | |
| 3959 | + ]; | |
| 3960 | + } | |
| 3961 | + | |
| 3962 | + rectangles.forEach(rect => { | |
| 3963 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 3964 | + }); | |
| 3965 | + }; | |
| 3966 | + const addLayers = params => { | |
| 3967 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 3968 | + if (type === null) return; | |
| 3969 | + | |
| 3970 | + if (!quantity) return; | |
| 3971 | + | |
| 3972 | + const numQuantity = Number(quantity); | |
| 3973 | + const totalLength = Number(length) * scale; | |
| 3974 | + const totalWidth = Number(width) * scale; | |
| 3975 | + const numOffset = Number(offset) * scale; | |
| 3976 | + | |
| 3977 | + // 选择绘制函数 | |
| 3978 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 3979 | + | |
| 3980 | + let rectangles = []; | |
| 3981 | + | |
| 3982 | + if (numQuantity === 1) { | |
| 3983 | + rectangles = [ | |
| 3984 | + { | |
| 3985 | + x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight, | |
| 3986 | + y: scaledDeep - yExtraOffset, | |
| 3987 | + width: totalLength, | |
| 3988 | + height: totalWidth, | |
| 3989 | + }, | |
| 3990 | + ]; | |
| 3991 | + } else if (numQuantity === 2) { | |
| 3992 | + const halfLength = totalLength; | |
| 3993 | + rectangles = [ | |
| 3994 | + { | |
| 3995 | + x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight, | |
| 3996 | + y: scaledDeep - yExtraOffset, | |
| 3997 | + width: halfLength, | |
| 3998 | + height: totalWidth, | |
| 3999 | + }, | |
| 4000 | + { | |
| 4001 | + x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight, | |
| 4002 | + y: scaledDeep - yExtraOffset, | |
| 4003 | + width: halfLength, | |
| 4004 | + height: totalWidth, | |
| 4005 | + }, | |
| 4006 | + ]; | |
| 4007 | + } | |
| 4008 | + | |
| 4009 | + rectangles.forEach(rect => { | |
| 4010 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4011 | + }); | |
| 4012 | + }; | |
| 4013 | + // === 绘制 sType 层 === | |
| 4014 | + addLayer({ | |
| 4015 | + type: sType, | |
| 4016 | + length: sLength, | |
| 4017 | + width: sWidth, | |
| 4018 | + offset: sOffset, | |
| 4019 | + quantity: sQuantity, | |
| 4020 | + isTrapezoid: Number(sType) !== 0, | |
| 4021 | + }); | |
| 4022 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 4023 | + addLayer({ | |
| 4024 | + type: cType, | |
| 4025 | + length: cLength, | |
| 4026 | + width: cWidth, | |
| 4027 | + offset: cOffset, | |
| 4028 | + quantity: cQuantity, | |
| 4029 | + isTrapezoid: Number(cType) !== 0, | |
| 4030 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 4031 | + }); | |
| 4032 | + addLayers({ | |
| 4033 | + type: sType, | |
| 4034 | + length: sLength, | |
| 4035 | + width: sWidth, | |
| 4036 | + offset: sOffset, | |
| 4037 | + quantity: sQuantity, | |
| 4038 | + isTrapezoid: Number(sType) !== 0, | |
| 4039 | + }); | |
| 4040 | + // === 绘制 cType 层(y 多一个偏移)=== | |
| 4041 | + addLayers({ | |
| 4042 | + type: cType, | |
| 4043 | + length: cLength, | |
| 4044 | + width: cWidth, | |
| 4045 | + offset: cOffset, | |
| 4046 | + quantity: cQuantity, | |
| 4047 | + isTrapezoid: Number(cType) !== 0, | |
| 4048 | + yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方 | |
| 4049 | + }); | |
| 4050 | + // 将 group 添加到 svg | |
| 4051 | + svg.appendChild(g); | |
| 4052 | + } else { | |
| 4053 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth)); | |
| 4054 | + pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth)); | |
| 4055 | + if (xfhs?.type && dXFHS) { | |
| 4056 | + pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); | |
| 4057 | + pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); | |
| 4058 | + } | |
| 4059 | + } | |
| 4060 | + | |
| 4061 | + // 左边贴边 | |
| 4062 | + if (zbtb?.type === "8009") { | |
| 4063 | + // 先放层1的盒型 | |
| 4064 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb; | |
| 4065 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4066 | + const addLayer = params => { | |
| 4067 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4068 | + if (type === null) return; | |
| 4069 | + if (!quantity) return; | |
| 4070 | + | |
| 4071 | + const numQuantity = Number(quantity); | |
| 4072 | + const totalLength = Number(length) * scale; | |
| 4073 | + const totalWidth = Number(width) * scale; | |
| 4074 | + const numOffset = Number(offset) * scale; | |
| 4075 | + | |
| 4076 | + // 选择绘制函数 | |
| 4077 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 1139 | 4078 | |
| 1140 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth)); | |
| 1141 | - pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth)); | |
| 1142 | - if (xfhs?.type && dXFHS) { | |
| 1143 | - pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); | |
| 1144 | - pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS)); | |
| 1145 | - } | |
| 4079 | + let rectangles = []; | |
| 1146 | 4080 | |
| 1147 | - // 左边贴边 | |
| 1148 | - pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 1149 | - if (zbtb?.type && dZTBW) { | |
| 1150 | - pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW)); | |
| 4081 | + if (numQuantity === 1) { | |
| 4082 | + rectangles = [ | |
| 4083 | + { | |
| 4084 | + x: -totalLength - yExtraOffset, | |
| 4085 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 4086 | + width: totalLength, | |
| 4087 | + height: totalWidth, | |
| 4088 | + }, | |
| 4089 | + ]; | |
| 4090 | + } else if (numQuantity === 2) { | |
| 4091 | + const halfLength = totalLength; | |
| 4092 | + const halfWidth = totalWidth * 2; | |
| 4093 | + rectangles = [ | |
| 4094 | + { | |
| 4095 | + x: -totalLength - yExtraOffset, | |
| 4096 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 4097 | + width: halfLength, | |
| 4098 | + height: totalWidth, | |
| 4099 | + }, | |
| 4100 | + { | |
| 4101 | + x: -totalLength - yExtraOffset, | |
| 4102 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 4103 | + width: halfLength, | |
| 4104 | + height: totalWidth, | |
| 4105 | + }, | |
| 4106 | + ]; | |
| 4107 | + } | |
| 4108 | + | |
| 4109 | + rectangles.forEach(rect => { | |
| 4110 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4111 | + }); | |
| 4112 | + }; | |
| 4113 | + | |
| 4114 | + // === 绘制 sType 层 === | |
| 4115 | + addLayer({ | |
| 4116 | + type: sType, | |
| 4117 | + length: sLength, | |
| 4118 | + width: sWidth, | |
| 4119 | + offset: sOffset, | |
| 4120 | + quantity: sQuantity, | |
| 4121 | + isTrapezoid: Number(sType) !== 0, | |
| 4122 | + }); | |
| 4123 | + | |
| 4124 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4125 | + addLayer({ | |
| 4126 | + type: cType, | |
| 4127 | + length: cLength, | |
| 4128 | + width: cWidth, | |
| 4129 | + offset: cOffset, | |
| 4130 | + quantity: cQuantity, | |
| 4131 | + isTrapezoid: Number(cType) !== 0, | |
| 4132 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 4133 | + }); | |
| 4134 | + | |
| 4135 | + // 将分组添加到 SVG | |
| 4136 | + svg.appendChild(g); | |
| 4137 | + } else { | |
| 4138 | + pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale)); | |
| 4139 | + if (zbtb?.type && dZTBW) { | |
| 4140 | + pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW)); | |
| 4141 | + } | |
| 1151 | 4142 | } |
| 4143 | + | |
| 1152 | 4144 | // 右边贴边 |
| 1153 | - pathList.push(createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale)); | |
| 1154 | - if (ybtb?.type && dYTBW) { | |
| 1155 | - pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW)); | |
| 4145 | + if (ybtb?.type === "9009") { | |
| 4146 | + // 先放层1的盒型 | |
| 4147 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 4148 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4149 | + const addLayer = params => { | |
| 4150 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4151 | + if (type === null) return; | |
| 4152 | + | |
| 4153 | + if (!quantity) return; | |
| 4154 | + | |
| 4155 | + const numQuantity = Number(quantity); | |
| 4156 | + const totalLength = Number(length) * scale; | |
| 4157 | + const totalWidth = Number(width) * scale; | |
| 4158 | + const numOffset = Number(offset) * scale; | |
| 4159 | + | |
| 4160 | + // 选择绘制函数 | |
| 4161 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 4162 | + | |
| 4163 | + let rectangles = []; | |
| 4164 | + | |
| 4165 | + if (numQuantity === 1) { | |
| 4166 | + rectangles = [ | |
| 4167 | + { | |
| 4168 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 4169 | + y: (scaledDeep - totalWidth) / 2 + numOffset, | |
| 4170 | + width: totalLength, | |
| 4171 | + height: totalWidth, | |
| 4172 | + }, | |
| 4173 | + ]; | |
| 4174 | + } else if (numQuantity === 2) { | |
| 4175 | + const halfLength = totalLength; | |
| 4176 | + const halfWidth = totalWidth * 2; | |
| 4177 | + rectangles = [ | |
| 4178 | + { | |
| 4179 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 4180 | + y: (scaledDeep - halfWidth) / 2 - numOffset / 2, | |
| 4181 | + width: halfLength, | |
| 4182 | + height: totalWidth, | |
| 4183 | + }, | |
| 4184 | + { | |
| 4185 | + x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset, | |
| 4186 | + y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 4187 | + width: halfLength, | |
| 4188 | + height: totalWidth, | |
| 4189 | + }, | |
| 4190 | + ]; | |
| 4191 | + } | |
| 4192 | + | |
| 4193 | + rectangles.forEach(rect => { | |
| 4194 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4195 | + }); | |
| 4196 | + }; | |
| 4197 | + | |
| 4198 | + // === 绘制 sType 层 === | |
| 4199 | + addLayer({ | |
| 4200 | + type: sType, | |
| 4201 | + length: sLength, | |
| 4202 | + width: sWidth, | |
| 4203 | + offset: sOffset, | |
| 4204 | + quantity: sQuantity, | |
| 4205 | + isTrapezoid: Number(sType) !== 0, | |
| 4206 | + }); | |
| 4207 | + | |
| 4208 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4209 | + addLayer({ | |
| 4210 | + type: cType, | |
| 4211 | + length: cLength, | |
| 4212 | + width: cWidth, | |
| 4213 | + offset: cOffset, | |
| 4214 | + quantity: cQuantity, | |
| 4215 | + isTrapezoid: Number(cType) !== 0, | |
| 4216 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 4217 | + }); | |
| 4218 | + | |
| 4219 | + // 将分组添加到 SVG | |
| 4220 | + svg.appendChild(g); | |
| 4221 | + } else { | |
| 4222 | + pathList.push( | |
| 4223 | + createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale) | |
| 4224 | + ); | |
| 4225 | + if (ybtb?.type && dYTBW) { | |
| 4226 | + pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW)); | |
| 4227 | + } | |
| 1156 | 4228 | } |
| 4229 | + | |
| 1157 | 4230 | // 左上部件 |
| 1158 | - pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0)); | |
| 1159 | - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 1160 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 1161 | - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1162 | - // 插位值 | |
| 1163 | - pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1164 | - } else if (zsbj?.type === "3002" && dZSCW) { | |
| 1165 | - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1166 | - } else if (zsbj?.type === "3003" && dZSCW) { | |
| 1167 | - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1168 | - } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 1169 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 1170 | - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1171 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); | |
| 1172 | - pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 1173 | - pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1174 | - } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 1175 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales)); | |
| 1176 | - pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1177 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); | |
| 1178 | - pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); | |
| 1179 | - } else if (zsbj?.type && dZSCW) { | |
| 1180 | - pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4231 | + if (zsbj?.type && zsbj?.type === "3009") { | |
| 4232 | + // 先放层1的盒型 | |
| 4233 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj; | |
| 4234 | + | |
| 4235 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4236 | + const addLayer = params => { | |
| 4237 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4238 | + if (type === null) return; | |
| 4239 | + | |
| 4240 | + if (!quantity) return; | |
| 4241 | + | |
| 4242 | + const numQuantity = Number(quantity); | |
| 4243 | + const totalLength = Number(length) * scale; | |
| 4244 | + const totalWidth = Number(width) * scale; | |
| 4245 | + const numOffset = Number(offset) * scale; | |
| 4246 | + | |
| 4247 | + // 选择绘制函数 | |
| 4248 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4249 | + | |
| 4250 | + let rectangles = []; | |
| 4251 | + | |
| 4252 | + if (numQuantity === 1) { | |
| 4253 | + rectangles = [ | |
| 4254 | + { | |
| 4255 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight, | |
| 4256 | + y: -totalWidth + yExtraOffset, | |
| 4257 | + width: totalLength, | |
| 4258 | + height: totalWidth, | |
| 4259 | + }, | |
| 4260 | + ]; | |
| 4261 | + } else if (numQuantity === 2) { | |
| 4262 | + const halfLength = totalLength; | |
| 4263 | + rectangles = [ | |
| 4264 | + { | |
| 4265 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight, | |
| 4266 | + y: -totalWidth + yExtraOffset, | |
| 4267 | + width: halfLength, | |
| 4268 | + height: totalWidth, | |
| 4269 | + }, | |
| 4270 | + { | |
| 4271 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight, | |
| 4272 | + y: -totalWidth + yExtraOffset, | |
| 4273 | + width: halfLength, | |
| 4274 | + height: totalWidth, | |
| 4275 | + }, | |
| 4276 | + ]; | |
| 4277 | + } | |
| 4278 | + | |
| 4279 | + rectangles.forEach(rect => { | |
| 4280 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4281 | + }); | |
| 4282 | + }; | |
| 4283 | + | |
| 4284 | + // === 绘制 sType 层 === | |
| 4285 | + addLayer({ | |
| 4286 | + type: sType, | |
| 4287 | + length: sLength, | |
| 4288 | + width: sWidth, | |
| 4289 | + offset: sOffset, | |
| 4290 | + quantity: sQuantity, | |
| 4291 | + isTrapezoid: Number(sType) !== 0, | |
| 4292 | + }); | |
| 4293 | + | |
| 4294 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4295 | + addLayer({ | |
| 4296 | + type: cType, | |
| 4297 | + length: cLength, | |
| 4298 | + width: cWidth, | |
| 4299 | + offset: cOffset, | |
| 4300 | + quantity: cQuantity, | |
| 4301 | + isTrapezoid: Number(cType) !== 0, | |
| 4302 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4303 | + }); | |
| 4304 | + | |
| 4305 | + // 将分组添加到 SVG | |
| 4306 | + svg.appendChild(g); | |
| 4307 | + } else { | |
| 4308 | + pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0)); | |
| 4309 | + if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 4310 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 4311 | + pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4312 | + // 插位值 | |
| 4313 | + pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4314 | + } else if (zsbj?.type === "3002" && dZSCW) { | |
| 4315 | + pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4316 | + } else if (zsbj?.type === "3003" && dZSCW) { | |
| 4317 | + pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4318 | + } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 4319 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 4320 | + pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4321 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); | |
| 4322 | + pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 4323 | + pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4324 | + } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 4325 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales)); | |
| 4326 | + pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4327 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); | |
| 4328 | + pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); | |
| 4329 | + } else if (zsbj?.type && dZSCW) { | |
| 4330 | + pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4331 | + } | |
| 1181 | 4332 | } |
| 4333 | + | |
| 1182 | 4334 | // 右上部件 |
| 1183 | - pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0)); | |
| 1184 | - if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 1185 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 1186 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1187 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW)); | |
| 1188 | - } else if (ysbj?.type === "6002" && dYSCW) { | |
| 1189 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1190 | - } else if (ysbj?.type === "6003" && dYSCW) { | |
| 1191 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1192 | - } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 1193 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 1194 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1195 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); | |
| 1196 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 1197 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 1198 | - } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 1199 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales)); | |
| 1200 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 1201 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); | |
| 1202 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 1203 | - } else if (ysbj?.type && dYSCW) { | |
| 1204 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 4335 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 4336 | + // 先放层1的盒型 | |
| 4337 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj; | |
| 4338 | + | |
| 4339 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4340 | + const addLayer = params => { | |
| 4341 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4342 | + if (type === null) return; | |
| 4343 | + | |
| 4344 | + if (!quantity) return; | |
| 4345 | + | |
| 4346 | + const numQuantity = Number(quantity); | |
| 4347 | + const totalLength = Number(length) * scale; | |
| 4348 | + const totalWidth = Number(width) * scale; | |
| 4349 | + const numOffset = Number(offset) * scale; | |
| 4350 | + | |
| 4351 | + // 选择绘制函数 | |
| 4352 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4353 | + | |
| 4354 | + let rectangles = []; | |
| 4355 | + | |
| 4356 | + if (numQuantity === 1) { | |
| 4357 | + rectangles = [ | |
| 4358 | + { | |
| 4359 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight * 2 + scaledWidth, | |
| 4360 | + y: -totalWidth + yExtraOffset, | |
| 4361 | + width: totalLength, | |
| 4362 | + height: totalWidth, | |
| 4363 | + }, | |
| 4364 | + ]; | |
| 4365 | + } else if (numQuantity === 2) { | |
| 4366 | + const halfLength = totalLength; | |
| 4367 | + rectangles = [ | |
| 4368 | + { | |
| 4369 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight * 2 + scaledWidth, | |
| 4370 | + y: -totalWidth + yExtraOffset, | |
| 4371 | + width: halfLength, | |
| 4372 | + height: totalWidth, | |
| 4373 | + }, | |
| 4374 | + { | |
| 4375 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight * 2 + scaledWidth, | |
| 4376 | + y: -totalWidth + yExtraOffset, | |
| 4377 | + width: halfLength, | |
| 4378 | + height: totalWidth, | |
| 4379 | + }, | |
| 4380 | + ]; | |
| 4381 | + } | |
| 4382 | + | |
| 4383 | + rectangles.forEach(rect => { | |
| 4384 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4385 | + }); | |
| 4386 | + }; | |
| 4387 | + | |
| 4388 | + // === 绘制 sType 层 === | |
| 4389 | + addLayer({ | |
| 4390 | + type: sType, | |
| 4391 | + length: sLength, | |
| 4392 | + width: sWidth, | |
| 4393 | + offset: sOffset, | |
| 4394 | + quantity: sQuantity, | |
| 4395 | + isTrapezoid: Number(sType) !== 0, | |
| 4396 | + }); | |
| 4397 | + | |
| 4398 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4399 | + addLayer({ | |
| 4400 | + type: cType, | |
| 4401 | + length: cLength, | |
| 4402 | + width: cWidth, | |
| 4403 | + offset: cOffset, | |
| 4404 | + quantity: cQuantity, | |
| 4405 | + isTrapezoid: Number(cType) !== 0, | |
| 4406 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4407 | + }); | |
| 4408 | + | |
| 4409 | + // 将分组添加到 SVG | |
| 4410 | + svg.appendChild(g); | |
| 4411 | + } else { | |
| 4412 | + pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0)); | |
| 4413 | + if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) { | |
| 4414 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 4415 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4416 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW)); | |
| 4417 | + } else if (ysbj?.type === "6002" && dYSCW) { | |
| 4418 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 4419 | + } else if (ysbj?.type === "6003" && dYSCW) { | |
| 4420 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 4421 | + } else if (ysbj?.type === "6004" && ysbj?.value) { | |
| 4422 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales)); | |
| 4423 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4424 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales)); | |
| 4425 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 4426 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 4427 | + } else if (ysbj?.type === "6005" && ysbj?.value) { | |
| 4428 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales)); | |
| 4429 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); | |
| 4430 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); | |
| 4431 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 4432 | + } else if (ysbj?.type && dYSCW) { | |
| 4433 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); | |
| 4434 | + } | |
| 1205 | 4435 | } |
| 4436 | + | |
| 1206 | 4437 | // 左下部件- |
| 1207 | 4438 | |
| 1208 | 4439 | if (!(hdzj && hdzj.type)) { |
| 1209 | - pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth)); | |
| 1210 | - if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 1211 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 1212 | - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1213 | - pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1214 | - } else if (zxbj?.type === "4002" && dZXCW) { | |
| 1215 | - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1216 | - } else if (zxbj?.type === "4003" && dZXCW) { | |
| 1217 | - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1218 | - } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 1219 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 1220 | - pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1221 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); | |
| 1222 | - pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D")); | |
| 1223 | - pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 1224 | - } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 1225 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); | |
| 1226 | - pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1227 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); | |
| 1228 | - pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 1229 | - } else if (zxbj?.type && dZXCW) { | |
| 1230 | - pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4440 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 4441 | + // 先放层1的盒型 | |
| 4442 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 4443 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4444 | + const addLayer = params => { | |
| 4445 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4446 | + if (type === null) return; | |
| 4447 | + | |
| 4448 | + if (!quantity) return; | |
| 4449 | + | |
| 4450 | + const numQuantity = Number(quantity); | |
| 4451 | + const totalLength = Number(length) * scale; | |
| 4452 | + const totalWidth = Number(width) * scale; | |
| 4453 | + const numOffset = Number(offset) * scale; | |
| 4454 | + | |
| 4455 | + // 选择绘制函数 | |
| 4456 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4457 | + | |
| 4458 | + let rectangles = []; | |
| 4459 | + | |
| 4460 | + if (numQuantity === 1) { | |
| 4461 | + rectangles = [ | |
| 4462 | + { | |
| 4463 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight, | |
| 4464 | + y: scaledDeep - yExtraOffset, | |
| 4465 | + width: totalLength, | |
| 4466 | + height: totalWidth, | |
| 4467 | + }, | |
| 4468 | + ]; | |
| 4469 | + } else if (numQuantity === 2) { | |
| 4470 | + const halfLength = totalLength; | |
| 4471 | + rectangles = [ | |
| 4472 | + { | |
| 4473 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight, | |
| 4474 | + y: scaledDeep - yExtraOffset, | |
| 4475 | + width: halfLength, | |
| 4476 | + height: totalWidth, | |
| 4477 | + }, | |
| 4478 | + { | |
| 4479 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight, | |
| 4480 | + y: scaledDeep - yExtraOffset, | |
| 4481 | + width: halfLength, | |
| 4482 | + height: totalWidth, | |
| 4483 | + }, | |
| 4484 | + ]; | |
| 4485 | + } | |
| 4486 | + | |
| 4487 | + rectangles.forEach(rect => { | |
| 4488 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4489 | + }); | |
| 4490 | + }; | |
| 4491 | + | |
| 4492 | + // === 绘制 sType 层 === | |
| 4493 | + addLayer({ | |
| 4494 | + type: sType, | |
| 4495 | + length: sLength, | |
| 4496 | + width: sWidth, | |
| 4497 | + offset: sOffset, | |
| 4498 | + quantity: sQuantity, | |
| 4499 | + isTrapezoid: Number(sType) !== 0, | |
| 4500 | + }); | |
| 4501 | + | |
| 4502 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4503 | + addLayer({ | |
| 4504 | + type: cType, | |
| 4505 | + length: cLength, | |
| 4506 | + width: cWidth, | |
| 4507 | + offset: cOffset, | |
| 4508 | + quantity: cQuantity, | |
| 4509 | + isTrapezoid: Number(cType) !== 0, | |
| 4510 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4511 | + }); | |
| 4512 | + | |
| 4513 | + // 将分组添加到 SVG | |
| 4514 | + svg.appendChild(g); | |
| 4515 | + } else { | |
| 4516 | + pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth)); | |
| 4517 | + if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) { | |
| 4518 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 4519 | + pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4520 | + pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4521 | + } else if (zxbj?.type === "4002" && dZXCW) { | |
| 4522 | + pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4523 | + } else if (zxbj?.type === "4003" && dZXCW) { | |
| 4524 | + pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4525 | + } else if (zxbj?.type === "4004" && zxbj?.value) { | |
| 4526 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 4527 | + pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4528 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); | |
| 4529 | + pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D")); | |
| 4530 | + pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4531 | + } else if (zxbj?.type === "4005" && zxbj?.value) { | |
| 4532 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); | |
| 4533 | + pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4534 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); | |
| 4535 | + pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); | |
| 4536 | + } else if (zxbj?.type && dZXCW) { | |
| 4537 | + pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); | |
| 4538 | + } | |
| 1231 | 4539 | } |
| 1232 | 4540 | } |
| 1233 | 4541 | if (!(hdzj && hdzj.type)) { |
| 1234 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth)); | |
| 1235 | - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 1236 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 1237 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1238 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW)); | |
| 1239 | - } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 1240 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 1241 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1242 | - pathList.push( | |
| 1243 | - createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales) | |
| 1244 | - ); | |
| 1245 | - pathList.push( | |
| 1246 | - createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") | |
| 1247 | - ); | |
| 1248 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 1249 | - } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 1250 | - pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); | |
| 1251 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 1252 | - pathList.push( | |
| 1253 | - createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales) | |
| 1254 | - ); | |
| 1255 | - pathList.push( | |
| 1256 | - createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") | |
| 1257 | - ); | |
| 1258 | - } else if (dYXCW && yxbj?.type) { | |
| 1259 | - pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 4542 | + if (yxbj?.type && yxbj?.type === "7009") { | |
| 4543 | + // 先放层1的盒型 | |
| 4544 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj; | |
| 4545 | + | |
| 4546 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4547 | + const addLayer = params => { | |
| 4548 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4549 | + if (type === null) return; | |
| 4550 | + | |
| 4551 | + if (!quantity) return; | |
| 4552 | + | |
| 4553 | + const numQuantity = Number(quantity); | |
| 4554 | + const totalLength = Number(length) * scale; | |
| 4555 | + const totalWidth = Number(width) * scale; | |
| 4556 | + const numOffset = Number(offset) * scale; | |
| 4557 | + | |
| 4558 | + // 选择绘制函数 | |
| 4559 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4560 | + | |
| 4561 | + let rectangles = []; | |
| 4562 | + | |
| 4563 | + if (numQuantity === 1) { | |
| 4564 | + rectangles = [ | |
| 4565 | + { | |
| 4566 | + x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight * 2 + scaledWidth, | |
| 4567 | + y: scaledDeep - yExtraOffset, | |
| 4568 | + width: totalLength, | |
| 4569 | + height: totalWidth, | |
| 4570 | + }, | |
| 4571 | + ]; | |
| 4572 | + } else if (numQuantity === 2) { | |
| 4573 | + const halfLength = totalLength; | |
| 4574 | + rectangles = [ | |
| 4575 | + { | |
| 4576 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight * 2 + scaledWidth, | |
| 4577 | + y: scaledDeep - yExtraOffset, | |
| 4578 | + width: halfLength, | |
| 4579 | + height: totalWidth, | |
| 4580 | + }, | |
| 4581 | + { | |
| 4582 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight * 2 + scaledWidth, | |
| 4583 | + y: scaledDeep - yExtraOffset, | |
| 4584 | + width: halfLength, | |
| 4585 | + height: totalWidth, | |
| 4586 | + }, | |
| 4587 | + ]; | |
| 4588 | + } | |
| 4589 | + | |
| 4590 | + rectangles.forEach(rect => { | |
| 4591 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4592 | + }); | |
| 4593 | + }; | |
| 4594 | + | |
| 4595 | + // === 绘制 sType 层 === | |
| 4596 | + addLayer({ | |
| 4597 | + type: sType, | |
| 4598 | + length: sLength, | |
| 4599 | + width: sWidth, | |
| 4600 | + offset: sOffset, | |
| 4601 | + quantity: sQuantity, | |
| 4602 | + isTrapezoid: Number(sType) !== 0, | |
| 4603 | + }); | |
| 4604 | + | |
| 4605 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4606 | + addLayer({ | |
| 4607 | + type: cType, | |
| 4608 | + length: cLength, | |
| 4609 | + width: cWidth, | |
| 4610 | + offset: cOffset, | |
| 4611 | + quantity: cQuantity, | |
| 4612 | + isTrapezoid: Number(cType) !== 0, | |
| 4613 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4614 | + }); | |
| 4615 | + | |
| 4616 | + // 将分组添加到 SVG | |
| 4617 | + svg.appendChild(g); | |
| 4618 | + } else { | |
| 4619 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth)); | |
| 4620 | + if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | |
| 4621 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 4622 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4623 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW)); | |
| 4624 | + } else if (yxbj?.type === "7004" && yxbj?.value) { | |
| 4625 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales)); | |
| 4626 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4627 | + pathList.push( | |
| 4628 | + createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales) | |
| 4629 | + ); | |
| 4630 | + pathList.push( | |
| 4631 | + createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") | |
| 4632 | + ); | |
| 4633 | + pathList.push( | |
| 4634 | + createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW) | |
| 4635 | + ); | |
| 4636 | + } else if (yxbj?.type === "7005" && yxbj?.value) { | |
| 4637 | + pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales)); | |
| 4638 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); | |
| 4639 | + pathList.push( | |
| 4640 | + createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales) | |
| 4641 | + ); | |
| 4642 | + pathList.push( | |
| 4643 | + createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D") | |
| 4644 | + ); | |
| 4645 | + } else if (dYXCW && yxbj?.type) { | |
| 4646 | + pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW)); | |
| 4647 | + } | |
| 1260 | 4648 | } |
| 1261 | 4649 | } |
| 1262 | 4650 | // 右下部件 |
| ... | ... | @@ -1292,32 +4680,344 @@ const SvgBox = props => { |
| 1292 | 4680 | // svg.appendChild(g); |
| 1293 | 4681 | let pathList = []; |
| 1294 | 4682 | // 左上部件 |
| 1295 | - pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); | |
| 1296 | - if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 1297 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 1298 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1299 | - pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1300 | - } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 1301 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 1302 | - pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1303 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 1304 | - pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 1305 | - pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 1306 | - } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 1307 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 1308 | - pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 1309 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 1310 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 1311 | - pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 1312 | - } else if (zsbj?.type && dZSCW) { | |
| 1313 | - pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); | |
| 4683 | + if (zsbj?.type && zsbj?.type === "3009") { | |
| 4684 | + // 先放层1的盒型 | |
| 4685 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj; | |
| 4686 | + | |
| 4687 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4688 | + const addLayer = params => { | |
| 4689 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4690 | + if (type === null) return; | |
| 4691 | + | |
| 4692 | + if (!quantity) return; | |
| 4693 | + | |
| 4694 | + const numQuantity = Number(quantity); | |
| 4695 | + const totalLength = Number(length) * scale; | |
| 4696 | + const totalWidth = Number(width) * scale; | |
| 4697 | + const numOffset = Number(offset) * scale; | |
| 4698 | + | |
| 4699 | + // 选择绘制函数 | |
| 4700 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4701 | + | |
| 4702 | + let rectangles = []; | |
| 4703 | + | |
| 4704 | + if (numQuantity === 1) { | |
| 4705 | + rectangles = [ | |
| 4706 | + { | |
| 4707 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 4708 | + y: -totalWidth + yExtraOffset, | |
| 4709 | + width: totalLength, | |
| 4710 | + height: totalWidth, | |
| 4711 | + }, | |
| 4712 | + ]; | |
| 4713 | + } else if (numQuantity === 2) { | |
| 4714 | + const halfLength = totalLength; | |
| 4715 | + rectangles = [ | |
| 4716 | + { | |
| 4717 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 4718 | + y: -totalWidth + yExtraOffset, | |
| 4719 | + width: halfLength, | |
| 4720 | + height: totalWidth, | |
| 4721 | + }, | |
| 4722 | + { | |
| 4723 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength, | |
| 4724 | + y: -totalWidth + yExtraOffset, | |
| 4725 | + width: halfLength, | |
| 4726 | + height: totalWidth, | |
| 4727 | + }, | |
| 4728 | + ]; | |
| 4729 | + } | |
| 4730 | + | |
| 4731 | + rectangles.forEach(rect => { | |
| 4732 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4733 | + }); | |
| 4734 | + }; | |
| 4735 | + | |
| 4736 | + // === 绘制 sType 层 === | |
| 4737 | + addLayer({ | |
| 4738 | + type: sType, | |
| 4739 | + length: sLength, | |
| 4740 | + width: sWidth, | |
| 4741 | + offset: sOffset, | |
| 4742 | + quantity: sQuantity, | |
| 4743 | + isTrapezoid: Number(sType) !== 0, | |
| 4744 | + }); | |
| 4745 | + | |
| 4746 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4747 | + addLayer({ | |
| 4748 | + type: cType, | |
| 4749 | + length: cLength, | |
| 4750 | + width: cWidth, | |
| 4751 | + offset: cOffset, | |
| 4752 | + quantity: cQuantity, | |
| 4753 | + isTrapezoid: Number(cType) !== 0, | |
| 4754 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4755 | + }); | |
| 4756 | + | |
| 4757 | + // 将分组添加到 SVG | |
| 4758 | + svg.appendChild(g); | |
| 4759 | + } else { | |
| 4760 | + pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); | |
| 4761 | + if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | |
| 4762 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 4763 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 4764 | + pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4765 | + } else if (zsbj?.type === "3004" && zsbj?.value) { | |
| 4766 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | |
| 4767 | + pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 4768 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales)); | |
| 4769 | + pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 4770 | + pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW)); | |
| 4771 | + } else if (zsbj?.type === "3005" && zsbj?.value) { | |
| 4772 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales)); | |
| 4773 | + pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W")); | |
| 4774 | + pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales)); | |
| 4775 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 4776 | + pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")); | |
| 4777 | + } else if (zsbj?.type && dZSCW) { | |
| 4778 | + pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); | |
| 4779 | + } | |
| 1314 | 4780 | } |
| 4781 | + | |
| 1315 | 4782 | // 右下部件 |
| 1316 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); | |
| 4783 | + if (yxbj?.type && yxbj?.type === "7009") { | |
| 4784 | + // 先放层1的盒型 | |
| 4785 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj; | |
| 4786 | + | |
| 4787 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4788 | + const addLayer = params => { | |
| 4789 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4790 | + if (type === null) return; | |
| 4791 | + | |
| 4792 | + if (!quantity) return; | |
| 4793 | + | |
| 4794 | + const numQuantity = Number(quantity); | |
| 4795 | + const totalLength = Number(length) * scale; | |
| 4796 | + const totalWidth = Number(width) * scale; | |
| 4797 | + const numOffset = Number(offset) * scale; | |
| 4798 | + | |
| 4799 | + // 选择绘制函数 | |
| 4800 | + const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements; | |
| 4801 | + | |
| 4802 | + let rectangles = []; | |
| 4803 | + | |
| 4804 | + if (numQuantity === 1) { | |
| 4805 | + rectangles = [ | |
| 4806 | + { | |
| 4807 | + x: (scaledWidth - totalLength) / 2 + numOffset, | |
| 4808 | + y: scaledHeight - yExtraOffset, | |
| 4809 | + width: totalLength, | |
| 4810 | + height: totalWidth, | |
| 4811 | + }, | |
| 4812 | + ]; | |
| 4813 | + } else if (numQuantity === 2) { | |
| 4814 | + const halfLength = totalLength; | |
| 4815 | + rectangles = [ | |
| 4816 | + { | |
| 4817 | + x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2, | |
| 4818 | + y: scaledHeight - yExtraOffset, | |
| 4819 | + width: halfLength, | |
| 4820 | + height: totalWidth, | |
| 4821 | + }, | |
| 4822 | + { | |
| 4823 | + x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2, | |
| 4824 | + y: scaledHeight - yExtraOffset, | |
| 4825 | + width: halfLength, | |
| 4826 | + height: totalWidth, | |
| 4827 | + }, | |
| 4828 | + ]; | |
| 4829 | + } | |
| 4830 | + | |
| 4831 | + rectangles.forEach(rect => { | |
| 4832 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4833 | + }); | |
| 4834 | + }; | |
| 4835 | + | |
| 4836 | + // === 绘制 sType 层 === | |
| 4837 | + addLayer({ | |
| 4838 | + type: sType, | |
| 4839 | + length: sLength, | |
| 4840 | + width: sWidth, | |
| 4841 | + offset: sOffset, | |
| 4842 | + quantity: sQuantity, | |
| 4843 | + isTrapezoid: Number(sType) !== 0, | |
| 4844 | + }); | |
| 4845 | + | |
| 4846 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4847 | + addLayer({ | |
| 4848 | + type: cType, | |
| 4849 | + length: cLength, | |
| 4850 | + width: cWidth, | |
| 4851 | + offset: cOffset, | |
| 4852 | + quantity: cQuantity, | |
| 4853 | + isTrapezoid: Number(cType) !== 0, | |
| 4854 | + yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移 | |
| 4855 | + }); | |
| 4856 | + | |
| 4857 | + // 将分组添加到 SVG | |
| 4858 | + svg.appendChild(g); | |
| 4859 | + } else { | |
| 4860 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); | |
| 4861 | + } | |
| 1317 | 4862 | |
| 1318 | 4863 | // 右边 |
| 1319 | - pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); | |
| 1320 | - pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); | |
| 4864 | + if (ysbj?.type && ysbj?.type === "6009") { | |
| 4865 | + // 先放层1的盒型 | |
| 4866 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb; | |
| 4867 | + // 通用函数:添加一层矩形(支持单双、矩形/梯形) | |
| 4868 | + const addLayer = params => { | |
| 4869 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4870 | + if (type === null) return; | |
| 4871 | + | |
| 4872 | + if (!quantity) return; | |
| 4873 | + | |
| 4874 | + const numQuantity = Number(quantity); | |
| 4875 | + const totalLength = Number(length) * scale; | |
| 4876 | + const totalWidth = Number(width) * scale; | |
| 4877 | + const numOffset = Number(offset) * scale; | |
| 4878 | + | |
| 4879 | + // 选择绘制函数 | |
| 4880 | + const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements; | |
| 4881 | + | |
| 4882 | + let rectangles = []; | |
| 4883 | + | |
| 4884 | + if (numQuantity === 1) { | |
| 4885 | + rectangles = [ | |
| 4886 | + { | |
| 4887 | + x: scaledWidth + yExtraOffset, | |
| 4888 | + y: (scaledHeight - totalWidth) / 2 + numOffset, | |
| 4889 | + width: totalLength, | |
| 4890 | + height: totalWidth, | |
| 4891 | + }, | |
| 4892 | + ]; | |
| 4893 | + } else if (numQuantity === 2) { | |
| 4894 | + const halfLength = totalLength; | |
| 4895 | + const halfWidth = totalWidth * 2; | |
| 4896 | + rectangles = [ | |
| 4897 | + { | |
| 4898 | + x: scaledWidth + yExtraOffset, | |
| 4899 | + y: (scaledHeight - halfWidth) / 2 - numOffset / 2, | |
| 4900 | + width: halfLength, | |
| 4901 | + height: totalWidth, | |
| 4902 | + }, | |
| 4903 | + { | |
| 4904 | + x: scaledWidth + yExtraOffset, | |
| 4905 | + y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 4906 | + width: halfLength, | |
| 4907 | + height: totalWidth, | |
| 4908 | + }, | |
| 4909 | + ]; | |
| 4910 | + } | |
| 4911 | + | |
| 4912 | + rectangles.forEach(rect => { | |
| 4913 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4914 | + }); | |
| 4915 | + }; | |
| 4916 | + | |
| 4917 | + // === 绘制 sType 层 === | |
| 4918 | + addLayer({ | |
| 4919 | + type: sType, | |
| 4920 | + length: sLength, | |
| 4921 | + width: sWidth, | |
| 4922 | + offset: sOffset, | |
| 4923 | + quantity: sQuantity, | |
| 4924 | + isTrapezoid: Number(sType) !== 0, | |
| 4925 | + }); | |
| 4926 | + | |
| 4927 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 4928 | + addLayer({ | |
| 4929 | + type: cType, | |
| 4930 | + length: cLength, | |
| 4931 | + width: cWidth, | |
| 4932 | + offset: cOffset, | |
| 4933 | + quantity: cQuantity, | |
| 4934 | + isTrapezoid: Number(cType) !== 0, | |
| 4935 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 4936 | + }); | |
| 4937 | + | |
| 4938 | + // 将分组添加到 SVG | |
| 4939 | + svg.appendChild(g); | |
| 4940 | + } else { | |
| 4941 | + pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); | |
| 4942 | + } | |
| 4943 | + // 左边 | |
| 4944 | + if (zxbj?.type && zxbj?.type === "4009") { | |
| 4945 | + // 先放层1的盒型 | |
| 4946 | + const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj; | |
| 4947 | + const addLayer = params => { | |
| 4948 | + const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params; | |
| 4949 | + if (type === null) return; | |
| 4950 | + if (!quantity) return; | |
| 4951 | + | |
| 4952 | + const numQuantity = Number(quantity); | |
| 4953 | + const totalLength = Number(length) * scale; | |
| 4954 | + const totalWidth = Number(width) * scale; | |
| 4955 | + const numOffset = Number(offset) * scale; | |
| 4956 | + | |
| 4957 | + // 选择绘制函数 | |
| 4958 | + const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements; | |
| 4959 | + | |
| 4960 | + let rectangles = []; | |
| 4961 | + | |
| 4962 | + if (numQuantity === 1) { | |
| 4963 | + rectangles = [ | |
| 4964 | + { | |
| 4965 | + x: -totalLength - yExtraOffset, | |
| 4966 | + y: (scaledHeight - totalWidth) / 2 + numOffset, | |
| 4967 | + width: totalLength, | |
| 4968 | + height: totalWidth, | |
| 4969 | + }, | |
| 4970 | + ]; | |
| 4971 | + } else if (numQuantity === 2) { | |
| 4972 | + const halfLength = totalLength; | |
| 4973 | + const halfWidth = totalWidth * 2; | |
| 4974 | + rectangles = [ | |
| 4975 | + { | |
| 4976 | + x: -totalLength - yExtraOffset, | |
| 4977 | + y: (scaledHeight - halfWidth) / 2 - numOffset / 2, | |
| 4978 | + width: halfLength, | |
| 4979 | + height: totalWidth, | |
| 4980 | + }, | |
| 4981 | + { | |
| 4982 | + x: -totalLength - yExtraOffset, | |
| 4983 | + y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth, | |
| 4984 | + width: halfLength, | |
| 4985 | + height: totalWidth, | |
| 4986 | + }, | |
| 4987 | + ]; | |
| 4988 | + } | |
| 4989 | + | |
| 4990 | + rectangles.forEach(rect => { | |
| 4991 | + g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height)); | |
| 4992 | + }); | |
| 4993 | + }; | |
| 4994 | + | |
| 4995 | + // === 绘制 sType 层 === | |
| 4996 | + addLayer({ | |
| 4997 | + type: sType, | |
| 4998 | + length: sLength, | |
| 4999 | + width: sWidth, | |
| 5000 | + offset: sOffset, | |
| 5001 | + quantity: sQuantity, | |
| 5002 | + isTrapezoid: Number(sType) !== 0, | |
| 5003 | + }); | |
| 5004 | + | |
| 5005 | + // === 绘制 cType 层(在 s 层下方)=== | |
| 5006 | + addLayer({ | |
| 5007 | + type: cType, | |
| 5008 | + length: cLength, | |
| 5009 | + width: cWidth, | |
| 5010 | + offset: cOffset, | |
| 5011 | + quantity: cQuantity, | |
| 5012 | + isTrapezoid: Number(cType) !== 0, | |
| 5013 | + yExtraOffset: Number(sLength) * scale, // sWidth 的偏移 | |
| 5014 | + }); | |
| 5015 | + | |
| 5016 | + // 将分组添加到 SVG | |
| 5017 | + svg.appendChild(g); | |
| 5018 | + } else { | |
| 5019 | + pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); | |
| 5020 | + } | |
| 1321 | 5021 | |
| 1322 | 5022 | pathList.forEach(x => { |
| 1323 | 5023 | g.appendChild(x); |
| ... | ... | @@ -1468,17 +5168,33 @@ const SvgBox = props => { |
| 1468 | 5168 | const dY = Number(yscw?.value) || 0; |
| 1469 | 5169 | |
| 1470 | 5170 | if (svg === 8) { |
| 1471 | - const scw = val.find(x => x.sName === "上插位组件"); | |
| 1472 | - const topsMap = { | |
| 1473 | - 11001: width + Number(scw?.value), | |
| 1474 | - 11002: Number(scw?.value), | |
| 1475 | - 11003: Number(scw?.value), | |
| 1476 | - 11004: Number(scw?.value) + width * 2, | |
| 1477 | - 11005: width * 2, | |
| 1478 | - 11006: Number(scw?.value) + width, | |
| 1479 | - 11007: Number(scw?.value) + width, | |
| 5171 | + const getTopValue = (scw, width) => { | |
| 5172 | + if (!scw || !scw.type) return 0; | |
| 5173 | + | |
| 5174 | + const scwValue = Number(scw.value) || 0; | |
| 5175 | + const type = Number(scw.type); | |
| 5176 | + | |
| 5177 | + switch (type) { | |
| 5178 | + case 11001: | |
| 5179 | + return width + scwValue; | |
| 5180 | + case 11002: | |
| 5181 | + case 11003: | |
| 5182 | + return scwValue; | |
| 5183 | + case 11004: | |
| 5184 | + return scwValue + width * 2; | |
| 5185 | + case 11005: | |
| 5186 | + return width * 2; | |
| 5187 | + case 11006: | |
| 5188 | + case 11007: | |
| 5189 | + return scwValue + width; | |
| 5190 | + default: | |
| 5191 | + return 0; | |
| 5192 | + } | |
| 1480 | 5193 | }; |
| 1481 | - return topsMap[scw?.type] ?? 0; | |
| 5194 | + // 使用示例 | |
| 5195 | + const scw = val.find(x => x.sName === "上插位组件"); | |
| 5196 | + const topValue = getTopValue(scw, width); | |
| 5197 | + return isNaN(topValue) ? 0 : topValue; | |
| 1482 | 5198 | } |
| 1483 | 5199 | const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; |
| 1484 | 5200 | const four = ["6004", "3004", "4004", "7004"]; |
| ... | ... | @@ -1491,6 +5207,9 @@ const SvgBox = props => { |
| 1491 | 5207 | if (five.includes(t)) return 2 * coef; |
| 1492 | 5208 | if (four.includes(t)) return 2 * coef + d; |
| 1493 | 5209 | if (one.includes(t)) return coef + d; |
| 5210 | + if (t && t.includes("09")) { | |
| 5211 | + return Number(cw.sWidth) + Number(cw.cWidth); | |
| 5212 | + } | |
| 1494 | 5213 | return d; |
| 1495 | 5214 | }; |
| 1496 | 5215 | |
| ... | ... | @@ -1504,6 +5223,10 @@ const SvgBox = props => { |
| 1504 | 5223 | } else if (zscw?.type) { |
| 1505 | 5224 | top = Math.max(pick(zscw, dZ), sfhs?.value || 0); |
| 1506 | 5225 | } else { |
| 5226 | + const t = sfhs?.type; | |
| 5227 | + if (t && t.includes("09")) { | |
| 5228 | + return Number(sfhs.sWidth) + Number(sfhs.cWidth); | |
| 5229 | + } | |
| 1507 | 5230 | top = sfhs?.value || 0; |
| 1508 | 5231 | } |
| 1509 | 5232 | |
| ... | ... | @@ -1527,25 +5250,41 @@ const SvgBox = props => { |
| 1527 | 5250 | if (svg === 8) { |
| 1528 | 5251 | const zxcw = val.find(x => x.sName === "左下插位组件"); |
| 1529 | 5252 | const yxcw = val.find(x => x.sName === "右下插位组件"); |
| 1530 | - const topsMap = { | |
| 1531 | - 14001: width + Number(zxcw?.value), | |
| 1532 | - 14002: Number(zxcw?.value), | |
| 1533 | - 14003: Number(zxcw?.value), | |
| 1534 | - 14004: Number(zxcw?.value) + width * 2, | |
| 1535 | - 14005: width * 2, | |
| 1536 | - 14006: Number(zxcw?.value) + width, | |
| 1537 | - 14007: Number(zxcw?.value) + width, | |
| 1538 | - }; | |
| 1539 | - const topsMapRight = { | |
| 1540 | - 16001: width + Number(yxcw?.value), | |
| 1541 | - 16002: Number(yxcw?.value), | |
| 1542 | - 16003: Number(yxcw?.value), | |
| 1543 | - 16004: Number(yxcw?.value) + width * 2, | |
| 1544 | - 16005: width * 2, | |
| 1545 | - 16006: Number(yxcw?.value) + width, | |
| 1546 | - 16007: Number(yxcw?.value) + width, | |
| 5253 | + | |
| 5254 | + const calculateTopValue = (component, baseWidth) => { | |
| 5255 | + if (!component || !component.type) return 0; | |
| 5256 | + | |
| 5257 | + const componentValue = Number(component.value) || 0; | |
| 5258 | + | |
| 5259 | + switch (Number(component.type)) { | |
| 5260 | + case 14001: | |
| 5261 | + case 16001: | |
| 5262 | + return baseWidth + componentValue; | |
| 5263 | + case 14002: | |
| 5264 | + case 14003: | |
| 5265 | + case 16002: | |
| 5266 | + case 16003: | |
| 5267 | + return componentValue; | |
| 5268 | + case 14004: | |
| 5269 | + case 16004: | |
| 5270 | + return componentValue + baseWidth * 2; | |
| 5271 | + case 14005: | |
| 5272 | + case 16005: | |
| 5273 | + return baseWidth * 2; | |
| 5274 | + case 14006: | |
| 5275 | + case 14007: | |
| 5276 | + case 16006: | |
| 5277 | + case 16007: | |
| 5278 | + return componentValue + baseWidth; | |
| 5279 | + default: | |
| 5280 | + return 0; | |
| 5281 | + } | |
| 1547 | 5282 | }; |
| 1548 | - return Math.max(topsMap[zxcw?.type], topsMapRight[yxcw?.type]) ?? 0; | |
| 5283 | + | |
| 5284 | + const leftTopValue = calculateTopValue(zxcw, width); | |
| 5285 | + const rightTopValue = calculateTopValue(yxcw, width); | |
| 5286 | + | |
| 5287 | + return Math.max(leftTopValue, rightTopValue); | |
| 1549 | 5288 | } |
| 1550 | 5289 | const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"]; |
| 1551 | 5290 | const four = ["6004", "3004", "4004", "7004"]; |
| ... | ... | @@ -1558,6 +5297,9 @@ const SvgBox = props => { |
| 1558 | 5297 | if (five.includes(t)) return 2 * coef; |
| 1559 | 5298 | if (four.includes(t)) return 2 * coef + d; |
| 1560 | 5299 | if (one.includes(t)) return coef + d; |
| 5300 | + if (t && t.includes("09")) { | |
| 5301 | + return Number(cw.sWidth) + Number(cw.cWidth); | |
| 5302 | + } | |
| 1561 | 5303 | return d; |
| 1562 | 5304 | }; |
| 1563 | 5305 | |
| ... | ... | @@ -1571,6 +5313,10 @@ const SvgBox = props => { |
| 1571 | 5313 | } else if (zscw?.type) { |
| 1572 | 5314 | top = Math.max(pick(zscw, dZ), sfhs?.value || 0); |
| 1573 | 5315 | } else { |
| 5316 | + const t = sfhs?.type; | |
| 5317 | + if (t && t.includes("09")) { | |
| 5318 | + return Number(sfhs.sWidth) + Number(sfhs.cWidth); | |
| 5319 | + } | |
| 1574 | 5320 | top = sfhs?.value || 0; |
| 1575 | 5321 | } |
| 1576 | 5322 | |
| ... | ... | @@ -1578,88 +5324,298 @@ const SvgBox = props => { |
| 1578 | 5324 | return isNaN(top) ? 0 : top; |
| 1579 | 5325 | }; |
| 1580 | 5326 | // 上方盒舌左边 |
| 1581 | - const createUpperBoxTongueLeft = (type, w, h, ox, oy) => { | |
| 1582 | - if (!h) return createNoneProject(); | |
| 1583 | - const fnMap = { | |
| 1584 | - 1001: createLineWeltTop, | |
| 1585 | - 1002: createIsoscelesTrapezoidWeltTop, | |
| 1586 | - 1003: createTrapezoidWeltTop, | |
| 1587 | - 1004: createFoldWeltTop, | |
| 1588 | - 1005: createRoundedCornersWeltTop, | |
| 1589 | - 2001: createLineWeltTop, | |
| 1590 | - 2002: createIsoscelesTrapezoidWeltTop, | |
| 1591 | - 2003: createTrapezoidWeltTop, | |
| 1592 | - 2004: createFoldWeltTop, | |
| 1593 | - 2005: createRoundedCornersWeltTop, | |
| 1594 | - }; | |
| 1595 | - return (fnMap[type] || createNoneProject)(w, h, ox, oy); | |
| 5327 | + const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, offsetX, offsetY) => { | |
| 5328 | + if (!height) return createNoneProject(); | |
| 5329 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 5330 | + let data = {}; | |
| 5331 | + switch (upperBoxTongueType) { | |
| 5332 | + case "1001": | |
| 5333 | + data = createLineWeltTop(width, height, offsetX, offsetY); | |
| 5334 | + break; | |
| 5335 | + case "1002": | |
| 5336 | + data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY); | |
| 5337 | + break; | |
| 5338 | + case "1003": | |
| 5339 | + data = createTrapezoidWeltTop(width, height, offsetX, offsetY); | |
| 5340 | + break; | |
| 5341 | + case "1004": | |
| 5342 | + data = createFoldWeltTop(width, height, offsetX, offsetY); | |
| 5343 | + break; | |
| 5344 | + case "1005": | |
| 5345 | + data = createRoundedCornersWeltTop(width, height, offsetX, offsetY); | |
| 5346 | + break; | |
| 5347 | + case "2001": | |
| 5348 | + data = createLineWeltTop(width, height, offsetX, offsetY); | |
| 5349 | + break; | |
| 5350 | + case "2002": | |
| 5351 | + data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY); | |
| 5352 | + break; | |
| 5353 | + case "2003": | |
| 5354 | + data = createTrapezoidWeltTop(width, height, offsetX, offsetY); | |
| 5355 | + break; | |
| 5356 | + case "2004": | |
| 5357 | + data = createFoldWeltTop(width, height, offsetX, offsetY); | |
| 5358 | + break; | |
| 5359 | + case "2005": | |
| 5360 | + data = createRoundedCornersWeltTop(width, height, offsetX, offsetY); | |
| 5361 | + break; | |
| 5362 | + default: | |
| 5363 | + data = createNoneProject(); | |
| 5364 | + break; | |
| 5365 | + } | |
| 5366 | + return data; | |
| 5367 | + }; | |
| 5368 | + // 右上方盒舌 | |
| 5369 | + const createUpperBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 5370 | + if (!size) return createNoneProject(); | |
| 5371 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 5372 | + let data = {}; | |
| 5373 | + switch (upperBoxTongueType) { | |
| 5374 | + case "1001": | |
| 5375 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 5376 | + break; | |
| 5377 | + case 1: | |
| 5378 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 5379 | + break; | |
| 5380 | + default: | |
| 5381 | + data = createNoneProject(); | |
| 5382 | + break; | |
| 5383 | + } | |
| 5384 | + return data; | |
| 1596 | 5385 | }; |
| 1597 | - | |
| 1598 | 5386 | // 右上方盒舌 |
| 5387 | + const createBottomBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 5388 | + if (!size) return createNoneProject(); | |
| 5389 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 5390 | + let data = {}; | |
| 5391 | + switch (upperBoxTongueType) { | |
| 5392 | + case 0: | |
| 5393 | + data = createTopTongue(-deep, offsetX, offsetY, size, -2, 5, 0, true); | |
| 5394 | + break; | |
| 5395 | + case 1: | |
| 5396 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 5397 | + break; | |
| 5398 | + default: | |
| 5399 | + data = createNoneProject(); | |
| 5400 | + break; | |
| 5401 | + } | |
| 5402 | + return data; | |
| 5403 | + }; | |
| 5404 | + const createBottomBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 5405 | + if (!size) return createNoneProject(); | |
| 5406 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 5407 | + let data = {}; | |
| 5408 | + switch (upperBoxTongueType) { | |
| 5409 | + case 0: | |
| 5410 | + data = createTopTongue(deep, offsetX, offsetY, size, 2, 5, 1, false); | |
| 5411 | + break; | |
| 5412 | + case 1: | |
| 5413 | + data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2); | |
| 5414 | + break; | |
| 5415 | + default: | |
| 5416 | + data = createNoneProject(); | |
| 5417 | + break; | |
| 5418 | + } | |
| 5419 | + return data; | |
| 5420 | + }; | |
| 1599 | 5421 | |
| 1600 | 5422 | // 左边贴位 |
| 1601 | 5423 | const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { |
| 1602 | 5424 | if (!size) return createNoneProject(); |
| 1603 | - const fnMap = { | |
| 1604 | - 8001: createWelt, | |
| 1605 | - 8002: createWelt1, | |
| 1606 | - 8003: createWelt2, | |
| 1607 | - 8004: createWelt3, | |
| 1608 | - 8005: createWelt4, | |
| 1609 | - }; | |
| 1610 | - const fn = fnMap[trapezoidLeftType]; | |
| 1611 | - return fn | |
| 1612 | - ? trapezoidLeftType === "8005" | |
| 1613 | - ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) | |
| 1614 | - : fn(height, size, offsetX, offsetY) | |
| 1615 | - : createNoneProject(); | |
| 5425 | + let data = {}; | |
| 5426 | + switch (trapezoidLeftType) { | |
| 5427 | + case "8001": | |
| 5428 | + data = createWelt(height, size, offsetX, offsetY); | |
| 5429 | + break; | |
| 5430 | + case "8002": | |
| 5431 | + data = createWelt1(height, size, offsetX, offsetY); | |
| 5432 | + break; | |
| 5433 | + case "8003": | |
| 5434 | + data = createWelt2(height, size, offsetX, offsetY); | |
| 5435 | + break; | |
| 5436 | + case "8004": | |
| 5437 | + data = createWelt3(height, size, offsetX, offsetY); | |
| 5438 | + break; | |
| 5439 | + case "8005": | |
| 5440 | + data = createWelt4(height, size, offsetX, offsetY, dSFHS, dXFHS); | |
| 5441 | + break; | |
| 5442 | + default: | |
| 5443 | + data = createNoneProject(); | |
| 5444 | + break; | |
| 5445 | + } | |
| 5446 | + return data; | |
| 1616 | 5447 | }; |
| 1617 | 5448 | // 右边贴位 |
| 1618 | 5449 | const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => { |
| 1619 | - const suffix = trapezoidLeftType; | |
| 1620 | - const fnMap = { | |
| 1621 | - 9001: createWelt, | |
| 1622 | - 9002: createWelt1, | |
| 1623 | - 9003: createWelt2Right, | |
| 1624 | - 9004: createWelt3Right, | |
| 1625 | - 9005: createWelt4Right, | |
| 1626 | - }; | |
| 1627 | - const fn = fnMap[suffix]; | |
| 1628 | - return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject(); | |
| 5450 | + if (!size) return createNoneProject(); | |
| 5451 | + let data = {}; | |
| 5452 | + switch (trapezoidLeftType) { | |
| 5453 | + case "9001": | |
| 5454 | + data = createWelt(height, size, offsetX, offsetY); | |
| 5455 | + break; | |
| 5456 | + case "9002": | |
| 5457 | + data = createWelt1(height, size, offsetX, offsetY); | |
| 5458 | + break; | |
| 5459 | + case "9003": | |
| 5460 | + data = createWelt2Right(height, size, offsetX, offsetY); | |
| 5461 | + break; | |
| 5462 | + case "9004": | |
| 5463 | + data = createWelt3Right(height, size, offsetX, offsetY); | |
| 5464 | + break; | |
| 5465 | + case "9005": | |
| 5466 | + data = createWelt4Right(height, size, offsetX, offsetY, dSFHS, dXFHS); | |
| 5467 | + break; | |
| 5468 | + default: | |
| 5469 | + data = createNoneProject(); | |
| 5470 | + break; | |
| 5471 | + } | |
| 5472 | + return data; | |
| 1629 | 5473 | }; |
| 1630 | 5474 | // 左上部件 |
| 1631 | 5475 | const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { |
| 1632 | 5476 | if (!size) return createNoneProject(); |
| 1633 | - | |
| 5477 | + let data = {}; | |
| 1634 | 5478 | const suffix = trapezoidLeftType?.slice(-2); |
| 1635 | - const fnMap = { | |
| 1636 | - "01": createBoxComponentNew, | |
| 1637 | - "02": createBoxComponentNew1, | |
| 1638 | - "03": createBoxComponentNew2, | |
| 1639 | - "04": createBoxComponentNew3, | |
| 1640 | - "05": createBoxComponentNew4, | |
| 1641 | - "06": createBoxComponentNew5, | |
| 1642 | - "07": createBoxComponentNew6, | |
| 1643 | - }; | |
| 1644 | - | |
| 1645 | - const fn = fnMap[suffix]; | |
| 1646 | - return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject(); | |
| 5479 | + switch (suffix) { | |
| 5480 | + case "01": | |
| 5481 | + data = createBoxComponentNew(width, height, size, offsetX, offsetY); | |
| 5482 | + break; | |
| 5483 | + case "02": | |
| 5484 | + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); | |
| 5485 | + break; | |
| 5486 | + case "03": | |
| 5487 | + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); | |
| 5488 | + break; | |
| 5489 | + case "04": | |
| 5490 | + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); | |
| 5491 | + break; | |
| 5492 | + case "05": | |
| 5493 | + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); | |
| 5494 | + break; | |
| 5495 | + case "06": | |
| 5496 | + data = createBoxComponentNew5(width, height, size, offsetX, offsetY); | |
| 5497 | + break; | |
| 5498 | + case "07": | |
| 5499 | + data = createBoxComponentNew6(width, height, size, offsetX, offsetY); | |
| 5500 | + break; | |
| 5501 | + case "4001": | |
| 5502 | + data = createBoxComponentNew(width, height, size, offsetX, offsetY); | |
| 5503 | + break; | |
| 5504 | + case "4002": | |
| 5505 | + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); | |
| 5506 | + break; | |
| 5507 | + case "4003": | |
| 5508 | + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); | |
| 5509 | + break; | |
| 5510 | + case "4004": | |
| 5511 | + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); | |
| 5512 | + break; | |
| 5513 | + case "4005": | |
| 5514 | + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); | |
| 5515 | + break; | |
| 5516 | + case "4006": | |
| 5517 | + data = createBoxComponentNew5(width, height, size, offsetX, offsetY); | |
| 5518 | + break; | |
| 5519 | + case "4007": | |
| 5520 | + data = createBoxComponentNew6(width, height, size, offsetX, offsetY); | |
| 5521 | + break; | |
| 5522 | + case "6001": | |
| 5523 | + data = createBoxComponentNew(width, height, size, offsetX, offsetY); | |
| 5524 | + break; | |
| 5525 | + case "6002": | |
| 5526 | + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); | |
| 5527 | + break; | |
| 5528 | + case "6003": | |
| 5529 | + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); | |
| 5530 | + break; | |
| 5531 | + case "6004": | |
| 5532 | + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); | |
| 5533 | + break; | |
| 5534 | + case "6005": | |
| 5535 | + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); | |
| 5536 | + break; | |
| 5537 | + case "6006": | |
| 5538 | + data = createBoxComponentNew5(width, height, size, offsetX, offsetY); | |
| 5539 | + break; | |
| 5540 | + case "6007": | |
| 5541 | + data = createBoxComponentNew6(width, height, size, offsetX, offsetY); | |
| 5542 | + break; | |
| 5543 | + case "7001": | |
| 5544 | + data = createBoxComponentNew(width, height, size, offsetX, offsetY); | |
| 5545 | + break; | |
| 5546 | + case "7002": | |
| 5547 | + data = createBoxComponentNew1(width, height, size, offsetX, offsetY); | |
| 5548 | + break; | |
| 5549 | + case "7003": | |
| 5550 | + data = createBoxComponentNew2(width, height, size, offsetX, offsetY); | |
| 5551 | + break; | |
| 5552 | + case "7004": | |
| 5553 | + data = createBoxComponentNew3(width, height, size, offsetX, offsetY); | |
| 5554 | + break; | |
| 5555 | + case "7005": | |
| 5556 | + data = createBoxComponentNew4(width, height, size, offsetX, offsetY); | |
| 5557 | + break; | |
| 5558 | + case "7006": | |
| 5559 | + data = createBoxComponentNew5(width, height, size, offsetX, offsetY); | |
| 5560 | + break; | |
| 5561 | + case "7007": | |
| 5562 | + data = createBoxComponentNew6(width, height, size, offsetX, offsetY); | |
| 5563 | + break; | |
| 5564 | + default: | |
| 5565 | + data = createNoneProject(); | |
| 5566 | + break; | |
| 5567 | + } | |
| 5568 | + return data; | |
| 5569 | + }; | |
| 5570 | + // 右上部件 | |
| 5571 | + const createDynamicTopRight = (trapezoidLeftType, width, height, size, offsetX, offsetY) => { | |
| 5572 | + if (!size) return createNoneProject(); | |
| 5573 | + let data = {}; | |
| 5574 | + switch (trapezoidLeftType) { | |
| 5575 | + case "6001": | |
| 5576 | + data = createBoxComponentNew(width, height, size, offsetX, offsetY); | |
| 5577 | + break; | |
| 5578 | + case 1: | |
| 5579 | + break; | |
| 5580 | + default: | |
| 5581 | + data = createNoneProject(); | |
| 5582 | + break; | |
| 5583 | + } | |
| 5584 | + return data; | |
| 1647 | 5585 | }; |
| 1648 | - | |
| 1649 | 5586 | // 盒底组件 特殊的盒底组件 |
| 1650 | 5587 | const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { |
| 5588 | + let data = {}; | |
| 1651 | 5589 | const suffix = trapezoidLeftType?.slice(-2); |
| 1652 | - const fnMap = { | |
| 1653 | - "01": createRightAngleBoxBottomComponent, | |
| 1654 | - "02": createBoxBottomComponent1, | |
| 1655 | - "03": createBoxBottomComponent2, | |
| 1656 | - "04": createBoxBottomComponent3, | |
| 1657 | - "05": createBoxBottomComponent4, | |
| 1658 | - "06": createBoxBottomComponent5, | |
| 1659 | - "07": createBoxBottomComponent6, | |
| 1660 | - }; | |
| 1661 | - return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY); | |
| 5590 | + switch (suffix) { | |
| 5591 | + case "01": | |
| 5592 | + data = createRightAngleBoxBottomComponent(width, deep, size, offsetX, offsetY); | |
| 5593 | + break; | |
| 5594 | + case "02": | |
| 5595 | + data = createBoxBottomComponent1(width, deep, size, offsetX, offsetY); | |
| 5596 | + break; | |
| 5597 | + case "03": | |
| 5598 | + data = createBoxBottomComponent2(width, deep, size, offsetX, offsetY); | |
| 5599 | + break; | |
| 5600 | + case "04": | |
| 5601 | + data = createBoxBottomComponent3(width, deep, size, offsetX, offsetY); | |
| 5602 | + break; | |
| 5603 | + case "05": | |
| 5604 | + data = createBoxBottomComponent4(width, deep, size, offsetX, offsetY); | |
| 5605 | + break; | |
| 5606 | + case "06": | |
| 5607 | + data = createBoxBottomComponent5(width, deep, size, offsetX, offsetY); | |
| 5608 | + break; | |
| 5609 | + case "07": | |
| 5610 | + data = createBoxBottomComponent6(width, deep, size, offsetX, offsetY); | |
| 5611 | + break; | |
| 5612 | + default: | |
| 5613 | + data = createNoneProject(); | |
| 5614 | + break; | |
| 5615 | + } | |
| 5616 | + return data; | |
| 1662 | 5617 | }; |
| 5618 | + | |
| 1663 | 5619 | // 天地盒部件 |
| 1664 | 5620 | const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => { |
| 1665 | 5621 | if (!size) return createNoneProject(); | ... | ... |
src/components/Common/CommonComponent/index.js
| ... | ... | @@ -1258,12 +1258,19 @@ export default class CommonComponent extends Component { |
| 1258 | 1258 | </> |
| 1259 | 1259 | ); |
| 1260 | 1260 | } |
| 1261 | + const removeExtension = (filename) => { | |
| 1262 | + const lastDotIndex = filename.lastIndexOf('.'); | |
| 1263 | + if (lastDotIndex === -1) { | |
| 1264 | + // 如果字符串中没有点,则返回原字符串 | |
| 1265 | + return filename; | |
| 1266 | + } | |
| 1267 | + return filename.substring(0, lastDotIndex); | |
| 1268 | + } | |
| 1261 | 1269 | if (sName === "sPackPath" || sName === "sPackDetailPathUpLoad" || sName === "sSvgPath") { |
| 1262 | - let imageUrls = ""; | |
| 1263 | - const uploadProps = { | |
| 1270 | + const uploadProps = { | |
| 1264 | 1271 | listType: "picture-card", |
| 1265 | 1272 | className: "avatar-uploader", |
| 1266 | - action: `${commonConfig.server_host}file/uploadLogo?sLogoName=logo${sName}${this.props.record.sName}`, | |
| 1273 | + action: `${commonConfig.server_host}file/uploadPrice?sLogoName=logo${sName}${this.props.record.sName}`, | |
| 1267 | 1274 | disabled: !this.props.enabled, |
| 1268 | 1275 | onChange: info => { |
| 1269 | 1276 | const { fileList } = info; |
| ... | ... | @@ -1271,17 +1278,17 @@ export default class CommonComponent extends Component { |
| 1271 | 1278 | const { status, response } = file; |
| 1272 | 1279 | if (status === "done") { |
| 1273 | 1280 | if (response && response.code === 1) { |
| 1274 | - const imageUrlNew = `${commonConfig.server_host}file/downloadLogo?sLogoName=logo${sName}${ | |
| 1275 | - this.props.record.sName | |
| 1276 | - }&date=${new Date().getTime()}`; | |
| 1281 | + const imageUrl = removeExtension(response.dataset.rows[0].savePathStr); | |
| 1282 | + // const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=logo${removeExtension(imageUrl)}${this.props.record.sName | |
| 1283 | + // }&date=${new Date().getTime()}`; | |
| 1277 | 1284 | if (sName === "sPackPath") { |
| 1278 | - this.props.onChange(this.props.name, sName, { sPackPath: imageUrlNew }, this.props.sId, []); | |
| 1285 | + this.props.onChange(this.props.name, sName, { sPackPath: imageUrl }, this.props.sId, []); | |
| 1279 | 1286 | } else if (sName === "sPackDetailPathUpLoad") { |
| 1280 | - this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrlNew }, this.props.sId, []); | |
| 1287 | + this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrl }, this.props.sId, []); | |
| 1281 | 1288 | } else { |
| 1282 | - this.props.onChange(this.props.name, sName, { sSvgPath: imageUrlNew }, this.props.sId, []); | |
| 1289 | + this.props.onChange(this.props.name, sName, { sSvgPath: imageUrl }, this.props.sId, []); | |
| 1283 | 1290 | } |
| 1284 | - imageUrls = imageUrlNew; | |
| 1291 | + imageUrls = imageUrl; | |
| 1285 | 1292 | } else if (response && response.code === -1) { |
| 1286 | 1293 | message.error(response.msg); |
| 1287 | 1294 | } |
| ... | ... | @@ -1291,12 +1298,11 @@ export default class CommonComponent extends Component { |
| 1291 | 1298 | showUploadList: false, |
| 1292 | 1299 | openFileDialogOnClick: this.props.enabled, |
| 1293 | 1300 | }; |
| 1294 | - const imageUrl = | |
| 1295 | - sName === "sPackPath" | |
| 1296 | - ? this.props.record.sPackPath | |
| 1297 | - : sName === "sPackDetailPathUpLoad" | |
| 1298 | - ? this.props.record.sPackDetailPathUpLoad | |
| 1299 | - : this.props.record.sSvgPath; | |
| 1301 | + const getImageUrl = (sName) => { | |
| 1302 | + const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; | |
| 1303 | + return imageUrlNew | |
| 1304 | + } | |
| 1305 | + const imageUrl = sName === "sPackPath" ? (this.props.record.sPackPath ? getImageUrl(this.props.record.sPackPath) : '') : sName === "sPackDetailPathUpLoad" ? (this.props.record.sPackDetailPathUpLoad ? getImageUrl(this.props.record.sPackDetailPathUpLoad) : '') : (this.props.record.sSvgPath ? getImageUrl(this.props.record.sSvgPath) : ''); | |
| 1300 | 1306 | return ( |
| 1301 | 1307 | <div> |
| 1302 | 1308 | <Upload {...uploadProps}> |
| ... | ... | @@ -1365,6 +1371,18 @@ export default class CommonComponent extends Component { |
| 1365 | 1371 | type: x.sTypes || null, |
| 1366 | 1372 | show: true, |
| 1367 | 1373 | showName: x.sName, |
| 1374 | + sLength: x.iSLength, | |
| 1375 | + sWidth: x.iSWidth, | |
| 1376 | + sType: x.iSType, | |
| 1377 | + sTypeName: Number(x.iSType) === 0 ? "矩形" : "梯形", | |
| 1378 | + sOffset: x.sSOffset, | |
| 1379 | + sQuantity: x.iSQuantity, | |
| 1380 | + cLength: x.iCLength, | |
| 1381 | + cWidth: x.iCWidth, | |
| 1382 | + cType: x.iCType, | |
| 1383 | + cTypeName: Number(x.iCType) === 0 ? "矩形" : "梯形", | |
| 1384 | + cOffset: x.sCOffset, | |
| 1385 | + cQuantity: x.iCQuantity, | |
| 1368 | 1386 | }) |
| 1369 | 1387 | ); |
| 1370 | 1388 | ... | ... |
src/components/Common/CommonTable/index.js
| ... | ... | @@ -1297,7 +1297,7 @@ class CommonTableRc extends React.Component { |
| 1297 | 1297 | item.render = (value = "", record) => { |
| 1298 | 1298 | const { formId, name, enabled } = this.props; |
| 1299 | 1299 | const { token } = this.props.app; |
| 1300 | - const divProps = { | |
| 1300 | + let divProps = { | |
| 1301 | 1301 | action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`, |
| 1302 | 1302 | onChange: info => { |
| 1303 | 1303 | this.handleUploadChange(info, () => {}); |
| ... | ... | @@ -1308,7 +1308,20 @@ class CommonTableRc extends React.Component { |
| 1308 | 1308 | showUploadList: false, |
| 1309 | 1309 | multiple: false, |
| 1310 | 1310 | }; |
| 1311 | - | |
| 1311 | + if (config.sTbName === "sisboxcomponent") { | |
| 1312 | + divProps = { | |
| 1313 | + // action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`, | |
| 1314 | + action: `${commonConfig.server_host}file/uploadPrice?sLogoName=logo${name}${formId}${new Date().getTime()}`, | |
| 1315 | + onChange: info => { | |
| 1316 | + this.handleUploadChange(info, () => {}); | |
| 1317 | + const savePathStr = info?.file?.response?.dataset?.rows?.[0]?.savePathStr; | |
| 1318 | + this.props.onDataChange(name, item.dataIndex, { [item.dataIndex]: savePathStr }, record.sId, []); | |
| 1319 | + }, | |
| 1320 | + accept: "*/*", | |
| 1321 | + showUploadList: false, | |
| 1322 | + multiple: false, | |
| 1323 | + }; | |
| 1324 | + } | |
| 1312 | 1325 | return ( |
| 1313 | 1326 | <div className={styles.makeUpPath}> |
| 1314 | 1327 | {value && |
| ... | ... | @@ -1322,12 +1335,25 @@ class CommonTableRc extends React.Component { |
| 1322 | 1335 | }); |
| 1323 | 1336 | }, |
| 1324 | 1337 | }; |
| 1325 | - | |
| 1338 | + const removeExtension = filename => { | |
| 1339 | + const lastDotIndex = filename.lastIndexOf("."); | |
| 1340 | + if (lastDotIndex === -1) { | |
| 1341 | + // 如果字符串中没有点,则返回原字符串 | |
| 1342 | + return filename; | |
| 1343 | + } | |
| 1344 | + return filename.substring(0, lastDotIndex); | |
| 1345 | + }; | |
| 1346 | + const getImageUrl = sName => { | |
| 1347 | + const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; | |
| 1348 | + return imageUrlNew; | |
| 1349 | + }; | |
| 1326 | 1350 | const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(",") : ""; |
| 1327 | - const dataUrl = picAddr[0].includes("xlyerpfiles") | |
| 1351 | + let dataUrl = picAddr[0].includes("xlyerpfiles") | |
| 1328 | 1352 | ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` |
| 1329 | 1353 | : picAddr[0]; /* 缩略图 */ |
| 1330 | - | |
| 1354 | + if (config.sTbName === "sisboxcomponent") { | |
| 1355 | + dataUrl = getImageUrl(removeExtension(picAddr[0])); | |
| 1356 | + } | |
| 1331 | 1357 | const officeFileTypeList = ["PDF", "DOCX", "XLSX", "MP4", "WEBM", "OGG"]; |
| 1332 | 1358 | const imgTypeList = ["PNG", "SVG", "JPG", "JPEG", "GIF", "BMP", "TIFF", "ICO"]; |
| 1333 | 1359 | const officeFileType = picAddr[0].split(".").pop().toUpperCase(); | ... | ... |
src/components/QuickQuote/index.jsx
| ... | ... | @@ -1503,6 +1503,7 @@ const TreeComponent = props => { |
| 1503 | 1503 | masterData: { ...props.masterData, sFormId: "101251240115016076506222050" }, |
| 1504 | 1504 | }); |
| 1505 | 1505 | } |
| 1506 | + console.log(selectedNode, "selectedNode"); | |
| 1506 | 1507 | |
| 1507 | 1508 | getDropDownData(props); |
| 1508 | 1509 | }, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]); |
| ... | ... | @@ -1541,7 +1542,7 @@ const ContentComponent = props => { |
| 1541 | 1542 | const { selectedNode = {}, extraParts = {} } = props.state; |
| 1542 | 1543 | const manyqtysInfo = props.getI18nName("manyqtysInfo", "多数量报价"); |
| 1543 | 1544 | const selectProduct = commonFunc.showLocalMessage(props, "selectProduct", "请先选择产品"); |
| 1544 | - const { showName } = selectedNode; | |
| 1545 | + const { showName ,sAllPartsNameDefault} = selectedNode; | |
| 1545 | 1546 | const extraPartsList = extraParts[showName] || []; |
| 1546 | 1547 | let { sAllPartsName = "" } = selectedNode; |
| 1547 | 1548 | let bEmpty = false; |
| ... | ... | @@ -1551,7 +1552,52 @@ const ContentComponent = props => { |
| 1551 | 1552 | } else if (!sAllPartsName) { |
| 1552 | 1553 | sAllPartsName = showName; |
| 1553 | 1554 | } |
| 1555 | + // 默认选中盒型 如果配置了默认值 | |
| 1556 | + const sAllPartsNameDefaultRef = useRef(sAllPartsNameDefault); | |
| 1554 | 1557 | |
| 1558 | + useEffect(() => { | |
| 1559 | + sAllPartsNameDefaultRef.current = sAllPartsNameDefault; | |
| 1560 | + }, [sAllPartsNameDefault]); | |
| 1561 | + | |
| 1562 | + useEffect(() => { | |
| 1563 | + if (sAllPartsNameDefaultRef.current && props.state.slaveData) { | |
| 1564 | + const boxModelList = sAllPartsName.split(","); | |
| 1565 | + const slaveData = props.state.slaveData; | |
| 1566 | + if (slaveData.length === boxModelList.length) { | |
| 1567 | + const sAllPartsNameDefaultList = JSON.parse(sAllPartsNameDefaultRef.current); | |
| 1568 | + const getSqlDropDownData = async ({ sId, sSqlCondition = {} }, cb) => { | |
| 1569 | + const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`; | |
| 1570 | + const body = { | |
| 1571 | + sKeyUpFilterName: "", | |
| 1572 | + pageNum: 1, | |
| 1573 | + pageSize: 1000, | |
| 1574 | + sSqlCondition, | |
| 1575 | + }; | |
| 1576 | + const retrunData = await commonServices.postValueService(props.app.token, body, url); | |
| 1577 | + const dropDownData = retrunData.data?.dataset?.rows; | |
| 1578 | + if (dropDownData && sAllPartsNameDefaultList.length) { | |
| 1579 | + sAllPartsNameDefaultList.forEach((item, index) => { | |
| 1580 | + const sPartNameList = item.sPartName?.split(","); | |
| 1581 | + if (sPartNameList && sPartNameList.length) { | |
| 1582 | + sPartNameList.forEach(sPartName => { | |
| 1583 | + const box = dropDownData.find(box => box.sId === item.sBoxId); // Define 'box' here | |
| 1584 | + const boxData = dropDownData.map((itemBox, indexBox) => ({ | |
| 1585 | + ...itemBox, | |
| 1586 | + iOrder: indexBox + 1, | |
| 1587 | + })); | |
| 1588 | + if (box) { | |
| 1589 | + // Check if 'box' exists before using it | |
| 1590 | + props.onDataChange("slaveUp" + sPartName, "sName", { sName: box.sName }, box.sId, boxData); | |
| 1591 | + } | |
| 1592 | + }); | |
| 1593 | + } | |
| 1594 | + }); | |
| 1595 | + } | |
| 1596 | + }; | |
| 1597 | + getSqlDropDownData({ sId: "17428091410008594700322758474000", sSqlCondition: { sProductClassifyId: selectedNode.sId } }); | |
| 1598 | + } | |
| 1599 | + } | |
| 1600 | + }, [sAllPartsNameDefaultRef.current, props.state.slaveData]); | |
| 1555 | 1601 | const boxModelList = sAllPartsName.split(","); |
| 1556 | 1602 | const [activeKey, setActiveKey] = useState(0); |
| 1557 | 1603 | |
| ... | ... | @@ -2418,9 +2464,22 @@ const BoxComponent = props => { |
| 2418 | 2464 | |
| 2419 | 2465 | const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片"); |
| 2420 | 2466 | |
| 2467 | + const removeExtension = filename => { | |
| 2468 | + if (!filename) return; | |
| 2469 | + const lastDotIndex = filename.lastIndexOf("."); | |
| 2470 | + if (lastDotIndex === -1) { | |
| 2471 | + // 如果字符串中没有点,则返回原字符串 | |
| 2472 | + return filename; | |
| 2473 | + } | |
| 2474 | + return filename.substring(0, lastDotIndex); | |
| 2475 | + }; | |
| 2476 | + const getImageUrl = sName => { | |
| 2477 | + const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`; | |
| 2478 | + return imageUrlNew; | |
| 2479 | + }; | |
| 2421 | 2480 | let imagesData = [ |
| 2422 | - { src: slaveRowData.sPackDetailPathUpLoad, alt: "展开图" }, | |
| 2423 | - { src: slaveRowData.sPackPath, alt: "立体图" }, | |
| 2481 | + { src: getImageUrl(removeExtension(slaveRowData.sPackDetailPathUpLoad)), alt: "展开图" }, | |
| 2482 | + { src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" }, | |
| 2424 | 2483 | ]; |
| 2425 | 2484 | if (!slaveRowData.sPackDetailPathUpLoad) { |
| 2426 | 2485 | imagesData = [{ src: slaveRowData.sPackPath, alt: "立体图" }]; |
| ... | ... | @@ -3296,7 +3355,7 @@ const BoxModelSelectedModal = props => { |
| 3296 | 3355 | dSvgBoxHeight: 100, |
| 3297 | 3356 | showNew: 1, |
| 3298 | 3357 | }; |
| 3299 | - | |
| 3358 | + | |
| 3300 | 3359 | return svgProps; |
| 3301 | 3360 | }; |
| 3302 | 3361 | const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected)); |
| ... | ... | @@ -3619,7 +3678,7 @@ const GetBestAlgorithm = props => { |
| 3619 | 3678 | { name: "盒宽", value: W, type: null }, |
| 3620 | 3679 | { name: "盒高", value: D, type: null }, |
| 3621 | 3680 | ]; |
| 3622 | - const boxTypes = slaveRowData.sTypes; | |
| 3681 | + const boxTypes = slaveRowData.sTypes; | |
| 3623 | 3682 | const titleList1 = [ |
| 3624 | 3683 | { name: "上方盒舌", value: "dSFHS" }, |
| 3625 | 3684 | { name: "盒底组件", value: "dHDC" }, | ... | ... |