Commit 8d2d3302bf2f08960b81b5c2b8aca045b4112510
1 parent
4b8b038e
矩形
Showing
5 changed files
with
143 additions
and
57 deletions
src/components/Common/BoxDesign/createAirplaneBox.js
| @@ -201,7 +201,7 @@ export const createText = (offsetX, offsetY, size, textContent) => { | @@ -201,7 +201,7 @@ export const createText = (offsetX, offsetY, size, textContent) => { | ||
| 201 | text.setAttribute("dominant-baseline", "middle"); // 文字垂直居中 | 201 | text.setAttribute("dominant-baseline", "middle"); // 文字垂直居中 |
| 202 | text.setAttribute("fill", "#333"); // 文字颜色 | 202 | text.setAttribute("fill", "#333"); // 文字颜色 |
| 203 | text.setAttribute("font-size", size); // 文字大小 | 203 | text.setAttribute("font-size", size); // 文字大小 |
| 204 | - text.textContent = textContent || "Text"; // 默认文字内容 | 204 | + text.textContent = textContent || ""; // 默认文字内容 |
| 205 | return text; | 205 | return text; |
| 206 | }; | 206 | }; |
| 207 | // 竖向双箭头 | 207 | // 竖向双箭头 |
src/components/Common/BoxDesignCompontent/index.js
| @@ -261,7 +261,7 @@ const BoxDesignCompontent = baseProps => { | @@ -261,7 +261,7 @@ const BoxDesignCompontent = baseProps => { | ||
| 261 | box.forEach(x => { | 261 | box.forEach(x => { |
| 262 | x.show = true; | 262 | x.show = true; |
| 263 | }); | 263 | }); |
| 264 | - const title = ["盒底组件", "左(下)插位组件", "右(上)插位组件","上方盒舌","下方盒舌"]; | 264 | + const title = ["盒底组件", "左贴边位", "右贴边位","上方盒舌","下方盒舌"]; |
| 265 | box.forEach(x => title.includes(x.sName) && (x.show = false)); | 265 | box.forEach(x => title.includes(x.sName) && (x.show = false)); |
| 266 | setTopBoxList(box.filter(topBoxFilter)); | 266 | setTopBoxList(box.filter(topBoxFilter)); |
| 267 | setLeftBoxList(box.filter(leftBoxFilter)); | 267 | setLeftBoxList(box.filter(leftBoxFilter)); |
src/components/Common/BoxDesignCompontent/svg.js
| @@ -50,6 +50,7 @@ import { | @@ -50,6 +50,7 @@ import { | ||
| 50 | createBoxComponentNewFul5, | 50 | createBoxComponentNewFul5, |
| 51 | createBoxComponentNewFul6, | 51 | createBoxComponentNewFul6, |
| 52 | } from "../BoxDesign/createAirplaneBox"; | 52 | } from "../BoxDesign/createAirplaneBox"; |
| 53 | +import { log } from "lodash-decorators/utils"; | ||
| 53 | const SvgBox = props => { | 54 | const SvgBox = props => { |
| 54 | const svgContainerRef = useRef(null); | 55 | const svgContainerRef = useRef(null); |
| 55 | const svgRef = useRef(null); | 56 | const svgRef = useRef(null); |
| @@ -84,7 +85,7 @@ const SvgBox = props => { | @@ -84,7 +85,7 @@ const SvgBox = props => { | ||
| 84 | // 获取盒长、盒宽、盒高 | 85 | // 获取盒长、盒宽、盒高 |
| 85 | const boxLength = Number(boxList.find(x => x.sName === "盒长")?.value) || 0; | 86 | const boxLength = Number(boxList.find(x => x.sName === "盒长")?.value) || 0; |
| 86 | const boxWidth = Number(boxList.find(x => x.sName === "盒宽")?.value) || 0; | 87 | const boxWidth = Number(boxList.find(x => x.sName === "盒宽")?.value) || 0; |
| 87 | - const boxHeight = Number(boxList.find(x => x.sName === "盒高")?.value) || 0; | 88 | + let boxHeight = Number(boxList.find(x => x.sName === "盒高")?.value) || 0; |
| 88 | 89 | ||
| 89 | setWidth(boxLength); | 90 | setWidth(boxLength); |
| 90 | setHeight(boxWidth); | 91 | setHeight(boxWidth); |
| @@ -193,9 +194,66 @@ const SvgBox = props => { | @@ -193,9 +194,66 @@ const SvgBox = props => { | ||
| 193 | } else if (Number(svgType) === 6) { | 194 | } else if (Number(svgType) === 6) { |
| 194 | viewBoxWidth = boxWidth + 2; | 195 | viewBoxWidth = boxWidth + 2; |
| 195 | viewBoxHeight = boxLength + 2; | 196 | viewBoxHeight = boxLength + 2; |
| 197 | + | ||
| 196 | } else if (Number(svgType) === 7) { | 198 | } else if (Number(svgType) === 7) { |
| 197 | - viewBoxWidth = boxWidth + dZTBW + dYTBW; | ||
| 198 | - viewBoxHeight = boxLength + dZSCW + dYXCW; | 199 | + boxHeight = boxWidth |
| 200 | + const zxcw = boxList.find(x => x.sName === "左(下)插位组件"); | ||
| 201 | + const zscw = boxList.find(x => x.sName === "左(上)插位组件"); | ||
| 202 | + const yscw = boxList.find(x => x.sName === "右(上)插位组件"); | ||
| 203 | + const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); | ||
| 204 | + const zxcwType = zxcw?.type; | ||
| 205 | + const zxcwValue = zxcw?.value; | ||
| 206 | + const zscwType = zscw?.type; | ||
| 207 | + const zscwValue = zscw?.value; | ||
| 208 | + const yscwType = yscw?.type; | ||
| 209 | + const yscwValue = yscw?.value; | ||
| 210 | + const yxcwType = yxcw?.type; | ||
| 211 | + const yxcwValue = yxcw?.value; | ||
| 212 | + let leftValue = 0; | ||
| 213 | + let rightValue = 0; | ||
| 214 | + let topValue = 0; | ||
| 215 | + let bottomValue = 0; | ||
| 216 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | ||
| 217 | + leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; | ||
| 218 | + } else if (zxcwType === "4002" || zxcwType === "4003") { | ||
| 219 | + leftValue = leftValue + Number(zxcwValue) + boxHeight; | ||
| 220 | + } else if (zxcwType === "4004") { | ||
| 221 | + leftValue = leftValue + Number(zxcwValue) + boxHeight * 3; | ||
| 222 | + } else if (zxcwType === "4005") { | ||
| 223 | + leftValue = boxHeight * 3; | ||
| 224 | + } | ||
| 225 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | ||
| 226 | + rightValue = rightValue + Number(yscwValue) + boxHeight * 2; | ||
| 227 | + } else if (yscwType === "6002" || yscwType === "6003") { | ||
| 228 | + rightValue = rightValue + Number(yscwValue) + boxHeight; | ||
| 229 | + } else if (yscwType === "6004") { | ||
| 230 | + rightValue = rightValue + Number(yscwValue) + boxHeight * 3; | ||
| 231 | + } else if (yscwType === "6005") { | ||
| 232 | + rightValue = boxHeight * 3; | ||
| 233 | + } | ||
| 234 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | ||
| 235 | + topValue = topValue + Number(zscwValue) + boxHeight * 2; | ||
| 236 | + } else if (zscwType === "3002" || zscwType === "3003") { | ||
| 237 | + topValue = topValue + Number(zscwValue) + boxHeight; | ||
| 238 | + } else if (zscwType === "3004") { | ||
| 239 | + topValue = topValue + Number(zscwValue) + boxHeight * 3; | ||
| 240 | + } else if (zscwType === "3005") { | ||
| 241 | + topValue = boxHeight * 3; | ||
| 242 | + } | ||
| 243 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | ||
| 244 | + bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 2; | ||
| 245 | + } else if (yxcwType === "7002" || yxcwType === "7003") { | ||
| 246 | + bottomValue = bottomValue + Number(yxcwValue) + boxHeight; | ||
| 247 | + } else if (yxcwType === "7004") { | ||
| 248 | + bottomValue = bottomValue + Number(yxcwValue) + boxHeight * 3; | ||
| 249 | + } else if (yxcwType === "7005") { | ||
| 250 | + bottomValue = boxHeight * 3; | ||
| 251 | + } | ||
| 252 | + viewBoxWidth = Number(boxLength) + leftValue + rightValue; | ||
| 253 | + console.log("🚀 ~ initSVG ~ leftValue:", leftValue,rightValue) | ||
| 254 | + viewBoxHeight = Number(boxWidth) + topValue + bottomValue; | ||
| 255 | + // viewBoxWidth = boxWidth + leftValue + rightValue; | ||
| 256 | + // viewBoxHeight = boxLength + dZSCW + dYXCW; | ||
| 199 | } | 257 | } |
| 200 | // 计算缩放比例 | 258 | // 计算缩放比例 |
| 201 | let scale = 1; | 259 | let scale = 1; |
| @@ -212,9 +270,15 @@ const SvgBox = props => { | @@ -212,9 +270,15 @@ const SvgBox = props => { | ||
| 212 | ySvg = ySvg + boxHeight * scale; | 270 | ySvg = ySvg + boxHeight * scale; |
| 213 | } | 271 | } |
| 214 | ySvg = ySvg + 50 * scale; | 272 | ySvg = ySvg + 50 * scale; |
| 273 | + let xSvg = 0; | ||
| 274 | + if (Number(svgType === 7)) { | ||
| 275 | + xSvg = scaledWidth + dZXCW * scale; | ||
| 276 | + } else { | ||
| 277 | + xSvg = zbtb?.value; | ||
| 278 | + } | ||
| 215 | svg.setAttribute( | 279 | svg.setAttribute( |
| 216 | "viewBox", | 280 | "viewBox", |
| 217 | - `${-(zbtb?.value * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${ | 281 | + `${-(xSvg * scale)} ${dSvgBoxWidth ? (dSvgBoxWidth === 100 ? -ySvg : 0) : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth + ySvg : 500} ${ |
| 218 | dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg | 282 | dSvgBoxHeight ? dSvgBoxHeight - ySvg - bottom * scale : 250 + ySvg |
| 219 | }` | 283 | }` |
| 220 | ); | 284 | ); |
| @@ -227,13 +291,19 @@ const SvgBox = props => { | @@ -227,13 +291,19 @@ const SvgBox = props => { | ||
| 227 | let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; | 291 | let ySvg = topOffect(boxList, boxLength, boxWidth, boxHeight) * scale; |
| 228 | if (Number(svgType) === 4) { | 292 | if (Number(svgType) === 4) { |
| 229 | ySvg = ySvg + boxHeight; | 293 | ySvg = ySvg + boxHeight; |
| 230 | - } else if (Number(svgType) === 7) { | ||
| 231 | - ySvg = ySvg + boxWidth / 2 + dZSCW; | ||
| 232 | } | 294 | } |
| 233 | ySvg = ySvg + 50 * scale; | 295 | ySvg = ySvg + 50 * scale; |
| 296 | + let xSvg = 0; | ||
| 297 | + if (Number(svgType === 7)) { | ||
| 298 | + xSvg = scaledWidth + dZXCW * scale; | ||
| 299 | + } else { | ||
| 300 | + xSvg = zbtb?.value; | ||
| 301 | + } | ||
| 302 | + console.log(xSvg,viewBoxWidth / 2,viewBoxWidth,'viewBoxWidth / 2'); | ||
| 303 | + | ||
| 234 | svg.setAttribute( | 304 | svg.setAttribute( |
| 235 | "viewBox", | 305 | "viewBox", |
| 236 | - `${-(dSvgBoxWidth ? zbtb?.value : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ | 306 | + `${-(dSvgBoxWidth ? xSvg : viewBoxWidth / 2)} ${dSvgBoxWidth ? -0 : -ySvg} ${dSvgBoxWidth ? dSvgBoxWidth : 500} ${ |
| 237 | dSvgBoxHeight ? dSvgBoxHeight : 250 | 307 | dSvgBoxHeight ? dSvgBoxHeight : 250 |
| 238 | }` | 308 | }` |
| 239 | ); | 309 | ); |
| @@ -328,7 +398,7 @@ const SvgBox = props => { | @@ -328,7 +398,7 @@ const SvgBox = props => { | ||
| 328 | } else { | 398 | } else { |
| 329 | leftSize = zbtb?.value; | 399 | leftSize = zbtb?.value; |
| 330 | } | 400 | } |
| 331 | - svg.setAttribute("viewBox", `${-((leftSize) * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); | 401 | + svg.setAttribute("viewBox", `${-(leftSize * scale || 0)} ${-ySvg} ${dSvgBoxWidth} ${dSvgBoxHeight}`); |
| 332 | svg.setAttribute("width", `${dSvgBoxWidth}px`); | 402 | svg.setAttribute("width", `${dSvgBoxWidth}px`); |
| 333 | svg.setAttribute("height", `${dSvgBoxHeight}px`); | 403 | svg.setAttribute("height", `${dSvgBoxHeight}px`); |
| 334 | svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; | 404 | svgContainerRef.current.style.width = `${dSvgBoxWidth}px`; |
| @@ -1058,7 +1128,7 @@ const SvgBox = props => { | @@ -1058,7 +1128,7 @@ const SvgBox = props => { | ||
| 1058 | }); | 1128 | }); |
| 1059 | // svg.appendChild(g); | 1129 | // svg.appendChild(g); |
| 1060 | let pathList = []; | 1130 | let pathList = []; |
| 1061 | - // 左上部件 | 1131 | + // 左上部件 |
| 1062 | pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); | 1132 | pathList.push(createDynamicTopLeft(zsbj?.type, scaledWidth, -scaledHeight, -dZSCW * scale, 0, 0)); |
| 1063 | if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { | 1133 | if ((zsbj?.type === "3001" && zsbj?.value) || (zsbj?.type === "3006" && zsbj?.value) || (zsbj?.type === "3007" && zsbj?.value)) { |
| 1064 | pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); | 1134 | pathList.push(createDoubleArrow(scaledHeight, scaledWidth * 0.2, -scaledHeight / 2, scales)); |
| @@ -1079,34 +1149,38 @@ const SvgBox = props => { | @@ -1079,34 +1149,38 @@ const SvgBox = props => { | ||
| 1079 | } else if (zsbj?.type && dZSCW) { | 1149 | } else if (zsbj?.type && dZSCW) { |
| 1080 | pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); | 1150 | pathList.push(createText(scaledWidth / 2, -(dZSCW / 2 - 5), 10 * scales, dZSCW)); |
| 1081 | } | 1151 | } |
| 1082 | - // 右下部件 | ||
| 1083 | - pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW, 0, scaledDeep)); | ||
| 1084 | - if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | ||
| 1085 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | ||
| 1086 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1087 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1088 | - } else if (yxbj?.type === "7004" && yxbj?.value) { | ||
| 1089 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | ||
| 1090 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1091 | - pathList.push( | ||
| 1092 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | ||
| 1093 | - ); | ||
| 1094 | - pathList.push( | ||
| 1095 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") | ||
| 1096 | - ); | ||
| 1097 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1098 | - } else if (yxbj?.type === "7005" && yxbj?.value) { | ||
| 1099 | - pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | ||
| 1100 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1101 | - pathList.push( | ||
| 1102 | - createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | ||
| 1103 | - ); | ||
| 1104 | - pathList.push( | ||
| 1105 | - createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W") | ||
| 1106 | - ); | ||
| 1107 | - } else if (dYXCW && yxbj?.type) { | ||
| 1108 | - pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1109 | - } | 1152 | + // 右下部件 |
| 1153 | + pathList.push(createDynamicTopLeft(yxbj?.type, scaledWidth, scaledHeight, dYXCW * scale, 0, scaledHeight)); | ||
| 1154 | + // if ((yxbj?.type === "7001" && yxbj?.value) || (yxbj?.type === "7006" && yxbj?.value) || (yxbj?.type === "7007" && yxbj?.value)) { | ||
| 1155 | + // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | ||
| 1156 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1157 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + scaledHeight + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1158 | + // } else if (yxbj?.type === "7004" && yxbj?.value) { | ||
| 1159 | + // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.2, scaledDeep + scaledHeight / 2, scales)); | ||
| 1160 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.2 - 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1161 | + // pathList.push( | ||
| 1162 | + // createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.85, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | ||
| 1163 | + // ); | ||
| 1164 | + // pathList.push( | ||
| 1165 | + // createText(scaledWidth + scaledHeight + scaledWidth * 0.85 + 10 * scales, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scales, "W") | ||
| 1166 | + // ); | ||
| 1167 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.3, scaledDeep + scaledHeight * 2 + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1168 | + // } else if (yxbj?.type === "7005" && yxbj?.value) { | ||
| 1169 | + // pathList.push(createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.1, scaledDeep + scaledHeight / 2, scales)); | ||
| 1170 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.1 + 10 * scales, scaledDeep + scaledHeight / 2, 10 * scales, "W")); | ||
| 1171 | + // pathList.push( | ||
| 1172 | + // createDoubleArrow(scaledHeight, scaledWidth + scaledHeight + scaledWidth * 0.8, scaledDeep + (scaledHeight + scaledHeight / 2), scales) | ||
| 1173 | + // ); | ||
| 1174 | + // pathList.push( | ||
| 1175 | + // createText(scaledWidth + scaledHeight + scaledWidth * 0.8 + 10 * scale, scaledDeep + (scaledHeight + scaledHeight / 2), 10 * scale, "W") | ||
| 1176 | + // ); | ||
| 1177 | + // } else if (dYXCW && yxbj?.type) { | ||
| 1178 | + // pathList.push(createText(scaledWidth + scaledHeight + scaledWidth * 0.5, scaledDeep + dYXCW / 2 - 4, 10 * scales, dYXCW)); | ||
| 1179 | + // } | ||
| 1180 | + // 右边 | ||
| 1181 | + pathList.push(createFull(ysbj?.type, scaledWidth, scaledHeight, dYSCW * scale, scaledWidth, 0)); | ||
| 1182 | + pathList.push(createFull(zxbj?.type, scaledWidth, -scaledHeight, -dZXCW * scale, 0, 0)); | ||
| 1183 | + | ||
| 1110 | pathList.forEach(x => { | 1184 | pathList.forEach(x => { |
| 1111 | g.appendChild(x); | 1185 | g.appendChild(x); |
| 1112 | }); | 1186 | }); |
| @@ -1281,7 +1355,7 @@ const SvgBox = props => { | @@ -1281,7 +1355,7 @@ const SvgBox = props => { | ||
| 1281 | } | 1355 | } |
| 1282 | top = addValue > sfhs?.value ? addValue : sfhs?.value; | 1356 | top = addValue > sfhs?.value ? addValue : sfhs?.value; |
| 1283 | } else { | 1357 | } else { |
| 1284 | - top = addValue?addValue:0 > sfhs?.value ? max : sfhs?.value; | 1358 | + top = sfhs?.value ? max : sfhs?.value; |
| 1285 | } | 1359 | } |
| 1286 | } else if (zscw?.type) { | 1360 | } else if (zscw?.type) { |
| 1287 | const max = dZSCW; | 1361 | const max = dZSCW; |
src/components/Common/Typesetting/typesetting.js
| @@ -37,7 +37,10 @@ const Typesetting = props => { | @@ -37,7 +37,10 @@ const Typesetting = props => { | ||
| 37 | sColumnNameConfig, | 37 | sColumnNameConfig, |
| 38 | bAdvancedSetting, // 高级设置 | 38 | bAdvancedSetting, // 高级设置 |
| 39 | sSvgPath, | 39 | sSvgPath, |
| 40 | + dL = 0, | ||
| 41 | + dW = 0 | ||
| 40 | } = slaveRowData; | 42 | } = slaveRowData; |
| 43 | + console.log("🚀 ~ slaveRowData:", slaveRowData) | ||
| 41 | 44 | ||
| 42 | const { masterData, selectedNode, slaveData } = state; | 45 | const { masterData, selectedNode, slaveData } = state; |
| 43 | if (!masterData) return; | 46 | if (!masterData) return; |
| @@ -89,9 +92,9 @@ const Typesetting = props => { | @@ -89,9 +92,9 @@ const Typesetting = props => { | ||
| 89 | // dHorizontal = 1; | 92 | // dHorizontal = 1; |
| 90 | // 如果需要自定义排版数 | 93 | // 如果需要自定义排版数 |
| 91 | // 确认是竖向排列还是横向排列 | 94 | // 确认是竖向排列还是横向排列 |
| 92 | - | ||
| 93 | - const L = Number(masterData?.dLength) || 0; | ||
| 94 | - const W = masterData?.dWidth || 0; | 95 | + const isKapai = slaveRowData.sName === '卡牌' |
| 96 | + const L = isKapai? Number(dL) : Number(masterData?.dLength) || 0; | ||
| 97 | + const W = isKapai? Number(dW) : masterData?.dWidth || 0; | ||
| 95 | const H = masterData?.dWidth || 0; | 98 | const H = masterData?.dWidth || 0; |
| 96 | const D = masterData?.dHeight || 0; | 99 | const D = masterData?.dHeight || 0; |
| 97 | // 动态计算公式值 | 100 | // 动态计算公式值 |
src/components/QuickQuote/index.jsx
| @@ -1613,15 +1613,14 @@ const BoxComponent = props => { | @@ -1613,15 +1613,14 @@ const BoxComponent = props => { | ||
| 1613 | ) { | 1613 | ) { |
| 1614 | return false; | 1614 | return false; |
| 1615 | } | 1615 | } |
| 1616 | - if (item.sName === 'iRateType') { | ||
| 1617 | - console.log(item,'iRateType'); | ||
| 1618 | - | 1616 | + if (item.sName === "iRateType") { |
| 1617 | + console.log(item, "iRateType"); | ||
| 1619 | } | 1618 | } |
| 1620 | if (Number(selectedNode.iRateType) === 0 && item.sName === "iPage") { | 1619 | if (Number(selectedNode.iRateType) === 0 && item.sName === "iPage") { |
| 1621 | return false; | 1620 | return false; |
| 1622 | } else { | 1621 | } else { |
| 1623 | if (item.sName === "iPage") { | 1622 | if (item.sName === "iPage") { |
| 1624 | - const rateList = JSON.parse(slaveConfig.gdsconfigformslave.find(x=>x.sName === "iRateType")?.showDropDown) || [] | 1623 | + const rateList = JSON.parse(slaveConfig.gdsconfigformslave.find(x => x.sName === "iRateType")?.showDropDown) || []; |
| 1625 | item.showName = rateList[Number(selectedNode.iRateType)] || "倍率"; | 1624 | item.showName = rateList[Number(selectedNode.iRateType)] || "倍率"; |
| 1626 | } | 1625 | } |
| 1627 | } | 1626 | } |
| @@ -2074,14 +2073,15 @@ const BoxComponent = props => { | @@ -2074,14 +2073,15 @@ const BoxComponent = props => { | ||
| 2074 | const { sStripType = 0 } = selectedNode; | 2073 | const { sStripType = 0 } = selectedNode; |
| 2075 | if ( | 2074 | if ( |
| 2076 | (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) || | 2075 | (slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth && masterData.dHeight) || |
| 2077 | - (Number(sStripType) === 1 && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) | 2076 | + (Number(sStripType) === 1 && slaveRowData.sColumnNameConfig && masterData.dLength && masterData.dWidth) || |
| 2077 | + slaveRowData.sName ==='卡牌' | ||
| 2078 | ) { | 2078 | ) { |
| 2079 | const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig); | 2079 | const slaveNewData = slaveRowData.upAbleConfigsExtra || JSON.parse(slaveRowData.sColumnNameConfig); |
| 2080 | const tables = [ | 2080 | const tables = [ |
| 2081 | { name: "盒型类别", value: slaveRowData.sBoxType, type: null }, | 2081 | { name: "盒型类别", value: slaveRowData.sBoxType, type: null }, |
| 2082 | { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes }, | 2082 | { name: "盒身", value: slaveRowData.sBoxBody, type: slaveRowData.sTypes }, |
| 2083 | - { name: "盒长", value: masterData.dLength ? Number(masterData.dLength) : 0, type: null }, | ||
| 2084 | - { name: "盒宽", value: masterData.dWidth ? Number(masterData.dWidth) : 0, type: null }, | 2083 | + { name: "盒长", value:slaveRowData.dL ? slaveRowData.dL : masterData.dLength ? Number(masterData.dLength) : 0, type: null }, |
| 2084 | + { name: "盒宽", value: slaveRowData.dW ? slaveRowData.dW :masterData.dWidth ? Number(masterData.dWidth) : 0, type: null }, | ||
| 2085 | { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null }, | 2085 | { name: "盒高", value: masterData.dHeight ? Number(masterData.dHeight) : 0, type: null }, |
| 2086 | ]; | 2086 | ]; |
| 2087 | const titleList1 = [ | 2087 | const titleList1 = [ |
| @@ -2115,7 +2115,7 @@ const BoxComponent = props => { | @@ -2115,7 +2115,7 @@ const BoxComponent = props => { | ||
| 2115 | }; | 2115 | }; |
| 2116 | 2116 | ||
| 2117 | // 确认是竖向排列还是横向排列 | 2117 | // 确认是竖向排列还是横向排列 |
| 2118 | - const L = masterData?.dLength || 0; | 2118 | + const L = masterData?.dLength || 0; |
| 2119 | const W = masterData?.dWidth || 0; | 2119 | const W = masterData?.dWidth || 0; |
| 2120 | const H = masterData?.dWidth || 0; | 2120 | const H = masterData?.dWidth || 0; |
| 2121 | const D = masterData?.dHeight || 0; | 2121 | const D = masterData?.dHeight || 0; |
| @@ -2171,12 +2171,14 @@ const BoxComponent = props => { | @@ -2171,12 +2171,14 @@ const BoxComponent = props => { | ||
| 2171 | dSvgBoxHeight: 200, | 2171 | dSvgBoxHeight: 200, |
| 2172 | showNew: 1, | 2172 | showNew: 1, |
| 2173 | }; | 2173 | }; |
| 2174 | + console.log(boxList,'boxList'); | ||
| 2175 | + | ||
| 2174 | // upViewProps.viewRow = | 2176 | // upViewProps.viewRow = |
| 2175 | 2177 | ||
| 2176 | const isShowImg = boxList.find(x => x.sName === "盒身")?.type !== "" || false; | 2178 | const isShowImg = boxList.find(x => x.sName === "盒身")?.type !== "" || false; |
| 2177 | const PrintingParameters = props.getI18nName("PrintingParameters", "印刷参数"); | 2179 | const PrintingParameters = props.getI18nName("PrintingParameters", "印刷参数"); |
| 2178 | 2180 | ||
| 2179 | - const BoxInformation = commonFunc.showLocalMessage(props, "Box-typeInformation", "拼版信息"); | 2181 | + const BoxInformation = commonFunc.showLocalMessage(props, "Box-typeInformation", "盒型信息"); |
| 2180 | const ImpositionInformation = commonFunc.showLocalMessage(props, "ImpositionInformation", "拼版信息"); | 2182 | const ImpositionInformation = commonFunc.showLocalMessage(props, "ImpositionInformation", "拼版信息"); |
| 2181 | 2183 | ||
| 2182 | const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片"); | 2184 | const noImage = commonFunc.showLocalMessage(props, "ImpositionInformation", "暂无图片"); |
| @@ -2185,10 +2187,13 @@ const BoxComponent = props => { | @@ -2185,10 +2187,13 @@ const BoxComponent = props => { | ||
| 2185 | { src: slaveRowData.sPackDetailPathUpLoad, alt: "展开图" }, | 2187 | { src: slaveRowData.sPackDetailPathUpLoad, alt: "展开图" }, |
| 2186 | { src: slaveRowData.sPackPath, alt: "立体图" }, | 2188 | { src: slaveRowData.sPackPath, alt: "立体图" }, |
| 2187 | ]; | 2189 | ]; |
| 2190 | + console.log(state,'activeKey'); | ||
| 2191 | + const {activeKey = 0} = state | ||
| 2188 | return ( | 2192 | return ( |
| 2189 | <Tabs | 2193 | <Tabs |
| 2190 | key={boxModel} | 2194 | key={boxModel} |
| 2191 | type="card" | 2195 | type="card" |
| 2196 | + activeKey={activeKey} | ||
| 2192 | className={`noXlyTabs ${styles.tabs} ${!bBox ? styles.hideTab : ""}`} | 2197 | className={`noXlyTabs ${styles.tabs} ${!bBox ? styles.hideTab : ""}`} |
| 2193 | items={[BoxInformation, ImpositionInformation].map((title, index) => { | 2198 | items={[BoxInformation, ImpositionInformation].map((title, index) => { |
| 2194 | return { | 2199 | return { |
| @@ -2234,6 +2239,7 @@ const BoxComponent = props => { | @@ -2234,6 +2239,7 @@ const BoxComponent = props => { | ||
| 2234 | props.setState(pre => ({ | 2239 | props.setState(pre => ({ |
| 2235 | ...pre, | 2240 | ...pre, |
| 2236 | slaveData: [...slaveData], | 2241 | slaveData: [...slaveData], |
| 2242 | + activeKey:1 | ||
| 2237 | })); | 2243 | })); |
| 2238 | }} | 2244 | }} |
| 2239 | value={radioValue} | 2245 | value={radioValue} |
| @@ -2374,12 +2380,15 @@ const BoxComponent = props => { | @@ -2374,12 +2380,15 @@ const BoxComponent = props => { | ||
| 2374 | })} | 2380 | })} |
| 2375 | onChange={activeKey => { | 2381 | onChange={activeKey => { |
| 2376 | // 切换事件的处理逻辑 | 2382 | // 切换事件的处理逻辑 |
| 2377 | - const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === boxModel); | ||
| 2378 | - if (index !== -1) { | ||
| 2379 | - slaveData[index].dMaxLength = Number(selectedNode.sMachineStyle.split("*")[0]); | ||
| 2380 | - slaveData[index].dMaxWidth = Number(selectedNode.sMachineStyle.split("*")[1]); | ||
| 2381 | - } | 2383 | + // const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === boxModel); |
| 2384 | + // if (index !== -1) { | ||
| 2385 | + // slaveData[index].dMaxLength = Number(selectedNode.sMachineStyle.split("*")[0]); | ||
| 2386 | + // slaveData[index].dMaxWidth = Number(selectedNode.sMachineStyle.split("*")[1]); | ||
| 2387 | + // } | ||
| 2382 | // 可以在这里执行其他操作,比如根据 activeKey 加载数据 | 2388 | // 可以在这里执行其他操作,比如根据 activeKey 加载数据 |
| 2389 | + props.setState(pre => { | ||
| 2390 | + return { ...pre, activeKey }; | ||
| 2391 | + }); | ||
| 2383 | }} | 2392 | }} |
| 2384 | /> | 2393 | /> |
| 2385 | ); | 2394 | ); |