+
+ {/* {item?.type && item?.type.includes("09") ? (
+
层1{" "}
@@ -1646,7 +1656,165 @@ const BoxDesignCompontent = baseProps => {
style={{ width: " 80%" }}
/>
- )}
+ )} */}
+
+ {item?.selectImage ? (
+

+ ) : (
+ ""
+ )}
+ {item.type && item.type.includes("09") ? (
+
+
+
+
+ handleChange(e, findIndexBySname(item.sName), "sQuantity")}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ style={{ width: " 80%" }}
+ placeholder="个数"
+ />
+ handleChange(e, findIndexBySname(item.sName), "sOffset")}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ style={{ width: " 80%" }}
+ placeholder="偏移"
+ />
+
+
+
+
+ handleChange(e, findIndexBySname(item.sName), "cQuantity")}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ style={{ width: " 80%" }}
+ placeholder="个数"
+ />
+ handleChange(e, findIndexBySname(item.sName), "cOffset")}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ style={{ width: " 80%" }}
+ placeholder="偏移"
+ />
+
+
+ ) : (
+
+ handleChangeName(e, findIndexBySname(item.sName))}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ className={styles.text}
+ />
+ handleChange(e, findIndexBySname(item.sName))}
+ onFocus={e => handleFocus(e, findIndexBySname(item.sName))}
+ onBlur={e => handleBlur(e, findIndexBySname(item.sName))}
+ readOnly={!item?.isEditable}
+ style={{ width: " 80%" }}
+ />
+
+ )}
+
))}
{boxType === "8" &&
diff --git a/src/components/Common/BoxDesignCompontent/svg.js b/src/components/Common/BoxDesignCompontent/svg.js
index 1710813..3f33015 100644
--- a/src/components/Common/BoxDesignCompontent/svg.js
+++ b/src/components/Common/BoxDesignCompontent/svg.js
@@ -49,6 +49,9 @@ import {
createBoxComponentNewFul4,
createBoxComponentNewFul5,
createBoxComponentNewFul6,
+ createPathElementTrapezoid,
+ createPathElementTrapezoids,
+ createPathElementTrapezoidRight,
} from "../BoxDesign/createAirplaneBox";
const SvgBox = props => {
const svgContainerRef = useRef(null);
@@ -99,7 +102,6 @@ const SvgBox = props => {
orderLength = Number(boxList.find(x => x.sName === "次盒长")?.value) || 0;
orderWidth = Number(boxList.find(x => x.sName === "次盒宽")?.value) || 0;
}
-
// 计算视口宽度和高度
const zbtb = boxList.find(x => x.sName === "左贴边位");
const ybtb = boxList.find(x => x.sName === "右贴边位");
@@ -127,7 +129,6 @@ const SvgBox = props => {
// 展宽
if (boxList && boxList.length) {
// 如果存在部件和盒舌 取最大的
-
const top = topOffect(boxList, boxLength, boxWidth, boxHeight);
const bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight);
max = Number(top) + Number(bottom);
@@ -173,6 +174,8 @@ const SvgBox = props => {
leftValue = leftValue + Number(zxcwValue) + boxHeight * 3;
} else if (zxcwType === "4005") {
leftValue = boxHeight * 3;
+ } else if (zxcwType === "4009") {
+ leftValue = Number(zxcw?.sLength) + Number(zxcw?.cLength);
}
if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") {
rightValue = rightValue + Number(yscwValue) + boxHeight * 2;
@@ -182,6 +185,8 @@ const SvgBox = props => {
rightValue = rightValue + Number(yscwValue) + boxHeight * 3;
} else if (yscwType === "6005") {
rightValue = boxHeight * 3;
+ } else if (yscwType === "6009") {
+ rightValue = Number(yscw?.sLength) + Number(yscw?.cLength);
}
if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") {
topValue = topValue + Number(zscwValue) + boxHeight * 2;
@@ -191,6 +196,8 @@ const SvgBox = props => {
topValue = topValue + Number(zscwValue) + boxHeight * 3;
} else if (zscwType === "3005") {
topValue = boxHeight * 3;
+ } else if (zscwType === "3009") {
+ topValue = Number(zscw?.sLength) + Number(zscw?.cLength);
}
if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") {
bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2;
@@ -200,6 +207,8 @@ const SvgBox = props => {
bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3;
} else if (yxcwType === "7005") {
bottomValue = boxHeight * 3;
+ } else if (yxcwType === "7009") {
+ bottomValue = Number(yxcw?.sLength) + Number(yxcw?.cLength);
}
viewBoxWidth = Number(boxLength) + leftValue + rightValue;
viewBoxHeight = Number(boxWidth) + topValue + bottomValue;
@@ -269,18 +278,28 @@ const SvgBox = props => {
// viewBoxHeight = boxLength + dZSCW + dYXCW;
} else if (Number(svgType) === 8) {
const getTop = (item, offset = 0) => {
- const map = {
- 10001: headWidth + Number(item?.value),
- 10002: Number(item?.value),
- 10003: Number(item?.value),
- 10004: Number(item?.value) + headWidth * 2,
- 10005: headWidth * 2,
- 10006: Number(item?.value) + headWidth,
- 10007: Number(item?.value) + headWidth,
- };
- return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
+ if (!item || !item?.type) return 0;
+ const key = Number(item.type - offset);
+ if (!Number.isFinite(key)) return 0;
+ const value = Number(item?.value) || 0;
+ const headWidthNum = Number(headWidth) || 0;
+ switch (key) {
+ case 10001:
+ return headWidthNum + value;
+ case 10002:
+ case 10003:
+ return value;
+ case 10004:
+ return value + headWidthNum * 2;
+ case 10005:
+ return headWidthNum * 2;
+ case 10006:
+ case 10007:
+ return value + headWidthNum;
+ default:
+ return 0;
+ }
};
-
const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
const topRight = getTop(
boxList.find(x => x.sName === "右上插位组件"),
@@ -301,7 +320,6 @@ const SvgBox = props => {
viewBoxWidth = Math.max(topLength, bottomLength) + Number(leftOffect) + Number(rightOffect);
viewBoxHeight = Number(headWidth) + Number(orderWidth) + max;
}
-
// 计算缩放比例
let scale = 1;
if (props.showNew === 0) {
@@ -313,34 +331,52 @@ const SvgBox = props => {
? topOffect(boxList, boxLength, boxWidth, boxHeight) * scale
: topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
let bottom = 0;
+ let xSvg = 0;
if (Number(svgType) !== 8) {
bottom = bottomOffect(boxList, boxLength, boxWidth, boxHeight);
} else {
bottom = bottomOffect(boxList, orderLength, orderWidth);
}
if (Number(svgType) === 4) {
- ySvg = ySvg + boxHeight * scale;
+ // ySvg = ySvg + boxHeight * scale;
} else if (Number(svgType) === 8) {
ySvg = topOffect(boxList, headLength, headWidth) * scale;
}
ySvg = ySvg + 50 * scale;
- let xSvg = 0;
+
if (Number(svgType) === 7) {
xSvg = scaledWidth + dZXCW * scale;
} else if (Number(svgType) === 8) {
const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
// 计算首盒部件与次盒部件尺寸
const getTop = (item, offset = 0) => {
- const map = {
- 10001: headWidth + Number(item?.value),
- 10002: Number(item?.value),
- 10003: Number(item?.value),
- 10004: Number(item?.value) + headWidth * 2,
- 10005: headWidth * 2,
- 10006: Number(item?.value) + headWidth,
- 10007: Number(item?.value) + headWidth,
- };
- return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
+ // 确保 headWidth 和 item?.value 是有效的数字
+ const headWidthNum = Number(headWidth) || 0;
+ const itemValue = Number(item?.value) || 0;
+
+ // 确保 item?.type 是数字
+ const type = Number(item?.type);
+ if (!Number.isFinite(type)) return 0;
+
+ const key = type - offset;
+
+ // 使用 switch-case 替代 map
+ switch (key) {
+ case 10001:
+ return headWidthNum + itemValue;
+ case 10002:
+ case 10003:
+ return itemValue;
+ case 10004:
+ return itemValue + headWidthNum * 2;
+ case 10005:
+ return headWidthNum * 2;
+ case 10006:
+ case 10007:
+ return itemValue + headWidthNum;
+ default:
+ return 0; // 默认返回值,避免 unreachable
+ }
};
const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
const topLength = headLength + topLeft;
@@ -350,6 +386,8 @@ const SvgBox = props => {
);
const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength));
+ } else if (Number(svgType) === 4) {
+ xSvg = 100 * scale;
} else {
xSvg = zbtb?.value;
}
@@ -367,7 +405,7 @@ const SvgBox = props => {
scale = 0.5;
let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
if (Number(svgType) === 4) {
- ySvg = ySvg + boxHeight;
+ // ySvg = ySvg + boxHeight;
} else if (Number(svgType) === 8) {
ySvg = topOffect(boxList, headLength, headWidth) * scale;
}
@@ -379,16 +417,33 @@ const SvgBox = props => {
const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
// 计算首盒部件与次盒部件尺寸
const getTop = (item, offset = 0) => {
- const map = {
- 10001: headWidth + Number(item?.value),
- 10002: Number(item?.value),
- 10003: Number(item?.value),
- 10004: Number(item?.value) + headWidth * 2,
- 10005: headWidth * 2,
- 10006: Number(item?.value) + headWidth,
- 10007: Number(item?.value) + headWidth,
- };
- return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
+ // 确保 headWidth 和 item?.value 是有效的数字
+ const headWidthNum = Number(headWidth) || 0;
+ const itemValue = Number(item?.value) || 0;
+
+ // 确保 item?.type 是数字
+ const type = Number(item?.type);
+ if (!Number.isFinite(type)) return 0;
+
+ const key = type - offset;
+
+ // 使用 switch-case 替代 map
+ switch (key) {
+ case 10001:
+ return headWidthNum + itemValue;
+ case 10002:
+ case 10003:
+ return itemValue;
+ case 10004:
+ return itemValue + headWidthNum * 2;
+ case 10005:
+ return headWidthNum * 2;
+ case 10006:
+ case 10007:
+ return itemValue + headWidthNum;
+ default:
+ return 0; // 默认返回值,避免 unreachable
+ }
};
const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
const topLength = headLength + topLeft;
@@ -398,14 +453,17 @@ const SvgBox = props => {
);
const bottomLength = headLength / 2 - orderLength + -bottomLeft - Number(leftOffect);
xSvg = Math.max(Math.abs(bottomLength), Math.abs(topLength));
+ } else if (Number(svgType) === 4) {
+ xSvg = 100;
} else {
xSvg = zbtb?.value;
}
+ if (!dSvgBoxWidth) {
+ xSvg = viewBoxWidth / 2 + 100 * scale;
+ }
svg.setAttribute(
"viewBox",
- `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${
- dSvgBoxHeight ? dSvgBoxHeight : 250
- }`
+ `${-xSvg} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${dSvgBoxHeight ? dSvgBoxHeight : 250}`
);
svg.setAttribute("width", `${dSvgBoxWidth ? dSvgBoxWidth : 500}px`);
svg.setAttribute("height", `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`);
@@ -413,6 +471,8 @@ const SvgBox = props => {
svgContainerRef.current.style.height = `${dSvgBoxHeight ? dSvgBoxHeight : 250}px`;
}
} else if (props.showNew === 1) {
+ console.log("props.showNew === 1");
+
let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
let leftSize = 0;
let topSize = 0;
@@ -448,16 +508,30 @@ const SvgBox = props => {
const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
// 计算首盒部件与次盒部件尺寸
const getTop = (item, offset = 0) => {
- const map = {
- 10001: headWidth + Number(item?.value),
- 10002: Number(item?.value),
- 10003: Number(item?.value),
- 10004: Number(item?.value) + headWidth * 2,
- 10005: headWidth * 2,
- 10006: Number(item?.value) + headWidth,
- 10007: Number(item?.value) + headWidth,
- };
- return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
+ if (!item) return 0;
+
+ const type = Number(item.type);
+ const key = type - offset;
+
+ const headWidthNum = Number(headWidth) || 0;
+ const itemValue = Number(item.value) || 0;
+
+ switch (key) {
+ case 10001:
+ return headWidthNum + itemValue;
+ case 10002:
+ case 10003:
+ return itemValue;
+ case 10004:
+ return itemValue + headWidthNum * 2;
+ case 10005:
+ return headWidthNum * 2;
+ case 10006:
+ case 10007:
+ return itemValue + headWidthNum;
+ default:
+ return 0;
+ }
};
const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
const topLength = topLeft;
@@ -470,6 +544,9 @@ const SvgBox = props => {
ySvg = topOffect(boxList, headLength, headWidth);
} else {
leftSize = zbtb?.value;
+ if (zbtb?.type === "8009") {
+ leftSize = (Number(zbtb?.sLength) + Number(zbtb?.cLength) * scale) || 0;
+ }
}
svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth + 2} ${viewBoxHeight + 2}`);
@@ -524,16 +601,27 @@ const SvgBox = props => {
const leftOffect = boxList.find(x => x.sName === "左偏移")?.value || 0;
// 计算首盒部件与次盒部件尺寸
const getTop = (item, offset = 0) => {
- const map = {
- 10001: headWidth + Number(item?.value),
- 10002: Number(item?.value),
- 10003: Number(item?.value),
- 10004: Number(item?.value) + headWidth * 2,
- 10005: headWidth * 2,
- 10006: Number(item?.value) + headWidth,
- 10007: Number(item?.value) + headWidth,
- };
- return map[item?.type - offset] ?? 0; // 根据偏移量统一处理
+ if (!item || !item.type) return 0;
+
+ const key = item.type - offset;
+ const itemValue = Number(item.value) || 0;
+
+ switch (key) {
+ case 10001:
+ return headWidth + itemValue;
+ case 10002:
+ case 10003:
+ return itemValue;
+ case 10004:
+ return itemValue + headWidth * 2;
+ case 10005:
+ return headWidth * 2;
+ case 10006:
+ case 10007:
+ return itemValue + headWidth;
+ default:
+ return 0;
+ }
};
const topLeft = getTop(boxList.find(x => x.sName === "左上插位组件"));
const topLength = topLeft;
@@ -572,11 +660,151 @@ const SvgBox = props => {
let pathList = [];
// 上方盒舌
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0));
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledHeight, -dSFHS * scale, scaledWidth * 2 + scaledHeight * 2, 0));
- if (sfhs?.type && dSFHS) {
- pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
- pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (sfhs?.type && sfhs.type === "1009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ // 非 1009 类型的兜底逻辑
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0));
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledHeight, -dSFHS * scale, scaledWidth * 2 + scaledHeight * 2, 0));
+
+ if (sfhs?.type && dSFHS) {
+ pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
// 盒底组件
if (hdzj && hdzj.type) {
@@ -585,38 +813,396 @@ const SvgBox = props => {
pathList.push(createText(scaledWidth / 2, scaledDeep + (Number(hdzj?.value) / 2) * scales, 10 * scales, Number(hdzj?.value)));
} else {
// 下方盒舌
+ if (xfhs?.type && xfhs.type === "2009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep));
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledHeight, dXFHS * scale, scaledWidth * 2 + scaledHeight * 2, scaledDeep));
- if (xfhs?.type && dXFHS) {
- pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS));
- pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS));
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep));
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledHeight, dXFHS * scale, scaledWidth * 2 + scaledHeight * 2, scaledDeep));
+ if (xfhs?.type && dXFHS) {
+ pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS));
+ pathList.push(createText(scaledWidth * 2 + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 10) * scales, 10 * scales, dXFHS));
+ }
}
}
// 左边贴边
- pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dZTBW) {
- pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW));
+ if (zbtb?.type === "8009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
+ if (zbtb?.type && dZTBW) {
+ pathList.push(createText(-dZTBW * 0.4, scaledDeep / 2, 10 * scales, dZTBW));
+ }
}
// 右边贴边
+ if (ybtb?.type === "9009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
- pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale));
- if (ybtb?.type && dYTBW) {
- pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW));
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(
+ createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale)
+ );
+ if (ybtb?.type && dYTBW) {
+ pathList.push(createText(scaledWidth * 2 + scaledHeight * 2 + dYTBW * 0.4, scaledDeep / 2, 10 * scales, dYTBW));
+ }
}
// 左上部件
if (zsbj?.type && zsbj?.type === "3009") {
- console.log(zsbj, boxList, "zsbj");
// 先放层1的盒型
const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj;
- if (Number(sType) === 0) {
- const rectangles = [{ x: -sLength * scale, y: ((scaledDeep - (Number(sWidth) * scale)) / 2) + Number(sOffset), width: sLength * scale, height: sWidth * scale }];
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
rectangles.forEach(rect => {
- g.appendChild(createPathElements(rect.x, rect.y, rect.width, rect.height));
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
});
- svg.appendChild(g);
- }
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
} else {
pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0));
if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
@@ -645,95 +1231,337 @@ const SvgBox = props => {
}
// 右上部件
- pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0));
- if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6002" && dYSCW) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6003" && dYSCW) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6004" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
- );
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6005" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (ysbj?.type && dYSCW) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ // 右上部件
+ pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0));
+ if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6002" && dYSCW) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6003" && dYSCW) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6004" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6005" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ } else if (ysbj?.type && dYSCW) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ }
}
+
// 左下部件-
if (!(hdzj && hdzj.type)) {
- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep));
- if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4002" && dZXCW) {
- pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4003" && dZXCW) {
- pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4004" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4005" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (zxbj?.type && dZXCW) {
- pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep));
+ if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4002" && dZXCW) {
+ pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4003" && dZXCW) {
+ pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4004" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4005" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (zxbj?.type && dZXCW) {
+ pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ }
}
}
+ // 右下部件
if (!(hdzj && hdzj.type)) {
- pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep));
- if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7004" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(
- createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
- );
- pathList.push(
- createText(
- scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales,
- scaledDeep + (scaledHeight + scaledHeight / 2),
- 10 * scales,
- "W"
- )
- );
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)
- );
- } else if (yxbj?.type === "7005" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(
- createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
- );
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")
- );
- } else if (dYXCW && yxbj?.type) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ if (yxbj?.type && yxbj?.type === "7009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, scaledWidth + scaledHeight, scaledDeep));
+ if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2, 10 * scales, dYXCW));
+ } else if (yxbj?.type === "7004" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(
+ createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
+ );
+ pathList.push(
+ createText(
+ scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales,
+ scaledDeep + (scaledHeight + scaledHeight / 2),
+ 10 * scales,
+ "W"
+ )
+ );
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)
+ );
+ } else if (yxbj?.type === "7005" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(
+ createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
+ );
+ pathList.push(
+ createText(
+ scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales,
+ scaledDeep + (scaledHeight + scaledHeight / 2),
+ 10 * scales,
+ "W"
+ )
+ );
+ } else if (dYXCW && yxbj?.type) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ }
}
}
- // 右下部件
// 纵向 D
if (scaledDeep && scaledWidth && scaledHeight) {
@@ -764,116 +1592,741 @@ const SvgBox = props => {
svg.appendChild(g);
let pathList = [];
// 上方盒舌
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0));
- if (sfhs?.type && dSFHS) {
- pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (sfhs?.type && sfhs.type === "1009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth, 0));
+ if (sfhs?.type && dSFHS) {
+ pathList.push(createText(scaledWidth + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
+
// 下方盒舌
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep));
- if (xfhs?.type && dXFHS) {
- pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (xfhs?.type && xfhs.type === "2009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth, scaledDeep));
+ if (xfhs?.type && dXFHS) {
+ pathList.push(createText(scaledWidth + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
+
// 左边贴边
- pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dZTBW) {
- pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW));
+ if (zbtb?.type === "8009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
+ if (zbtb?.type && dZTBW) {
+ pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW));
+ }
}
+
// 右边贴边
- pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dYTBW) {
- pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW));
- }
- // 左上部件
- pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0));
- if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3004" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3005" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (zsbj?.type && dZSCW) {
- pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW));
- }
- // 右上部件
- pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0));
- if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6004" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
- );
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6005" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (ysbj?.type && dYSCW) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ if (ybtb?.type === "9009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight + yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth * 2 + scaledHeight + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth * 2 + scaledHeight, 0, dSFHS * scale, dXFHS * scale));
+ if (ybtb?.type && dYTBW) {
+ pathList.push(createText(scaledWidth * 2 + scaledHeight + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW));
+ }
+ }
+ // 左上部件
+ if (zsbj?.type && zsbj?.type === "3009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0));
+ if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3004" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3005" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (zsbj?.type && dZSCW) {
+ pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW));
+ }
+ }
+ // 右上部件
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledWidth + scaledHeight, 0));
+ if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6004" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6005" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ } else if (ysbj?.type && dYSCW) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ }
}
+
// 左下部件-
- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep));
- if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4004" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4005" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (zxbj?.type && dZXCW) {
- pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, 0, scaledDeep));
+ if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4004" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4005" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (zxbj?.type && dZXCW) {
+ pathList.push(createText(scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ }
}
+
// 右下部件
- pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep));
- if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7004" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(
- createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
- );
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")
- );
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7005" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(
- createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
- );
- pathList.push(
- createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W")
- );
- } else if (dYXCW && yxbj?.type) {
- pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ if (yxbj?.type && yxbj?.type === "7009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, scaledWidth + scaledHeight, scaledDeep));
+ if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ } else if (yxbj?.type === "7004" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(
+ createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
+ );
+ pathList.push(
+ createText(
+ scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales,
+ scaledDeep + (scaledHeight + scaledHeight / 2),
+ 10 * scales,
+ "W"
+ )
+ );
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)
+ );
+ } else if (yxbj?.type === "7005" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(
+ createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales)
+ );
+ pathList.push(
+ createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W")
+ );
+ } else if (dYXCW && yxbj?.type) {
+ pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ }
}
if (scaledDeep && scaledWidth && scaledHeight) {
// 纵向 D
@@ -905,69 +2358,662 @@ const SvgBox = props => {
svg.appendChild(g);
let pathList = [];
// 上方盒舌
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0));
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth + scaledHeight, 0));
- if (sfhs?.type && dSFHS) {
- pathList.push(createText(scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
- pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (sfhs?.type && sfhs.type === "1009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, 0, 0));
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledHeight, -dSFHS * scale, scaledWidth + scaledHeight, 0));
+ if (sfhs?.type && dSFHS) {
+ pathList.push(createText(scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
+
// 下方盒舌
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, 0, scaledDeep));
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth + scaledHeight, scaledDeep));
- if (xfhs?.type && dXFHS) {
- pathList.push(createText(scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
- pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ if (xfhs?.type && xfhs.type === "2009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, 0, scaledDeep));
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledHeight, dXFHS * scale, scaledWidth + scaledHeight, scaledDeep));
+ if (xfhs?.type && dXFHS) {
+ pathList.push(createText(scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ pathList.push(createText(scaledWidth + scaledHeight + scaledHeight / 2, scaledDeep + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ }
}
+
// 左边贴边
- pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dZTBW) {
- pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW));
+ if (zbtb?.type === "8009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidLeft(zbtb?.type, scaledDeep, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
+ if (zbtb?.type && dZTBW) {
+ pathList.push(createText(-dZTBW / 2, scaledDeep / 2, 10 * scales, dZTBW));
+ }
}
+
// 右边贴边
- pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dYTBW) {
- pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW));
+ if (ybtb?.type === "9009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidRight(ybtb?.type, scaledDeep, dYTBW * scale, scaledWidth + scaledHeight * 2, 0, dSFHS * scale, dXFHS * scale));
+ if (zbtb?.type && dYTBW) {
+ pathList.push(createText(scaledWidth + scaledHeight * 2 + dYTBW / 2, scaledDeep / 2, 10 * scales, dYTBW));
+ }
}
+
// 左下部件-
- pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep));
- if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4004" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4005" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (zxbj?.type && dZXCW) {
- pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zxbj?.type, scaledWidth, scaledHeight, dZXCW * scale, scaledHeight, scaledDeep));
+ if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + scaledHeight + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4004" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(
+ createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W")
+ );
+ pathList.push(createText(scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4005" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (zxbj?.type && dZXCW) {
+ pathList.push(createText(scaledHeight + scaledWidth / 2, scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ }
}
+
// 右上部件
- pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0));
- if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6004" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6005" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (ysbj?.type && dYSCW) {
- pathList.push(createText(scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(ysbj?.type, scaledWidth, -scaledHeight, -dYSCW * scale, scaledHeight, 0));
+ if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.5, -scaledHeight - dYSCW / 2, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6004" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.3, -(scaledHeight * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6005" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.1, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledHeight + scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledHeight + scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (ysbj?.type && dYSCW) {
+ pathList.push(createText(scaledHeight + scaledWidth * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ }
}
if (scaledDeep && scaledWidth && scaledHeight) {
@@ -988,114 +3034,706 @@ const SvgBox = props => {
});
svg.appendChild(g);
} else if (Number(svgType) === 4) {
+ // 天地盒
g.appendChild(createFullTelescope(scaledWidth, scaledHeight, scaledDeep, 0, 0));
svg.appendChild(g);
// createFullTelescope
let pathList = [];
// 上方盒舌
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, -scaledDeep, 0));
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledWidth + scaledDeep, 0));
- if (sfhs?.type && dSFHS) {
- pathList.push(createText(-scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
- pathList.push(createText(scaledWidth + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (sfhs?.type && sfhs.type === "1009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength) / 2 + numOffset - scaledDeep,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 - scaledDeep,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength - scaledDeep,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength) / 2 + numOffset + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, -scaledDeep, 0));
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledWidth + scaledDeep, 0));
+ if (sfhs?.type && dSFHS) {
+ pathList.push(createText(-scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ pathList.push(createText(scaledWidth + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
+
// 下方盒舌
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, -scaledDeep, scaledHeight));
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledDeep + scaledWidth, scaledHeight));
- if (xfhs?.type && dXFHS) {
- pathList.push(createText(-scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
- pathList.push(createText(scaledWidth + scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ if (xfhs?.type && xfhs.type === "2009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength) / 2 + numOffset - scaledDeep,
+ y: scaledHeight - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 - scaledDeep,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength - scaledDeep,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength) / 2 + numOffset + scaledWidth,
+ y: scaledHeight - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledDeep - totalLength * 2) / 2 - numOffset / 2 + scaledWidth,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledDeep - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, -scaledDeep, scaledHeight));
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledDeep + scaledWidth, scaledHeight));
+ if (xfhs?.type && dXFHS) {
+ pathList.push(createText(-scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ pathList.push(createText(scaledWidth + scaledDeep / 2, scaledHeight + (dXFHS / 2 - 5) * scales, 10 * scales, dXFHS));
+ }
}
+
// 上方部件
- pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep));
- if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D"));
- // 插位值
- pathList.push(createText(scaledWidth / 2, -scaledDeep * 2 - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3002" && dZSCW) {
- pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3003" && dZSCW) {
- pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3004" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight - scaledDeep / 2, 10 * scales, "D"));
-
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, -(scaledDeep * 2 + scaledDeep / 2), scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D"));
-
- pathList.push(createText(scaledWidth * 0.3, -(scaledDeep * 3) - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3005" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, -scaledDeep - scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D"));
- } else if (zsbj?.type && dZSCW) {
- pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ if (zsbj?.type && zsbj?.type === "3009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: -totalWidth - scaledDeep + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth - scaledDeep + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth - scaledDeep + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledDeep, -dZSCW * scale, 0, -scaledDeep));
+ if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D"));
+ // 插位值
+ pathList.push(createText(scaledWidth / 2, -scaledDeep * 2 - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3002" && dZSCW) {
+ pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3003" && dZSCW) {
+ pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3004" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, -scaledDeep - scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight - scaledDeep / 2, 10 * scales, "D"));
+
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, -(scaledDeep * 2 + scaledDeep / 2), scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D"));
+
+ pathList.push(createText(scaledWidth * 0.3, -(scaledDeep * 3) - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3005" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, -scaledDeep - scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledDeep - scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, -(scaledDeep * 2 + scaledDeep / 2), scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledDeep * 2 + scaledDeep / 2), 10 * scales, "D"));
+ } else if (zsbj?.type && dZSCW) {
+ pathList.push(createText(scaledWidth / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ }
}
+
// 左边部件
- pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0));
- if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4004") {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
-
- pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.2, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4005" && dZXCW) {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset - scaledDeep,
+ y: (scaledHeight - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset - scaledDeep,
+ y: (scaledHeight - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset - scaledDeep,
+ y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
} else {
- pathList.push(createText(-scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW));
+ pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0));
+ if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4004") {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+
+ pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.2, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4005" && dZXCW) {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(-scaledDeep - scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ } else {
+ pathList.push(createText(-scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW));
+ }
}
+
// 右边
- pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0));
- if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6004" && dYSCW) {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.2, 10 * scales, dYSCW));
- } else if (zxbj?.type === "4005" && dYSCW) {
- pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
- pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
- pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth + scaledDeep + yExtraOffset,
+ y: (scaledHeight - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth + scaledDeep + yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth + scaledDeep + yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
} else {
- pathList.push(createText(scaledWidth + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW));
+ pathList.push(createFull(ysbj?.type, scaledHeight, scaledDeep, dYSCW, scaledWidth + scaledDeep, 0));
+ if ((ysbj?.type === "6001" && dYSCW) || (ysbj?.type === "6006" && dYSCW) || (ysbj?.type === "6007" && dYSCW)) {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6004" && dYSCW) {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep + dYSCW / 2, scaledHeight * 0.2, 10 * scales, dYSCW));
+ } else if (zxbj?.type === "4005" && dYSCW) {
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ pathList.push(createHorizontalDoubleArrow(scaledDeep, scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8, scales));
+ pathList.push(createText(scaledWidth + scaledDeep + scaledDeep + scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
+ } else {
+ pathList.push(createText(scaledWidth + scaledDeep + dYSCW / 2, scaledHeight * 0.5, 10 * scales, dYSCW));
+ }
}
+
// 下方部件
- pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep));
- if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
- // 插位值
- pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep * 2 + dYXCW / 2 - 5, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7004" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
-
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D"));
-
- pathList.push(createText(scaledWidth * 0.3, scaledHeight + scaledDeep * 3 + dYXCW / 2 - 5, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7005" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, scaledHeight + scaledDeep + scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D"));
- } else if (dYXCW && yxbj?.type) {
- pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep + dYXCW / 2 - 5, 10 * scales, dYXCW));
+ if (yxbj?.type && yxbj?.type === "7009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: scaledHeight + scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledHeight + scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2,
+ y: scaledHeight + scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledDeep, dYXCW * scale, 0, scaledHeight + scaledDeep));
+ if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
+ // 插位值
+ pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep * 2 + dYXCW / 2 - 5, 10 * scales, dYXCW));
+ } else if (yxbj?.type === "7004" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.2, scaledHeight + scaledDeep + scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
+
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.85, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D"));
+
+ pathList.push(createText(scaledWidth * 0.3, scaledHeight + scaledDeep * 3 + dYXCW / 2 - 5, 10 * scales, dYXCW));
+ } else if (yxbj?.type === "7005" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.1, scaledHeight + scaledDeep + scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, scaledHeight + scaledDeep + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledWidth * 0.8, scaledHeight + scaledDeep * 2 + scaledDeep / 2, scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, scaledHeight + scaledDeep * 2 + scaledDeep / 2, 10 * scales, "D"));
+ } else if (dYXCW && yxbj?.type) {
+ pathList.push(createText(scaledWidth / 2, scaledHeight + scaledDeep + dYXCW / 2 - 5, 10 * scales, dYXCW));
+ }
}
if (scaledDeep && scaledWidth && scaledHeight) {
@@ -1129,134 +3767,884 @@ const SvgBox = props => {
svg.appendChild(g);
let pathList = [];
// 上方盒舌
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0));
- pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0));
- if (sfhs?.type && dSFHS) {
- pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
- pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ if (sfhs?.type && sfhs.type === "1009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = sfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, scaledDeep, -dSFHS * scale, scaledHeight, 0));
+ pathList.push(createUpperBoxTongueLeft(sfhs?.type, -scaledDeep, -dSFHS * scale, scaledHeight * 2 + scaledDeep * 2, 0));
+ if (sfhs?.type && dSFHS) {
+ pathList.push(createText(scaledHeight + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, -(dSFHS / 2 - 5) * scales, 10 * scales, dSFHS));
+ }
}
+
// 下方盒舌
+ if (xfhs?.type && xfhs.type === "2009") {
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = xfhs;
+ // 通用函数:添加矩形层(支持单双数量、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ const addLayers = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength) / 2 + numOffset + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledHeight - totalLength * 2) / 2 - numOffset / 2 + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledHeight - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledWidth + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ addLayers({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+ // === 绘制 cType 层(y 多一个偏移)===
+ addLayers({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // 在 s 层下方
+ });
+ // 将 group 添加到 svg
+ svg.appendChild(g);
+ } else {
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth));
+ pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth));
+ if (xfhs?.type && dXFHS) {
+ pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS));
+ pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS));
+ }
+ }
+
+ // 左边贴边
+ if (zbtb?.type === "8009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zbtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, scaledDeep, dXFHS * scale, scaledHeight, scaledWidth));
- pathList.push(createUpperBoxTongueLeft(xfhs?.type, -scaledDeep, dXFHS * scale, scaledHeight * 2 + scaledDeep * 2, scaledWidth));
- if (xfhs?.type && dXFHS) {
- pathList.push(createText(scaledHeight + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS));
- pathList.push(createText(scaledHeight * 2 + scaledDeep + scaledDeep / 2, scaledWidth + (dXFHS / 2) * scales, 10 * scales, dXFHS));
- }
+ let rectangles = [];
- // 左边贴边
- pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
- if (zbtb?.type && dZTBW) {
- pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW));
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createTrapezoidLeft(zbtb?.type, scaledWidth, -dZTBW * scale, 0, 0, dSFHS * scale, dXFHS * scale));
+ if (zbtb?.type && dZTBW) {
+ pathList.push(createText(-dZTBW * 0.4, scaledWidth / 2, 10 * scales, dZTBW));
+ }
}
+
// 右边贴边
- pathList.push(createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale));
- if (ybtb?.type && dYTBW) {
- pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW));
+ if (ybtb?.type === "9009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth * 2 + scaledHeight * 2 + yExtraOffset,
+ y: (scaledDeep - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(
+ createTrapezoidRight(ybtb?.type, scaledWidth, dYTBW * scale, scaledHeight * 2 + scaledDeep * 2, 0, dSFHS * scale, dXFHS * scale)
+ );
+ if (ybtb?.type && dYTBW) {
+ pathList.push(createText(scaledHeight * 2 + scaledDeep * 2 + dYTBW * 0.4, scaledWidth / 2, 10 * scales, dYTBW));
+ }
}
+
// 左上部件
- pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0));
- if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- // 插位值
- pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3002" && dZSCW) {
- pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3003" && dZSCW) {
- pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3004" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
- pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3005" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D"));
- } else if (zsbj?.type && dZSCW) {
- pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
+ if (zsbj?.type && zsbj?.type === "3009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zsbj?.type, scaledHeight, -scaledDeep, -dZSCW * scale, 0, 0));
+ if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ // 插位值
+ pathList.push(createText(scaledHeight / 2, -scaledDeep - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3002" && dZSCW) {
+ pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3003" && dZSCW) {
+ pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3004" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
+ pathList.push(createText(scaledHeight * 0.3, -(scaledDeep * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3005" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D"));
+ } else if (zsbj?.type && dZSCW) {
+ pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
+ }
}
+
// 右上部件
- pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0));
- if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6002" && dYSCW) {
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6003" && dYSCW) {
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6004" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
- } else if (ysbj?.type === "6005" && ysbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
- } else if (ysbj?.type && dYSCW) {
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ysbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight * 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight * 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight * 2 + scaledWidth,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(ysbj?.type, scaledHeight, -scaledDeep, -dYSCW * scale, scaledHeight + scaledDeep, 0));
+ if ((ysbj?.type === "6001" && ysbj?.value) || (ysbj?.type === "6006" && ysbj?.value) || (ysbj?.type === "6007" && ysbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -scaledDeep - dYSCW / 2, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6002" && dYSCW) {
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6003" && dYSCW) {
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6004" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, -(scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, -(scaledDeep * 2) - dYSCW / 2 + 4, 10 * scales, dYSCW));
+ } else if (ysbj?.type === "6005" && ysbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, -scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D"));
+ } else if (ysbj?.type && dYSCW) {
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW));
+ }
}
+
// 左下部件-
if (!(hdzj && hdzj.type)) {
- pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth));
- if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4002" && dZXCW) {
- pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4003" && dZXCW) {
- pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4004" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D"));
- pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
- } else if (zxbj?.type === "4005" && zxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales));
- pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D"));
- } else if (zxbj?.type && dZXCW) {
- pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zxbj?.type, scaledHeight, scaledDeep, dZXCW * scale, 0, scaledWidth));
+ if ((zxbj?.type === "4001" && zxbj?.value) || (zxbj?.type === "4006" && zxbj?.value) || (zxbj?.type === "4007" && zxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createText(scaledHeight / 2, scaledWidth + scaledDeep + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4002" && dZXCW) {
+ pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4003" && dZXCW) {
+ pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4004" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight * 0.85 + 10 * scales, scaledHeight + (scaledWidth + scaledWidth / 2), 10 * scales, "D"));
+ pathList.push(createText(scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ } else if (zxbj?.type === "4005" && zxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales));
+ pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D"));
+ } else if (zxbj?.type && dZXCW) {
+ pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW));
+ }
}
}
if (!(hdzj && hdzj.type)) {
- pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth));
- if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7004" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(
- createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)
- );
- pathList.push(
- createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")
- );
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW));
- } else if (yxbj?.type === "7005" && yxbj?.value) {
- pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales));
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
- pathList.push(
- createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)
- );
- pathList.push(
- createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")
- );
- } else if (dYXCW && yxbj?.type) {
- pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ if (yxbj?.type && yxbj?.type === "7009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset + scaledHeight * 2 + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2 + scaledHeight * 2 + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength + scaledHeight * 2 + scaledWidth,
+ y: scaledDeep - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(yxbj?.type, scaledHeight, scaledDeep, dYXCW * scale, scaledHeight + scaledDeep, scaledWidth));
+ if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.2, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + scaledDeep + dYXCW / 2, 10 * scales, dYXCW));
+ } else if (yxbj?.type === "7004" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledDeep * 0.2, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.2 - 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(
+ createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.85, scaledWidth + (scaledDeep + scaledDeep / 2), scales)
+ );
+ pathList.push(
+ createText(scaledHeight + scaledDeep + scaledHeight * 0.85 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")
+ );
+ pathList.push(
+ createText(scaledHeight + scaledDeep + scaledHeight * 0.3, scaledWidth + scaledDeep * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)
+ );
+ } else if (yxbj?.type === "7005" && yxbj?.value) {
+ pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.1, scaledWidth + scaledDeep / 2, scales));
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
+ pathList.push(
+ createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)
+ );
+ pathList.push(
+ createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")
+ );
+ } else if (dYXCW && yxbj?.type) {
+ pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, scaledWidth + dYXCW / 2 - 4, 10 * scales, dYXCW));
+ }
}
}
// 右下部件
@@ -1292,32 +4680,344 @@ const SvgBox = props => {
// svg.appendChild(g);
let pathList = [];
// 左上部件
- pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0));
- if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3004" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
- } else if (zsbj?.type === "3005" && zsbj?.value) {
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales));
- pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
- pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
- } else if (zsbj?.type && dZSCW) {
- pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW));
+ if (zsbj?.type && zsbj?.type === "3009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zsbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: -totalWidth + yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2 + halfLength,
+ y: -totalWidth + yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0));
+ if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createText(scaledWidth / 2, -scaledHeight - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3004" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.2 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.85, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.85 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.3, -(scaledHeight * 2) - dZSCW / 2 + 4, 10 * scales, dZSCW));
+ } else if (zsbj?.type === "3005" && zsbj?.value) {
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.1, -scaledHeight / 2, scales));
+ pathList.push(createText(scaledWidth * 0.1 + 10 * scales, -scaledHeight / 2, 10 * scales, "W"));
+ pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.8, -(scaledHeight + scaledHeight / 2), scales));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ pathList.push(createText(scaledWidth * 0.8 + 10 * scales, -(scaledHeight + scaledHeight / 2), 10 * scales, "W"));
+ } else if (zsbj?.type && dZSCW) {
+ pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW));
+ }
}
+
// 右下部件
- pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight));
+ if (yxbj?.type && yxbj?.type === "7009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = yxbj;
+
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoid : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength) / 2 + numOffset,
+ y: scaledHeight - yExtraOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ rectangles = [
+ {
+ x: (scaledWidth - totalLength * 2) / 2 - numOffset / 2,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: (scaledWidth - totalLength * 2) / 2 + numOffset / 2,
+ y: scaledHeight - yExtraOffset,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: -Number(sWidth) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight));
+ }
// 右边
- pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0));
- pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0));
+ if (ysbj?.type && ysbj?.type === "6009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = ybtb;
+ // 通用函数:添加一层矩形(支持单双、矩形/梯形)
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoidRight : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: scaledWidth + yExtraOffset,
+ y: (scaledHeight - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: scaledWidth + yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: scaledWidth + yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0));
+ }
+ // 左边
+ if (zxbj?.type && zxbj?.type === "4009") {
+ // 先放层1的盒型
+ const { sType, sLength, sWidth, sOffset, sQuantity, cType, cLength, cWidth, cOffset, cQuantity } = zxbj;
+ const addLayer = params => {
+ const { type = null, length, width, offset, quantity, isTrapezoid, yExtraOffset = 0 } = params;
+ if (type === null) return;
+ if (!quantity) return;
+
+ const numQuantity = Number(quantity);
+ const totalLength = Number(length) * scale;
+ const totalWidth = Number(width) * scale;
+ const numOffset = Number(offset) * scale;
+
+ // 选择绘制函数
+ const createFunc = isTrapezoid ? createPathElementTrapezoids : createPathElements;
+
+ let rectangles = [];
+
+ if (numQuantity === 1) {
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledHeight - totalWidth) / 2 + numOffset,
+ width: totalLength,
+ height: totalWidth,
+ },
+ ];
+ } else if (numQuantity === 2) {
+ const halfLength = totalLength;
+ const halfWidth = totalWidth * 2;
+ rectangles = [
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 - numOffset / 2,
+ width: halfLength,
+ height: totalWidth,
+ },
+ {
+ x: -totalLength - yExtraOffset,
+ y: (scaledHeight - halfWidth) / 2 + numOffset / 2 + totalWidth,
+ width: halfLength,
+ height: totalWidth,
+ },
+ ];
+ }
+
+ rectangles.forEach(rect => {
+ g.appendChild(createFunc(rect.x, rect.y, rect.width, rect.height));
+ });
+ };
+
+ // === 绘制 sType 层 ===
+ addLayer({
+ type: sType,
+ length: sLength,
+ width: sWidth,
+ offset: sOffset,
+ quantity: sQuantity,
+ isTrapezoid: Number(sType) !== 0,
+ });
+
+ // === 绘制 cType 层(在 s 层下方)===
+ addLayer({
+ type: cType,
+ length: cLength,
+ width: cWidth,
+ offset: cOffset,
+ quantity: cQuantity,
+ isTrapezoid: Number(cType) !== 0,
+ yExtraOffset: Number(sLength) * scale, // sWidth 的偏移
+ });
+
+ // 将分组添加到 SVG
+ svg.appendChild(g);
+ } else {
+ pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0));
+ }
pathList.forEach(x => {
g.appendChild(x);
@@ -1468,17 +5168,33 @@ const SvgBox = props => {
const dY = Number(yscw?.value) || 0;
if (svg === 8) {
- const scw = val.find(x => x.sName === "上插位组件");
- const topsMap = {
- 11001: width + Number(scw?.value),
- 11002: Number(scw?.value),
- 11003: Number(scw?.value),
- 11004: Number(scw?.value) + width * 2,
- 11005: width * 2,
- 11006: Number(scw?.value) + width,
- 11007: Number(scw?.value) + width,
+ const getTopValue = (scw, width) => {
+ if (!scw || !scw.type) return 0;
+
+ const scwValue = Number(scw.value) || 0;
+ const type = Number(scw.type);
+
+ switch (type) {
+ case 11001:
+ return width + scwValue;
+ case 11002:
+ case 11003:
+ return scwValue;
+ case 11004:
+ return scwValue + width * 2;
+ case 11005:
+ return width * 2;
+ case 11006:
+ case 11007:
+ return scwValue + width;
+ default:
+ return 0;
+ }
};
- return topsMap[scw?.type] ?? 0;
+ // 使用示例
+ const scw = val.find(x => x.sName === "上插位组件");
+ const topValue = getTopValue(scw, width);
+ return isNaN(topValue) ? 0 : topValue;
}
const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
const four = ["6004", "3004", "4004", "7004"];
@@ -1491,6 +5207,9 @@ const SvgBox = props => {
if (five.includes(t)) return 2 * coef;
if (four.includes(t)) return 2 * coef + d;
if (one.includes(t)) return coef + d;
+ if (t && t.includes("09")) {
+ return Number(cw.sWidth) + Number(cw.cWidth);
+ }
return d;
};
@@ -1504,6 +5223,10 @@ const SvgBox = props => {
} else if (zscw?.type) {
top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
} else {
+ const t = sfhs?.type;
+ if (t && t.includes("09")) {
+ return Number(sfhs.sWidth) + Number(sfhs.cWidth);
+ }
top = sfhs?.value || 0;
}
@@ -1527,25 +5250,41 @@ const SvgBox = props => {
if (svg === 8) {
const zxcw = val.find(x => x.sName === "左下插位组件");
const yxcw = val.find(x => x.sName === "右下插位组件");
- const topsMap = {
- 14001: width + Number(zxcw?.value),
- 14002: Number(zxcw?.value),
- 14003: Number(zxcw?.value),
- 14004: Number(zxcw?.value) + width * 2,
- 14005: width * 2,
- 14006: Number(zxcw?.value) + width,
- 14007: Number(zxcw?.value) + width,
- };
- const topsMapRight = {
- 16001: width + Number(yxcw?.value),
- 16002: Number(yxcw?.value),
- 16003: Number(yxcw?.value),
- 16004: Number(yxcw?.value) + width * 2,
- 16005: width * 2,
- 16006: Number(yxcw?.value) + width,
- 16007: Number(yxcw?.value) + width,
+
+ const calculateTopValue = (component, baseWidth) => {
+ if (!component || !component.type) return 0;
+
+ const componentValue = Number(component.value) || 0;
+
+ switch (Number(component.type)) {
+ case 14001:
+ case 16001:
+ return baseWidth + componentValue;
+ case 14002:
+ case 14003:
+ case 16002:
+ case 16003:
+ return componentValue;
+ case 14004:
+ case 16004:
+ return componentValue + baseWidth * 2;
+ case 14005:
+ case 16005:
+ return baseWidth * 2;
+ case 14006:
+ case 14007:
+ case 16006:
+ case 16007:
+ return componentValue + baseWidth;
+ default:
+ return 0;
+ }
};
- return Math.max(topsMap[zxcw?.type], topsMapRight[yxcw?.type]) ?? 0;
+
+ const leftTopValue = calculateTopValue(zxcw, width);
+ const rightTopValue = calculateTopValue(yxcw, width);
+
+ return Math.max(leftTopValue, rightTopValue);
}
const one = ["6001", "3001", "4001", "7001", "3006", "4006", "6006", "7006", "3007", "4007", "6007", "7007"];
const four = ["6004", "3004", "4004", "7004"];
@@ -1558,6 +5297,9 @@ const SvgBox = props => {
if (five.includes(t)) return 2 * coef;
if (four.includes(t)) return 2 * coef + d;
if (one.includes(t)) return coef + d;
+ if (t && t.includes("09")) {
+ return Number(cw.sWidth) + Number(cw.cWidth);
+ }
return d;
};
@@ -1571,6 +5313,10 @@ const SvgBox = props => {
} else if (zscw?.type) {
top = Math.max(pick(zscw, dZ), sfhs?.value || 0);
} else {
+ const t = sfhs?.type;
+ if (t && t.includes("09")) {
+ return Number(sfhs.sWidth) + Number(sfhs.cWidth);
+ }
top = sfhs?.value || 0;
}
@@ -1578,88 +5324,298 @@ const SvgBox = props => {
return isNaN(top) ? 0 : top;
};
// 上方盒舌左边
- const createUpperBoxTongueLeft = (type, w, h, ox, oy) => {
- if (!h) return createNoneProject();
- const fnMap = {
- 1001: createLineWeltTop,
- 1002: createIsoscelesTrapezoidWeltTop,
- 1003: createTrapezoidWeltTop,
- 1004: createFoldWeltTop,
- 1005: createRoundedCornersWeltTop,
- 2001: createLineWeltTop,
- 2002: createIsoscelesTrapezoidWeltTop,
- 2003: createTrapezoidWeltTop,
- 2004: createFoldWeltTop,
- 2005: createRoundedCornersWeltTop,
- };
- return (fnMap[type] || createNoneProject)(w, h, ox, oy);
+ const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, offsetX, offsetY) => {
+ if (!height) return createNoneProject();
+ // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回
+ let data = {};
+ switch (upperBoxTongueType) {
+ case "1001":
+ data = createLineWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "1002":
+ data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "1003":
+ data = createTrapezoidWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "1004":
+ data = createFoldWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "1005":
+ data = createRoundedCornersWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "2001":
+ data = createLineWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "2002":
+ data = createIsoscelesTrapezoidWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "2003":
+ data = createTrapezoidWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "2004":
+ data = createFoldWeltTop(width, height, offsetX, offsetY);
+ break;
+ case "2005":
+ data = createRoundedCornersWeltTop(width, height, offsetX, offsetY);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
+ };
+ // 右上方盒舌
+ const createUpperBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {
+ if (!size) return createNoneProject();
+ // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回
+ let data = {};
+ switch (upperBoxTongueType) {
+ case "1001":
+ data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);
+ break;
+ case 1:
+ data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
};
-
// 右上方盒舌
+ const createBottomBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {
+ if (!size) return createNoneProject();
+ // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回
+ let data = {};
+ switch (upperBoxTongueType) {
+ case 0:
+ data = createTopTongue(-deep, offsetX, offsetY, size, -2, 5, 0, true);
+ break;
+ case 1:
+ data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
+ };
+ const createBottomBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => {
+ if (!size) return createNoneProject();
+ // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回
+ let data = {};
+ switch (upperBoxTongueType) {
+ case 0:
+ data = createTopTongue(deep, offsetX, offsetY, size, 2, 5, 1, false);
+ break;
+ case 1:
+ data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
+ };
// 左边贴位
const createTrapezoidLeft = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => {
if (!size) return createNoneProject();
- const fnMap = {
- 8001: createWelt,
- 8002: createWelt1,
- 8003: createWelt2,
- 8004: createWelt3,
- 8005: createWelt4,
- };
- const fn = fnMap[trapezoidLeftType];
- return fn
- ? trapezoidLeftType === "8005"
- ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS)
- : fn(height, size, offsetX, offsetY)
- : createNoneProject();
+ let data = {};
+ switch (trapezoidLeftType) {
+ case "8001":
+ data = createWelt(height, size, offsetX, offsetY);
+ break;
+ case "8002":
+ data = createWelt1(height, size, offsetX, offsetY);
+ break;
+ case "8003":
+ data = createWelt2(height, size, offsetX, offsetY);
+ break;
+ case "8004":
+ data = createWelt3(height, size, offsetX, offsetY);
+ break;
+ case "8005":
+ data = createWelt4(height, size, offsetX, offsetY, dSFHS, dXFHS);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
};
// 右边贴位
const createTrapezoidRight = (trapezoidLeftType, height, size, offsetX, offsetY, dSFHS, dXFHS) => {
- const suffix = trapezoidLeftType;
- const fnMap = {
- 9001: createWelt,
- 9002: createWelt1,
- 9003: createWelt2Right,
- 9004: createWelt3Right,
- 9005: createWelt4Right,
- };
- const fn = fnMap[suffix];
- return fn ? (suffix === "9005" ? fn(height, size, offsetX, offsetY, dSFHS, dXFHS) : fn(height, size, offsetX, offsetY)) : createNoneProject();
+ if (!size) return createNoneProject();
+ let data = {};
+ switch (trapezoidLeftType) {
+ case "9001":
+ data = createWelt(height, size, offsetX, offsetY);
+ break;
+ case "9002":
+ data = createWelt1(height, size, offsetX, offsetY);
+ break;
+ case "9003":
+ data = createWelt2Right(height, size, offsetX, offsetY);
+ break;
+ case "9004":
+ data = createWelt3Right(height, size, offsetX, offsetY);
+ break;
+ case "9005":
+ data = createWelt4Right(height, size, offsetX, offsetY, dSFHS, dXFHS);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
};
// 左上部件
const createDynamicTopLeft = (trapezoidLeftType, width, height, size, offsetX, offsetY) => {
if (!size) return createNoneProject();
-
+ let data = {};
const suffix = trapezoidLeftType?.slice(-2);
- const fnMap = {
- "01": createBoxComponentNew,
- "02": createBoxComponentNew1,
- "03": createBoxComponentNew2,
- "04": createBoxComponentNew3,
- "05": createBoxComponentNew4,
- "06": createBoxComponentNew5,
- "07": createBoxComponentNew6,
- };
-
- const fn = fnMap[suffix];
- return fn ? fn(width, height, size, offsetX, offsetY) : createNoneProject();
+ switch (suffix) {
+ case "01":
+ data = createBoxComponentNew(width, height, size, offsetX, offsetY);
+ break;
+ case "02":
+ data = createBoxComponentNew1(width, height, size, offsetX, offsetY);
+ break;
+ case "03":
+ data = createBoxComponentNew2(width, height, size, offsetX, offsetY);
+ break;
+ case "04":
+ data = createBoxComponentNew3(width, height, size, offsetX, offsetY);
+ break;
+ case "05":
+ data = createBoxComponentNew4(width, height, size, offsetX, offsetY);
+ break;
+ case "06":
+ data = createBoxComponentNew5(width, height, size, offsetX, offsetY);
+ break;
+ case "07":
+ data = createBoxComponentNew6(width, height, size, offsetX, offsetY);
+ break;
+ case "4001":
+ data = createBoxComponentNew(width, height, size, offsetX, offsetY);
+ break;
+ case "4002":
+ data = createBoxComponentNew1(width, height, size, offsetX, offsetY);
+ break;
+ case "4003":
+ data = createBoxComponentNew2(width, height, size, offsetX, offsetY);
+ break;
+ case "4004":
+ data = createBoxComponentNew3(width, height, size, offsetX, offsetY);
+ break;
+ case "4005":
+ data = createBoxComponentNew4(width, height, size, offsetX, offsetY);
+ break;
+ case "4006":
+ data = createBoxComponentNew5(width, height, size, offsetX, offsetY);
+ break;
+ case "4007":
+ data = createBoxComponentNew6(width, height, size, offsetX, offsetY);
+ break;
+ case "6001":
+ data = createBoxComponentNew(width, height, size, offsetX, offsetY);
+ break;
+ case "6002":
+ data = createBoxComponentNew1(width, height, size, offsetX, offsetY);
+ break;
+ case "6003":
+ data = createBoxComponentNew2(width, height, size, offsetX, offsetY);
+ break;
+ case "6004":
+ data = createBoxComponentNew3(width, height, size, offsetX, offsetY);
+ break;
+ case "6005":
+ data = createBoxComponentNew4(width, height, size, offsetX, offsetY);
+ break;
+ case "6006":
+ data = createBoxComponentNew5(width, height, size, offsetX, offsetY);
+ break;
+ case "6007":
+ data = createBoxComponentNew6(width, height, size, offsetX, offsetY);
+ break;
+ case "7001":
+ data = createBoxComponentNew(width, height, size, offsetX, offsetY);
+ break;
+ case "7002":
+ data = createBoxComponentNew1(width, height, size, offsetX, offsetY);
+ break;
+ case "7003":
+ data = createBoxComponentNew2(width, height, size, offsetX, offsetY);
+ break;
+ case "7004":
+ data = createBoxComponentNew3(width, height, size, offsetX, offsetY);
+ break;
+ case "7005":
+ data = createBoxComponentNew4(width, height, size, offsetX, offsetY);
+ break;
+ case "7006":
+ data = createBoxComponentNew5(width, height, size, offsetX, offsetY);
+ break;
+ case "7007":
+ data = createBoxComponentNew6(width, height, size, offsetX, offsetY);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
+ };
+ // 右上部件
+ const createDynamicTopRight = (trapezoidLeftType, width, height, size, offsetX, offsetY) => {
+ if (!size) return createNoneProject();
+ let data = {};
+ switch (trapezoidLeftType) {
+ case "6001":
+ data = createBoxComponentNew(width, height, size, offsetX, offsetY);
+ break;
+ case 1:
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
};
-
// 盒底组件 特殊的盒底组件
const createBoxBottomComponent = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => {
+ let data = {};
const suffix = trapezoidLeftType?.slice(-2);
- const fnMap = {
- "01": createRightAngleBoxBottomComponent,
- "02": createBoxBottomComponent1,
- "03": createBoxBottomComponent2,
- "04": createBoxBottomComponent3,
- "05": createBoxBottomComponent4,
- "06": createBoxBottomComponent5,
- "07": createBoxBottomComponent6,
- };
- return (fnMap[suffix] || createNoneProject)(width, deep, size, offsetX, offsetY);
+ switch (suffix) {
+ case "01":
+ data = createRightAngleBoxBottomComponent(width, deep, size, offsetX, offsetY);
+ break;
+ case "02":
+ data = createBoxBottomComponent1(width, deep, size, offsetX, offsetY);
+ break;
+ case "03":
+ data = createBoxBottomComponent2(width, deep, size, offsetX, offsetY);
+ break;
+ case "04":
+ data = createBoxBottomComponent3(width, deep, size, offsetX, offsetY);
+ break;
+ case "05":
+ data = createBoxBottomComponent4(width, deep, size, offsetX, offsetY);
+ break;
+ case "06":
+ data = createBoxBottomComponent5(width, deep, size, offsetX, offsetY);
+ break;
+ case "07":
+ data = createBoxBottomComponent6(width, deep, size, offsetX, offsetY);
+ break;
+ default:
+ data = createNoneProject();
+ break;
+ }
+ return data;
};
+
// 天地盒部件
const createFull = (trapezoidLeftType, width, deep, size, offsetX, offsetY) => {
if (!size) return createNoneProject();
diff --git a/src/components/Common/CommonComponent/index.js b/src/components/Common/CommonComponent/index.js
index 664ab0a..98b755a 100644
--- a/src/components/Common/CommonComponent/index.js
+++ b/src/components/Common/CommonComponent/index.js
@@ -1258,12 +1258,19 @@ export default class CommonComponent extends Component {
>
);
}
+ const removeExtension = (filename) => {
+ const lastDotIndex = filename.lastIndexOf('.');
+ if (lastDotIndex === -1) {
+ // 如果字符串中没有点,则返回原字符串
+ return filename;
+ }
+ return filename.substring(0, lastDotIndex);
+ }
if (sName === "sPackPath" || sName === "sPackDetailPathUpLoad" || sName === "sSvgPath") {
- let imageUrls = "";
- const uploadProps = {
+ const uploadProps = {
listType: "picture-card",
className: "avatar-uploader",
- action: `${commonConfig.server_host}file/uploadLogo?sLogoName=logo${sName}${this.props.record.sName}`,
+ action: `${commonConfig.server_host}file/uploadPrice?sLogoName=logo${sName}${this.props.record.sName}`,
disabled: !this.props.enabled,
onChange: info => {
const { fileList } = info;
@@ -1271,17 +1278,17 @@ export default class CommonComponent extends Component {
const { status, response } = file;
if (status === "done") {
if (response && response.code === 1) {
- const imageUrlNew = `${commonConfig.server_host}file/downloadLogo?sLogoName=logo${sName}${
- this.props.record.sName
- }&date=${new Date().getTime()}`;
+ const imageUrl = removeExtension(response.dataset.rows[0].savePathStr);
+ // const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=logo${removeExtension(imageUrl)}${this.props.record.sName
+ // }&date=${new Date().getTime()}`;
if (sName === "sPackPath") {
- this.props.onChange(this.props.name, sName, { sPackPath: imageUrlNew }, this.props.sId, []);
+ this.props.onChange(this.props.name, sName, { sPackPath: imageUrl }, this.props.sId, []);
} else if (sName === "sPackDetailPathUpLoad") {
- this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrlNew }, this.props.sId, []);
+ this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrl }, this.props.sId, []);
} else {
- this.props.onChange(this.props.name, sName, { sSvgPath: imageUrlNew }, this.props.sId, []);
+ this.props.onChange(this.props.name, sName, { sSvgPath: imageUrl }, this.props.sId, []);
}
- imageUrls = imageUrlNew;
+ imageUrls = imageUrl;
} else if (response && response.code === -1) {
message.error(response.msg);
}
@@ -1291,12 +1298,11 @@ export default class CommonComponent extends Component {
showUploadList: false,
openFileDialogOnClick: this.props.enabled,
};
- const imageUrl =
- sName === "sPackPath"
- ? this.props.record.sPackPath
- : sName === "sPackDetailPathUpLoad"
- ? this.props.record.sPackDetailPathUpLoad
- : this.props.record.sSvgPath;
+ const getImageUrl = (sName) => {
+ const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`;
+ return imageUrlNew
+ }
+ 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) : '');
return (
@@ -1365,6 +1371,18 @@ export default class CommonComponent extends Component {
type: x.sTypes || null,
show: true,
showName: x.sName,
+ sLength: x.iSLength,
+ sWidth: x.iSWidth,
+ sType: x.iSType,
+ sTypeName: Number(x.iSType) === 0 ? "矩形" : "梯形",
+ sOffset: x.sSOffset,
+ sQuantity: x.iSQuantity,
+ cLength: x.iCLength,
+ cWidth: x.iCWidth,
+ cType: x.iCType,
+ cTypeName: Number(x.iCType) === 0 ? "矩形" : "梯形",
+ cOffset: x.sCOffset,
+ cQuantity: x.iCQuantity,
})
);
diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js
index cd58671..4891d6a 100644
--- a/src/components/Common/CommonTable/index.js
+++ b/src/components/Common/CommonTable/index.js
@@ -1297,7 +1297,7 @@ class CommonTableRc extends React.Component {
item.render = (value = "", record) => {
const { formId, name, enabled } = this.props;
const { token } = this.props.app;
- const divProps = {
+ let divProps = {
action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`,
onChange: info => {
this.handleUploadChange(info, () => {});
@@ -1308,7 +1308,20 @@ class CommonTableRc extends React.Component {
showUploadList: false,
multiple: false,
};
-
+ if (config.sTbName === "sisboxcomponent") {
+ divProps = {
+ // action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}`,
+ action: `${commonConfig.server_host}file/uploadPrice?sLogoName=logo${name}${formId}${new Date().getTime()}`,
+ onChange: info => {
+ this.handleUploadChange(info, () => {});
+ const savePathStr = info?.file?.response?.dataset?.rows?.[0]?.savePathStr;
+ this.props.onDataChange(name, item.dataIndex, { [item.dataIndex]: savePathStr }, record.sId, []);
+ },
+ accept: "*/*",
+ showUploadList: false,
+ multiple: false,
+ };
+ }
return (
{value &&
@@ -1322,12 +1335,25 @@ class CommonTableRc extends React.Component {
});
},
};
-
+ const removeExtension = filename => {
+ const lastDotIndex = filename.lastIndexOf(".");
+ if (lastDotIndex === -1) {
+ // 如果字符串中没有点,则返回原字符串
+ return filename;
+ }
+ return filename.substring(0, lastDotIndex);
+ };
+ const getImageUrl = sName => {
+ const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`;
+ return imageUrlNew;
+ };
const picAddr = commonUtils.isNotEmptyObject(value) ? value.split(",") : "";
- const dataUrl = picAddr[0].includes("xlyerpfiles")
+ let dataUrl = picAddr[0].includes("xlyerpfiles")
? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}`
: picAddr[0]; /* 缩略图 */
-
+ if (config.sTbName === "sisboxcomponent") {
+ dataUrl = getImageUrl(removeExtension(picAddr[0]));
+ }
const officeFileTypeList = ["PDF", "DOCX", "XLSX", "MP4", "WEBM", "OGG"];
const imgTypeList = ["PNG", "SVG", "JPG", "JPEG", "GIF", "BMP", "TIFF", "ICO"];
const officeFileType = picAddr[0].split(".").pop().toUpperCase();
diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx
index f035e18..75951bb 100644
--- a/src/components/QuickQuote/index.jsx
+++ b/src/components/QuickQuote/index.jsx
@@ -1503,6 +1503,7 @@ const TreeComponent = props => {
masterData: { ...props.masterData, sFormId: "101251240115016076506222050" },
});
}
+ console.log(selectedNode, "selectedNode");
getDropDownData(props);
}, [selectedNode.sId, commonUtils.isEmptyObject(slaveConfig)]);
@@ -1541,7 +1542,7 @@ const ContentComponent = props => {
const { selectedNode = {}, extraParts = {} } = props.state;
const manyqtysInfo = props.getI18nName("manyqtysInfo", "多数量报价");
const selectProduct = commonFunc.showLocalMessage(props, "selectProduct", "请先选择产品");
- const { showName } = selectedNode;
+ const { showName ,sAllPartsNameDefault} = selectedNode;
const extraPartsList = extraParts[showName] || [];
let { sAllPartsName = "" } = selectedNode;
let bEmpty = false;
@@ -1551,7 +1552,52 @@ const ContentComponent = props => {
} else if (!sAllPartsName) {
sAllPartsName = showName;
}
+ // 默认选中盒型 如果配置了默认值
+ const sAllPartsNameDefaultRef = useRef(sAllPartsNameDefault);
+ useEffect(() => {
+ sAllPartsNameDefaultRef.current = sAllPartsNameDefault;
+ }, [sAllPartsNameDefault]);
+
+ useEffect(() => {
+ if (sAllPartsNameDefaultRef.current && props.state.slaveData) {
+ const boxModelList = sAllPartsName.split(",");
+ const slaveData = props.state.slaveData;
+ if (slaveData.length === boxModelList.length) {
+ const sAllPartsNameDefaultList = JSON.parse(sAllPartsNameDefaultRef.current);
+ const getSqlDropDownData = async ({ sId, sSqlCondition = {} }, cb) => {
+ const url = `${commonConfig.server_host}business/getSelectLimit/${sId}`;
+ const body = {
+ sKeyUpFilterName: "",
+ pageNum: 1,
+ pageSize: 1000,
+ sSqlCondition,
+ };
+ const retrunData = await commonServices.postValueService(props.app.token, body, url);
+ const dropDownData = retrunData.data?.dataset?.rows;
+ if (dropDownData && sAllPartsNameDefaultList.length) {
+ sAllPartsNameDefaultList.forEach((item, index) => {
+ const sPartNameList = item.sPartName?.split(",");
+ if (sPartNameList && sPartNameList.length) {
+ sPartNameList.forEach(sPartName => {
+ const box = dropDownData.find(box => box.sId === item.sBoxId); // Define 'box' here
+ const boxData = dropDownData.map((itemBox, indexBox) => ({
+ ...itemBox,
+ iOrder: indexBox + 1,
+ }));
+ if (box) {
+ // Check if 'box' exists before using it
+ props.onDataChange("slaveUp" + sPartName, "sName", { sName: box.sName }, box.sId, boxData);
+ }
+ });
+ }
+ });
+ }
+ };
+ getSqlDropDownData({ sId: "17428091410008594700322758474000", sSqlCondition: { sProductClassifyId: selectedNode.sId } });
+ }
+ }
+ }, [sAllPartsNameDefaultRef.current, props.state.slaveData]);
const boxModelList = sAllPartsName.split(",");
const [activeKey, setActiveKey] = useState(0);
@@ -2418,9 +2464,22 @@ const BoxComponent = props => {
const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片");
+ const removeExtension = filename => {
+ if (!filename) return;
+ const lastDotIndex = filename.lastIndexOf(".");
+ if (lastDotIndex === -1) {
+ // 如果字符串中没有点,则返回原字符串
+ return filename;
+ }
+ return filename.substring(0, lastDotIndex);
+ };
+ const getImageUrl = sName => {
+ const imageUrlNew = `${commonConfig.server_host}file/downloadPrice?sLogoName=${sName}&date=${new Date().getTime()}`;
+ return imageUrlNew;
+ };
let imagesData = [
- { src: slaveRowData.sPackDetailPathUpLoad, alt: "展开图" },
- { src: slaveRowData.sPackPath, alt: "立体图" },
+ { src: getImageUrl(removeExtension(slaveRowData.sPackDetailPathUpLoad)), alt: "展开图" },
+ { src: getImageUrl(removeExtension(slaveRowData.sPackPath)), alt: "立体图" },
];
if (!slaveRowData.sPackDetailPathUpLoad) {
imagesData = [{ src: slaveRowData.sPackPath, alt: "立体图" }];
@@ -3296,7 +3355,7 @@ const BoxModelSelectedModal = props => {
dSvgBoxHeight: 100,
showNew: 1,
};
-
+
return svgProps;
};
const selectBoxList = boxData.filter(item => (boxTypeSelected === "全部" ? true : (item.sBoxType || "其它") === boxTypeSelected));
@@ -3619,7 +3678,7 @@ const GetBestAlgorithm = props => {
{ name: "盒宽", value: W, type: null },
{ name: "盒高", value: D, type: null },
];
- const boxTypes = slaveRowData.sTypes;
+ const boxTypes = slaveRowData.sTypes;
const titleList1 = [
{ name: "上方盒舌", value: "dSFHS" },
{ name: "盒底组件", value: "dHDC" },
--
libgit2 0.22.2