Commit 8eb9f312e543bd5e8982babf18ae1399ac17831a
1 parent
c5278118
卡牌类型默认矩形
Showing
6 changed files
with
132 additions
and
145334 deletions
Too many changes to show.
To preserve performance only 3 of 6 files are displayed.
src/components/Common/BoxDesign/createAirplaneBox.js
| ... | ... | @@ -93,7 +93,16 @@ export const createPathElement = (x, y, width, height, id, wrapperId) => { |
| 93 | 93 | svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 |
| 94 | 94 | return svg; |
| 95 | 95 | }; |
| 96 | - | |
| 96 | +export const createPathElements = (x, y, width, height, id, wrapperId) => { | |
| 97 | + const d = `M ${x} ${y} L ${x} ${y + height} L ${x + width} ${y + height} L ${x + width} ${y} L ${x} ${y} Z`; | |
| 98 | + const svg = document.createElementNS("http://www.w3.org/2000/svg", "path"); | |
| 99 | + svg.setAttribute("d", d); | |
| 100 | + svg.setAttribute("fill", "transparent"); | |
| 101 | + svg.setAttribute("stroke", "#7588B9"); | |
| 102 | + svg.setAttribute("stroke-width", "1"); | |
| 103 | + // svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 | |
| 104 | + return svg; | |
| 105 | +}; | |
| 97 | 106 | // |
| 98 | 107 | // 左边斜线贴边 |
| 99 | 108 | export const createTrapezoid = (height, offsetX, offsetY, size) => { | ... | ... |
src/components/Common/BoxDesignCompontent/svg.js
| ... | ... | @@ -13,6 +13,7 @@ import { |
| 13 | 13 | createTrapezoidWeltTop, |
| 14 | 14 | createFoldWeltTop, |
| 15 | 15 | createFoldWeltTopLine, |
| 16 | + createPathElements, | |
| 16 | 17 | createRoundedCornersWeltTop, |
| 17 | 18 | createRightAngleBoxBottomComponent, |
| 18 | 19 | createBoxBottomComponent1, |
| ... | ... | @@ -57,17 +58,14 @@ const SvgBox = props => { |
| 57 | 58 | const [deep, setDeep] = useState(0); |
| 58 | 59 | const [svgType, setSvgType] = useState(1); |
| 59 | 60 | // 盒身 |
| 60 | - useEffect( | |
| 61 | - () => { | |
| 62 | - setTimeout(() => { | |
| 63 | - const svg = svgRef.current; | |
| 64 | - if (svg) { | |
| 65 | - initSVG(); | |
| 66 | - } | |
| 67 | - }, 0); | |
| 68 | - }, | |
| 69 | - [boxList, svgType] | |
| 70 | - ); | |
| 61 | + useEffect(() => { | |
| 62 | + setTimeout(() => { | |
| 63 | + const svg = svgRef.current; | |
| 64 | + if (svg) { | |
| 65 | + initSVG(); | |
| 66 | + } | |
| 67 | + }, 0); | |
| 68 | + }, [boxList, svgType]); | |
| 71 | 69 | |
| 72 | 70 | // 初始化svg |
| 73 | 71 | const initSVG = () => { |
| ... | ... | @@ -189,6 +187,9 @@ const SvgBox = props => { |
| 189 | 187 | } else if (Number(svgType) === 5) { |
| 190 | 188 | viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW; |
| 191 | 189 | viewBoxHeight = boxLength + max; |
| 190 | + } else if (Number(svgType) === 6) { | |
| 191 | + viewBoxWidth = boxLength + 2; | |
| 192 | + viewBoxHeight = boxWidth + 2; | |
| 192 | 193 | } |
| 193 | 194 | // 计算缩放比例 |
| 194 | 195 | let scale = 1; |
| ... | ... | @@ -263,10 +264,12 @@ const SvgBox = props => { |
| 263 | 264 | topSize = Number(zscwValue) + boxHeight * 3; |
| 264 | 265 | } |
| 265 | 266 | ySvg = topSize; |
| 267 | + } else if (Number(svgType) === 6) { | |
| 268 | + leftSize = 0; | |
| 266 | 269 | } else { |
| 267 | 270 | leftSize = zbtb?.value; |
| 268 | 271 | } |
| 269 | - svg.setAttribute("viewBox", `${-(leftSize * scale)||0} ${-ySvg} ${viewBoxWidth} ${viewBoxHeight}`); | |
| 272 | + svg.setAttribute("viewBox", `${-(leftSize * scale) || 0} ${-ySvg} ${viewBoxWidth} ${viewBoxHeight}`); | |
| 270 | 273 | svg.setAttribute("width", `${viewBoxWidth}px`); |
| 271 | 274 | svg.setAttribute("height", `${viewBoxHeight}px`); |
| 272 | 275 | svgContainerRef.current.style.width = `${viewBoxWidth}px`; |
| ... | ... | @@ -276,7 +279,7 @@ const SvgBox = props => { |
| 276 | 279 | svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`; |
| 277 | 280 | svgContainerRef.current.style.transformOrigin = "top left"; |
| 278 | 281 | svgContainerRef.current.style.paddingTop = dSvgBoxWidth ? "0" : "25px"; |
| 279 | - svgContainerRef.current.style.backgroundColor = props.isMobile ? '#EDF4FF' : '' | |
| 282 | + svgContainerRef.current.style.backgroundColor = props.isMobile ? "#EDF4FF" : ""; | |
| 280 | 283 | } else if (props.showNew === 2) { |
| 281 | 284 | // g.setAttribute("transform", `rotate(${iFAngle, dSvgBoxWidth/2,dSvgBoxHeight*2})`); |
| 282 | 285 | let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; |
| ... | ... | @@ -308,10 +311,12 @@ const SvgBox = props => { |
| 308 | 311 | topSize = Number(zscwValue) + boxHeight * 3; |
| 309 | 312 | } |
| 310 | 313 | ySvg = topSize; |
| 314 | + } else if (Number(svgType) === 6) { | |
| 315 | + leftSize = 0; | |
| 311 | 316 | } else { |
| 312 | 317 | leftSize = zbtb?.value; |
| 313 | 318 | } |
| 314 | - svg.setAttribute("viewBox", `${-(((leftSize * scale) || 0))} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); | |
| 319 | + svg.setAttribute("viewBox", `${-(leftSize * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); | |
| 315 | 320 | svg.setAttribute("width", `${dSvgBoxWidth}px`); |
| 316 | 321 | svg.setAttribute("height", `${dSvgBoxHeight}px`); |
| 317 | 322 | svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; |
| ... | ... | @@ -784,7 +789,7 @@ const SvgBox = props => { |
| 784 | 789 | } |
| 785 | 790 | // 左边部件 |
| 786 | 791 | pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); |
| 787 | - if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW)|| (zxbj?.type === "4007" && dZXCW)) { | |
| 792 | + if ((zxbj?.type === "4001" && dZXCW) || (zxbj?.type === "4006" && dZXCW) || (zxbj?.type === "4007" && dZXCW)) { | |
| 788 | 793 | pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); |
| 789 | 794 | pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); |
| 790 | 795 | pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); |
| ... | ... | @@ -925,7 +930,7 @@ const SvgBox = props => { |
| 925 | 930 | pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); |
| 926 | 931 | pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); |
| 927 | 932 | pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); |
| 928 | - }else if (zsbj?.type && dZSCW) { | |
| 933 | + } else if (zsbj?.type && dZSCW) { | |
| 929 | 934 | pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); |
| 930 | 935 | } |
| 931 | 936 | // 右上部件 |
| ... | ... | @@ -949,7 +954,7 @@ const SvgBox = props => { |
| 949 | 954 | pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); |
| 950 | 955 | pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); |
| 951 | 956 | pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); |
| 952 | - }else if (ysbj?.type && dYSCW) { | |
| 957 | + } else if (ysbj?.type && dYSCW) { | |
| 953 | 958 | pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); |
| 954 | 959 | } |
| 955 | 960 | // 左下部件- |
| ... | ... | @@ -975,7 +980,7 @@ const SvgBox = props => { |
| 975 | 980 | pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); |
| 976 | 981 | pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); |
| 977 | 982 | pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); |
| 978 | - }else if (zxbj?.type && dZXCW) { | |
| 983 | + } else if (zxbj?.type && dZXCW) { | |
| 979 | 984 | pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); |
| 980 | 985 | } |
| 981 | 986 | } |
| ... | ... | @@ -1027,6 +1032,12 @@ const SvgBox = props => { |
| 1027 | 1032 | }); |
| 1028 | 1033 | svg.appendChild(g); |
| 1029 | 1034 | // g.setAttribute('transform', `rotate(90, ${viewBoxWidth/2}, ${viewBoxHeight/2})`); |
| 1035 | + } else if (Number(svgType) === 6) { | |
| 1036 | + const rectangles = [{ x: 0, y: 0, width: scaledWidth, height: scaledHeight }]; | |
| 1037 | + rectangles.forEach(rect => { | |
| 1038 | + g.appendChild(createPathElements(rect.x, rect.y, rect.width, rect.height)); | |
| 1039 | + }); | |
| 1040 | + svg.appendChild(g); | |
| 1030 | 1041 | } |
| 1031 | 1042 | }; |
| 1032 | 1043 | // 计算头部偏移 |
| ... | ... | @@ -1044,6 +1055,7 @@ const SvgBox = props => { |
| 1044 | 1055 | const five = ["6005", "3005", "4005", "7005"]; |
| 1045 | 1056 | const dYSCW = Number(yscw?.value) || 0; |
| 1046 | 1057 | const dZSCW = Number(zscw?.value) || 0; |
| 1058 | + if (Number(svgType) === 6) return 0; | |
| 1047 | 1059 | // 如果存在插位就不计算盒舌 |
| 1048 | 1060 | if (zscw?.type && yscw?.type) { |
| 1049 | 1061 | const max = Math.max(dZSCW, dYSCW); |
| ... | ... | @@ -1075,8 +1087,10 @@ const SvgBox = props => { |
| 1075 | 1087 | if ( |
| 1076 | 1088 | five.includes(zscw?.type) || |
| 1077 | 1089 | five.includes(yscw?.type) || |
| 1078 | - (four.includes(zscw?.type) || four.includes(yscw?.type)) || | |
| 1079 | - (one.includes(zscw?.type) || one.includes(yscw?.type)) | |
| 1090 | + four.includes(zscw?.type) || | |
| 1091 | + four.includes(yscw?.type) || | |
| 1092 | + one.includes(zscw?.type) || | |
| 1093 | + one.includes(yscw?.type) | |
| 1080 | 1094 | ) { |
| 1081 | 1095 | const coefficient = svgType === "5" ? height : width; |
| 1082 | 1096 | let addValue = 0; |
| ... | ... | @@ -1096,8 +1110,10 @@ const SvgBox = props => { |
| 1096 | 1110 | if ( |
| 1097 | 1111 | five.includes(zscw?.type) || |
| 1098 | 1112 | five.includes(yscw?.type) || |
| 1099 | - (four.includes(zscw?.type) || four.includes(yscw?.type)) || | |
| 1100 | - (one.includes(zscw?.type) || one.includes(yscw?.type)) | |
| 1113 | + four.includes(zscw?.type) || | |
| 1114 | + four.includes(yscw?.type) || | |
| 1115 | + one.includes(zscw?.type) || | |
| 1116 | + one.includes(yscw?.type) | |
| 1101 | 1117 | ) { |
| 1102 | 1118 | const coefficient = svgType === "5" ? height : width; |
| 1103 | 1119 | let addValue = 0; |
| ... | ... | @@ -1138,6 +1154,7 @@ const SvgBox = props => { |
| 1138 | 1154 | const five = ["6005", "3005", "4005", "7005"]; |
| 1139 | 1155 | const dYSCW = Number(yscw?.value) || 0; |
| 1140 | 1156 | const dZSCW = Number(zscw?.value) || 0; |
| 1157 | + if (Number(svgType) === 6) return 0; | |
| 1141 | 1158 | if (hdzj?.type) { |
| 1142 | 1159 | return Number(hdzj?.value); |
| 1143 | 1160 | } |
| ... | ... | @@ -1171,8 +1188,10 @@ const SvgBox = props => { |
| 1171 | 1188 | if ( |
| 1172 | 1189 | five.includes(zscw?.type) || |
| 1173 | 1190 | five.includes(yscw?.type) || |
| 1174 | - (four.includes(zscw?.type) || four.includes(yscw?.type)) || | |
| 1175 | - (one.includes(zscw?.type) || one.includes(yscw?.type)) | |
| 1191 | + four.includes(zscw?.type) || | |
| 1192 | + four.includes(yscw?.type) || | |
| 1193 | + one.includes(zscw?.type) || | |
| 1194 | + one.includes(yscw?.type) | |
| 1176 | 1195 | ) { |
| 1177 | 1196 | const coefficient = svgType === "5" ? height : width; |
| 1178 | 1197 | let addValue = 0; |
| ... | ... | @@ -1192,8 +1211,10 @@ const SvgBox = props => { |
| 1192 | 1211 | if ( |
| 1193 | 1212 | five.includes(zscw?.type) || |
| 1194 | 1213 | five.includes(yscw?.type) || |
| 1195 | - (four.includes(zscw?.type) || four.includes(yscw?.type)) || | |
| 1196 | - (one.includes(zscw?.type) || one.includes(yscw?.type)) | |
| 1214 | + four.includes(zscw?.type) || | |
| 1215 | + four.includes(yscw?.type) || | |
| 1216 | + one.includes(zscw?.type) || | |
| 1217 | + one.includes(yscw?.type) | |
| 1197 | 1218 | ) { |
| 1198 | 1219 | const coefficient = svgType === "5" ? height : width; |
| 1199 | 1220 | let addValue = 0; | ... | ... |
src/components/Common/Typesetting/typesetting.js
| 1 | 1 | /* eslint-disable */ |
| 2 | 2 | import React, { useEffect, useState, useRef } from "react"; |
| 3 | -import { Modal } from "antd-v4"; | |
| 3 | +import { Modal, message } from "antd-v4"; | |
| 4 | 4 | import { VerticalRightOutlined, VerticalLeftOutlined, LeftOutlined, RightOutlined, UpOutlined, DownOutlined } from "@ant-design/icons"; |
| 5 | 5 | import * as commonUtils from "@/utils/utils"; /* 通用方法 */ |
| 6 | 6 | import commonConfig from "@/utils/config"; |
| ... | ... | @@ -606,7 +606,9 @@ const Typesetting = props => { |
| 606 | 606 | Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth); |
| 607 | 607 | |
| 608 | 608 | const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length; |
| 609 | - | |
| 609 | + if (isCustomized && !isShow) { | |
| 610 | + message.error("排版尺寸大于上机尺寸,请确认参数!"); | |
| 611 | + } | |
| 610 | 612 | const onClick = () => { |
| 611 | 613 | if (isMobile) return; |
| 612 | 614 | setIsModalOpen(true); | ... | ... |