Commit 8eb9f312e543bd5e8982babf18ae1399ac17831a

Authored by 陈鑫涛
1 parent c5278118

卡牌类型默认矩形

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,7 +93,16 @@ export const createPathElement = (x, y, width, height, id, wrapperId) => {
93 svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果 93 svg.setAttribute("stroke-dasharray", "4"); // 添加虚线效果
94 return svg; 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 export const createTrapezoid = (height, offsetX, offsetY, size) => { 108 export const createTrapezoid = (height, offsetX, offsetY, size) => {
src/components/Common/BoxDesignCompontent/svg.js
@@ -13,6 +13,7 @@ import { @@ -13,6 +13,7 @@ import {
13 createTrapezoidWeltTop, 13 createTrapezoidWeltTop,
14 createFoldWeltTop, 14 createFoldWeltTop,
15 createFoldWeltTopLine, 15 createFoldWeltTopLine,
  16 + createPathElements,
16 createRoundedCornersWeltTop, 17 createRoundedCornersWeltTop,
17 createRightAngleBoxBottomComponent, 18 createRightAngleBoxBottomComponent,
18 createBoxBottomComponent1, 19 createBoxBottomComponent1,
@@ -57,17 +58,14 @@ const SvgBox = props => { @@ -57,17 +58,14 @@ const SvgBox = props => {
57 const [deep, setDeep] = useState(0); 58 const [deep, setDeep] = useState(0);
58 const [svgType, setSvgType] = useState(1); 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 // 初始化svg 70 // 初始化svg
73 const initSVG = () => { 71 const initSVG = () => {
@@ -189,6 +187,9 @@ const SvgBox = props => { @@ -189,6 +187,9 @@ const SvgBox = props => {
189 } else if (Number(svgType) === 5) { 187 } else if (Number(svgType) === 5) {
190 viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW; 188 viewBoxWidth = (boxHeight + boxWidth) * 2 + dYTBW + dZTBW;
191 viewBoxHeight = boxLength + max; 189 viewBoxHeight = boxLength + max;
  190 + } else if (Number(svgType) === 6) {
  191 + viewBoxWidth = boxLength + 2;
  192 + viewBoxHeight = boxWidth + 2;
192 } 193 }
193 // 计算缩放比例 194 // 计算缩放比例
194 let scale = 1; 195 let scale = 1;
@@ -263,10 +264,12 @@ const SvgBox = props => { @@ -263,10 +264,12 @@ const SvgBox = props => {
263 topSize = Number(zscwValue) + boxHeight * 3; 264 topSize = Number(zscwValue) + boxHeight * 3;
264 } 265 }
265 ySvg = topSize; 266 ySvg = topSize;
  267 + } else if (Number(svgType) === 6) {
  268 + leftSize = 0;
266 } else { 269 } else {
267 leftSize = zbtb?.value; 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 svg.setAttribute("width", `${viewBoxWidth}px`); 273 svg.setAttribute("width", `${viewBoxWidth}px`);
271 svg.setAttribute("height", `${viewBoxHeight}px`); 274 svg.setAttribute("height", `${viewBoxHeight}px`);
272 svgContainerRef.current.style.width = `${viewBoxWidth}px`; 275 svgContainerRef.current.style.width = `${viewBoxWidth}px`;
@@ -276,7 +279,7 @@ const SvgBox = props => { @@ -276,7 +279,7 @@ const SvgBox = props => {
276 svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`; 279 svgContainerRef.current.style.transform = `scale(${scaleX >= 1 ? 1 : scaleX}, ${scaleY >= 1 ? 1 : scaleY})`;
277 svgContainerRef.current.style.transformOrigin = "top left"; 280 svgContainerRef.current.style.transformOrigin = "top left";
278 svgContainerRef.current.style.paddingTop = dSvgBoxWidth ? "0" : "25px"; 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 } else if (props.showNew === 2) { 283 } else if (props.showNew === 2) {
281 // g.setAttribute("transform", `rotate(${iFAngle, dSvgBoxWidth/2,dSvgBoxHeight*2})`); 284 // g.setAttribute("transform", `rotate(${iFAngle, dSvgBoxWidth/2,dSvgBoxHeight*2})`);
282 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; 285 let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale;
@@ -308,10 +311,12 @@ const SvgBox = props => { @@ -308,10 +311,12 @@ const SvgBox = props => {
308 topSize = Number(zscwValue) + boxHeight * 3; 311 topSize = Number(zscwValue) + boxHeight * 3;
309 } 312 }
310 ySvg = topSize; 313 ySvg = topSize;
  314 + } else if (Number(svgType) === 6) {
  315 + leftSize = 0;
311 } else { 316 } else {
312 leftSize = zbtb?.value; 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 svg.setAttribute("width", `${dSvgBoxWidth}px`); 320 svg.setAttribute("width", `${dSvgBoxWidth}px`);
316 svg.setAttribute("height", `${dSvgBoxHeight}px`); 321 svg.setAttribute("height", `${dSvgBoxHeight}px`);
317 svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; 322 svgContainerRef.current.style.width = `${dSvgBoxWidth}px`;
@@ -784,7 +789,7 @@ const SvgBox = props => { @@ -784,7 +789,7 @@ const SvgBox = props => {
784 } 789 }
785 // 左边部件 790 // 左边部件
786 pathList.push(createFull(zxbj?.type, scaledHeight, -scaledDeep, -dZXCW, -scaledDeep, 0)); 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 pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales)); 793 pathList.push(createHorizontalDoubleArrow(scaledDeep, -scaledDeep - scaledDeep / 2, scaledHeight * 0.8, scales));
789 pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D")); 794 pathList.push(createText(-scaledDeep - scaledDeep / 2, scaledHeight * 0.8 + 5, 10 * scales, "D"));
790 pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW)); 795 pathList.push(createText(-scaledDeep - scaledDeep - dZXCW / 2, scaledHeight * 0.5, 10 * scales, dZXCW));
@@ -925,7 +930,7 @@ const SvgBox = props => { @@ -925,7 +930,7 @@ const SvgBox = props => {
925 pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); 930 pathList.push(createText(scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
926 pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); 931 pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
927 pathList.push(createText(scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledHeight / 2), 10 * scales, "D")); 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 pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW)); 934 pathList.push(createText(scaledHeight / 2, -dZSCW / 2 + 4, 10 * scales, dZSCW));
930 } 935 }
931 // 右上部件 936 // 右上部件
@@ -949,7 +954,7 @@ const SvgBox = props => { @@ -949,7 +954,7 @@ const SvgBox = props => {
949 pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D")); 954 pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.1 + 10 * scales, -scaledDeep / 2, 10 * scales, "D"));
950 pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales)); 955 pathList.push(createDoubleArrow(scaledDeep, scaledHeight + scaledDeep + scaledHeight * 0.8, -(scaledDeep + scaledDeep / 2), scales));
951 pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.8 + 10 * scales, -(scaledDeep + scaledDeep / 2), 10 * scales, "D")); 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 pathList.push(createText(scaledHeight + scaledDeep + scaledHeight * 0.5, -dYSCW / 2 + 4, 10 * scales, dYSCW)); 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,7 +980,7 @@ const SvgBox = props => {
975 pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D")); 980 pathList.push(createText(scaledHeight * 0.1 + 10 * scales, scaledWidth + scaledDeep / 2, 10 * scales, "D"));
976 pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales)); 981 pathList.push(createDoubleArrow(scaledDeep, scaledHeight * 0.8, scaledWidth + (scaledDeep + scaledDeep / 2), scales));
977 pathList.push(createText(scaledHeight * 0.8 + 10 * scales, scaledWidth + (scaledDeep + scaledDeep / 2), 10 * scales, "D")); 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 pathList.push(createText(scaledHeight / 2, scaledWidth + dZXCW / 2 - 4, 10 * scales, dZXCW)); 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,6 +1032,12 @@ const SvgBox = props => {
1027 }); 1032 });
1028 svg.appendChild(g); 1033 svg.appendChild(g);
1029 // g.setAttribute('transform', `rotate(90, ${viewBoxWidth/2}, ${viewBoxHeight/2})`); 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,6 +1055,7 @@ const SvgBox = props => {
1044 const five = ["6005", "3005", "4005", "7005"]; 1055 const five = ["6005", "3005", "4005", "7005"];
1045 const dYSCW = Number(yscw?.value) || 0; 1056 const dYSCW = Number(yscw?.value) || 0;
1046 const dZSCW = Number(zscw?.value) || 0; 1057 const dZSCW = Number(zscw?.value) || 0;
  1058 + if (Number(svgType) === 6) return 0;
1047 // 如果存在插位就不计算盒舌 1059 // 如果存在插位就不计算盒舌
1048 if (zscw?.type && yscw?.type) { 1060 if (zscw?.type && yscw?.type) {
1049 const max = Math.max(dZSCW, dYSCW); 1061 const max = Math.max(dZSCW, dYSCW);
@@ -1075,8 +1087,10 @@ const SvgBox = props => { @@ -1075,8 +1087,10 @@ const SvgBox = props => {
1075 if ( 1087 if (
1076 five.includes(zscw?.type) || 1088 five.includes(zscw?.type) ||
1077 five.includes(yscw?.type) || 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 const coefficient = svgType === "5" ? height : width; 1095 const coefficient = svgType === "5" ? height : width;
1082 let addValue = 0; 1096 let addValue = 0;
@@ -1096,8 +1110,10 @@ const SvgBox = props => { @@ -1096,8 +1110,10 @@ const SvgBox = props => {
1096 if ( 1110 if (
1097 five.includes(zscw?.type) || 1111 five.includes(zscw?.type) ||
1098 five.includes(yscw?.type) || 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 const coefficient = svgType === "5" ? height : width; 1118 const coefficient = svgType === "5" ? height : width;
1103 let addValue = 0; 1119 let addValue = 0;
@@ -1138,6 +1154,7 @@ const SvgBox = props => { @@ -1138,6 +1154,7 @@ const SvgBox = props => {
1138 const five = ["6005", "3005", "4005", "7005"]; 1154 const five = ["6005", "3005", "4005", "7005"];
1139 const dYSCW = Number(yscw?.value) || 0; 1155 const dYSCW = Number(yscw?.value) || 0;
1140 const dZSCW = Number(zscw?.value) || 0; 1156 const dZSCW = Number(zscw?.value) || 0;
  1157 + if (Number(svgType) === 6) return 0;
1141 if (hdzj?.type) { 1158 if (hdzj?.type) {
1142 return Number(hdzj?.value); 1159 return Number(hdzj?.value);
1143 } 1160 }
@@ -1171,8 +1188,10 @@ const SvgBox = props => { @@ -1171,8 +1188,10 @@ const SvgBox = props => {
1171 if ( 1188 if (
1172 five.includes(zscw?.type) || 1189 five.includes(zscw?.type) ||
1173 five.includes(yscw?.type) || 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 const coefficient = svgType === "5" ? height : width; 1196 const coefficient = svgType === "5" ? height : width;
1178 let addValue = 0; 1197 let addValue = 0;
@@ -1192,8 +1211,10 @@ const SvgBox = props => { @@ -1192,8 +1211,10 @@ const SvgBox = props => {
1192 if ( 1211 if (
1193 five.includes(zscw?.type) || 1212 five.includes(zscw?.type) ||
1194 five.includes(yscw?.type) || 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 const coefficient = svgType === "5" ? height : width; 1219 const coefficient = svgType === "5" ? height : width;
1199 let addValue = 0; 1220 let addValue = 0;
src/components/Common/Typesetting/typesetting.js
1 /* eslint-disable */ 1 /* eslint-disable */
2 import React, { useEffect, useState, useRef } from "react"; 2 import React, { useEffect, useState, useRef } from "react";
3 -import { Modal } from "antd-v4"; 3 +import { Modal, message } from "antd-v4";
4 import { VerticalRightOutlined, VerticalLeftOutlined, LeftOutlined, RightOutlined, UpOutlined, DownOutlined } from "@ant-design/icons"; 4 import { VerticalRightOutlined, VerticalLeftOutlined, LeftOutlined, RightOutlined, UpOutlined, DownOutlined } from "@ant-design/icons";
5 import * as commonUtils from "@/utils/utils"; /* 通用方法 */ 5 import * as commonUtils from "@/utils/utils"; /* 通用方法 */
6 import commonConfig from "@/utils/config"; 6 import commonConfig from "@/utils/config";
@@ -606,7 +606,9 @@ const Typesetting = props => { @@ -606,7 +606,9 @@ const Typesetting = props => {
606 Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth); 606 Number(slaveDataDetail?.dMaxWidth) >= Number(slaveRowData?.dMachineWidth);
607 607
608 const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length; 608 const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length;
609 - 609 + if (isCustomized && !isShow) {
  610 + message.error("排版尺寸大于上机尺寸,请确认参数!");
  611 + }
610 const onClick = () => { 612 const onClick = () => {
611 if (isMobile) return; 613 if (isMobile) return;
612 setIsModalOpen(true); 614 setIsModalOpen(true);