Commit 003ed0c7b1b86e51c620b453b729c80a5502274a
1 parent
29b14319
排版
Showing
6 changed files
with
174 additions
and
59 deletions
src/components/Common/Typesetting/typesetting.js
| @@ -20,8 +20,10 @@ const Typesetting = props => { | @@ -20,8 +20,10 @@ const Typesetting = props => { | ||
| 20 | boxWidth, | 20 | boxWidth, |
| 21 | boxHeight, | 21 | boxHeight, |
| 22 | textSize, | 22 | textSize, |
| 23 | + isMobile, | ||
| 23 | } = props; | 24 | } = props; |
| 24 | - if (!slaveRowData) return | 25 | + console.log("🚀 ~ Typesetting:", props); |
| 26 | + if (!slaveRowData) return; | ||
| 25 | const { | 27 | const { |
| 26 | dSBLB, // 上边留白 | 28 | dSBLB, // 上边留白 |
| 27 | dXBLB, // 下边留白 | 29 | dXBLB, // 下边留白 |
| @@ -52,6 +54,8 @@ const Typesetting = props => { | @@ -52,6 +54,8 @@ const Typesetting = props => { | ||
| 52 | const [dMaterialsKQty, setDMaterialsKQty] = useState(0); | 54 | const [dMaterialsKQty, setDMaterialsKQty] = useState(0); |
| 53 | const [dPartsLength, setDPartsLength] = useState(0); | 55 | const [dPartsLength, setDPartsLength] = useState(0); |
| 54 | 56 | ||
| 57 | + // 横板 | ||
| 58 | + const { dHorizontal, dPortrait, dHorizontalType, dPortraitType } = slaveRowData; | ||
| 55 | // 使用 useRef 获取 DOM 元素 | 59 | // 使用 useRef 获取 DOM 元素 |
| 56 | const boxRef = useRef(null); | 60 | const boxRef = useRef(null); |
| 57 | const boxsRef = useRef(null); | 61 | const boxsRef = useRef(null); |
| @@ -67,8 +71,10 @@ const Typesetting = props => { | @@ -67,8 +71,10 @@ const Typesetting = props => { | ||
| 67 | const slaveDataDetail = slaveData?.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel); | 71 | const slaveDataDetail = slaveData?.find(item => item.sTreeNodeName === selectedNode.showName && item.sBoxModel === boxModel); |
| 68 | const maxWidth = Number(slaveDataDetail?.dMaxLength); | 72 | const maxWidth = Number(slaveDataDetail?.dMaxLength); |
| 69 | const maxHeight = Number(slaveDataDetail?.dMaxWidth); | 73 | const maxHeight = Number(slaveDataDetail?.dMaxWidth); |
| 74 | + | ||
| 70 | const outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸 | 75 | const outerWidth = Number(slaveDataDetail?.dMaxLength); // 默认取最大上机尺寸 |
| 71 | const outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 | 76 | const outerHeight = Number(slaveDataDetail?.dMaxWidth); // 默认取最大上机尺寸 |
| 77 | + console.log("🚀 ~ maxWidth:", dHorizontal, dPortrait,dHorizontalType,dPortraitType, outerWidth, outerHeight); | ||
| 72 | 78 | ||
| 73 | // 确认是竖向排列还是横向排列 | 79 | // 确认是竖向排列还是横向排列 |
| 74 | const L = masterData?.dLength; | 80 | const L = masterData?.dLength; |
| @@ -215,7 +221,6 @@ const Typesetting = props => { | @@ -215,7 +221,6 @@ const Typesetting = props => { | ||
| 215 | // 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量 | 221 | // 每个盒子加上边距 和第二组偏移量 如果根据次盒再加上次盒偏移量 |
| 216 | let cols = Math.floor(outerWidth / (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset))); | 222 | let cols = Math.floor(outerWidth / (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset))); |
| 217 | let rows = Math.floor(outerHeight / (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset))); | 223 | let rows = Math.floor(outerHeight / (innerHeightCombined + boxWidthOffset + (reference ? 0 : dSWidthOffset))); |
| 218 | - | ||
| 219 | let colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined; | 224 | let colsMaxLength = (cols - 1) * (innerWidthCombined + boxLengthOffset + (reference ? 0 : dSLengthOffset)) + innerWidthCombined; |
| 220 | while (colsMaxLength >= outerWidth && cols > 0) { | 225 | while (colsMaxLength >= outerWidth && cols > 0) { |
| 221 | cols = cols - 1; | 226 | cols = cols - 1; |
| @@ -240,6 +245,28 @@ const Typesetting = props => { | @@ -240,6 +245,28 @@ const Typesetting = props => { | ||
| 240 | const commonHeightCheck = remainingHeight > jInnerHeight; | 245 | const commonHeightCheck = remainingHeight > jInnerHeight; |
| 241 | const commonWidthCheck = remainingWidth > jInnerWidth; | 246 | const commonWidthCheck = remainingWidth > jInnerWidth; |
| 242 | const remaining = isVertical ? commonHeightCheck : commonWidthCheck; | 247 | const remaining = isVertical ? commonHeightCheck : commonWidthCheck; |
| 248 | + console.log( | ||
| 249 | + cols, | ||
| 250 | + rows, | ||
| 251 | + innerWidth, | ||
| 252 | + innerHeight, | ||
| 253 | + jInnerWidth, | ||
| 254 | + jInnerHeight, | ||
| 255 | + innerWidthCombined, | ||
| 256 | + innerHeightCombined, | ||
| 257 | + remainingWidth, | ||
| 258 | + remainingHeight, | ||
| 259 | + colsMaxLength, | ||
| 260 | + rowsMaxLength, | ||
| 261 | + remaining, | ||
| 262 | + isVertical, | ||
| 263 | + boxLengthOffset, | ||
| 264 | + boxWidthOffset, | ||
| 265 | + dSLengthOffset, | ||
| 266 | + dFLengthOffset, | ||
| 267 | + "rowsMaxLength" | ||
| 268 | + ); | ||
| 269 | + | ||
| 243 | // 抵扣盒默认展示 svg | 270 | // 抵扣盒默认展示 svg |
| 244 | // const isSvg = props.slaveRowData.sName === "扣抵盒"; | 271 | // const isSvg = props.slaveRowData.sName === "扣抵盒"; |
| 245 | // 组装svg数据 | 272 | // 组装svg数据 |
| @@ -265,16 +292,16 @@ const Typesetting = props => { | @@ -265,16 +292,16 @@ const Typesetting = props => { | ||
| 265 | position: "absolute", | 292 | position: "absolute", |
| 266 | left: `${leftPosition}px`, | 293 | left: `${leftPosition}px`, |
| 267 | top: `${topPosition}px`, | 294 | top: `${topPosition}px`, |
| 268 | - transform: `rotateZ(${offsetZ}deg)`, | 295 | + |
| 269 | zIndex: 10, | 296 | zIndex: 10, |
| 270 | }} | 297 | }} |
| 271 | onDoubleClick={() => { | 298 | onDoubleClick={() => { |
| 272 | onClick(); | 299 | onClick(); |
| 273 | }} | 300 | }} |
| 274 | > | 301 | > |
| 275 | - {/* <img src={icon} width="100%" height="100%" /> */} | ||
| 276 | - <DynamicSVG {...svgProps} /> | ||
| 277 | - {/* {isSvg ? <DynamicSVG {...props} /> : <img src={icon} width="100%" height="100%" />} */} | 302 | + <div style={{ transform: `rotateZ(${offsetZ}deg)` }}> |
| 303 | + <DynamicSVG {...svgProps} /> | ||
| 304 | + </div> | ||
| 278 | </div> | 305 | </div> |
| 279 | ); | 306 | ); |
| 280 | const createBox = (col, row, index, leftPosition, topPosition, offsetZ, icon) => ( | 307 | const createBox = (col, row, index, leftPosition, topPosition, offsetZ, icon) => ( |
| @@ -299,24 +326,25 @@ const Typesetting = props => { | @@ -299,24 +326,25 @@ const Typesetting = props => { | ||
| 299 | <div | 326 | <div |
| 300 | key={`${col}-${row}-${index}`} | 327 | key={`${col}-${row}-${index}`} |
| 301 | style={{ | 328 | style={{ |
| 302 | - width: `${(iSAngle === 90 || iSAngle === 270) ? jInnerWidth:innerWidth}px`, | ||
| 303 | - height: `${(iFAngle === 90 || iFAngle === 270) ? jInnerHeight:innerHeight}px`, | 329 | + width: `${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`, |
| 330 | + height: `${iFAngle === 90 || iFAngle === 270 ? jInnerHeight : innerHeight}px`, | ||
| 304 | display: "flex", | 331 | display: "flex", |
| 305 | justifyContent: "center", | 332 | justifyContent: "center", |
| 306 | alignItems: "center", | 333 | alignItems: "center", |
| 307 | position: "absolute", | 334 | position: "absolute", |
| 308 | left: `${dFLengthOffset + dYBJJ}px`, | 335 | left: `${dFLengthOffset + dYBJJ}px`, |
| 309 | top: `${iFAngle === 90 || iFAngle === 270 ? 0 : dFWidthOffset + dXBJJ}px`, | 336 | top: `${iFAngle === 90 || iFAngle === 270 ? 0 : dFWidthOffset + dXBJJ}px`, |
| 310 | - transform: `rotateZ(${iFAngle}deg)`, | ||
| 311 | }} | 337 | }} |
| 312 | > | 338 | > |
| 313 | - <DynamicSVG {...svgProps} /> | 339 | + <div style={{ transform: `rotateZ(${iFAngle}deg)` }}> |
| 340 | + <DynamicSVG {...svgProps} /> | ||
| 341 | + </div> | ||
| 314 | </div> | 342 | </div> |
| 315 | <div | 343 | <div |
| 316 | key={`${col}-${row}-${index}-1`} | 344 | key={`${col}-${row}-${index}-1`} |
| 317 | style={{ | 345 | style={{ |
| 318 | - width: `${(iSAngle === 90 || iSAngle === 270) ? jInnerWidth:innerWidth}px`, | ||
| 319 | - height: `${(iSAngle === 90 || iSAngle === 270) ? jInnerHeight:innerHeight}px`, | 346 | + width: `${iSAngle === 90 || iSAngle === 270 ? jInnerWidth : innerWidth}px`, |
| 347 | + height: `${iSAngle === 90 || iSAngle === 270 ? jInnerHeight : innerHeight}px`, | ||
| 320 | display: "flex", | 348 | display: "flex", |
| 321 | justifyContent: "center", | 349 | justifyContent: "center", |
| 322 | alignItems: "center", | 350 | alignItems: "center", |
| @@ -325,10 +353,11 @@ const Typesetting = props => { | @@ -325,10 +353,11 @@ const Typesetting = props => { | ||
| 325 | top: `${ | 353 | top: `${ |
| 326 | isVertical ? jInnerHeight + dXBJJ + dFWidthOffset + dSWidthOffset : iSAngle === 90 || iSAngle === 270 ? 0 : dSWidthOffset + dXBJJ | 354 | isVertical ? jInnerHeight + dXBJJ + dFWidthOffset + dSWidthOffset : iSAngle === 90 || iSAngle === 270 ? 0 : dSWidthOffset + dXBJJ |
| 327 | }px`, | 355 | }px`, |
| 328 | - transform: `rotateZ(${iSAngle}deg)`, | ||
| 329 | }} | 356 | }} |
| 330 | > | 357 | > |
| 331 | - <DynamicSVG {...svgProps} /> | 358 | + <div style={{ transform: `rotateZ(${iSAngle}deg)` }}> |
| 359 | + <DynamicSVG {...svgProps} /> | ||
| 360 | + </div> | ||
| 332 | </div> | 361 | </div> |
| 333 | </div> | 362 | </div> |
| 334 | ); | 363 | ); |
| @@ -362,12 +391,13 @@ const Typesetting = props => { | @@ -362,12 +391,13 @@ const Typesetting = props => { | ||
| 362 | position: "absolute", | 391 | position: "absolute", |
| 363 | left: `${dFLengthOffset + dYBJJ}px`, | 392 | left: `${dFLengthOffset + dYBJJ}px`, |
| 364 | top: `${dFWidthOffset + dXBJJ}px`, | 393 | top: `${dFWidthOffset + dXBJJ}px`, |
| 365 | - transform: `rotateZ(${iFAngle}deg)`, | ||
| 366 | }} | 394 | }} |
| 367 | > | 395 | > |
| 368 | {/* <img src={icon} width="100%" height="100%" /> */} | 396 | {/* <img src={icon} width="100%" height="100%" /> */} |
| 369 | {/* {isSvg ? <DynamicSVG {...props} /> : <img src={icon} width="100%" height="100%" />} */} | 397 | {/* {isSvg ? <DynamicSVG {...props} /> : <img src={icon} width="100%" height="100%" />} */} |
| 370 | - <DynamicSVG {...svgProps} /> | 398 | + <div style={{ transform: `rotateZ(${iFAngle}deg)` }}> |
| 399 | + <DynamicSVG {...svgProps} /> | ||
| 400 | + </div> | ||
| 371 | </div> | 401 | </div> |
| 372 | </div> | 402 | </div> |
| 373 | ); | 403 | ); |
| @@ -389,7 +419,6 @@ const Typesetting = props => { | @@ -389,7 +419,6 @@ const Typesetting = props => { | ||
| 389 | const calculateTopPosition = (row, reference, isVertical, topPosition, dSWidthOffset, dXBJJ) => { | 419 | const calculateTopPosition = (row, reference, isVertical, topPosition, dSWidthOffset, dXBJJ) => { |
| 390 | if (isVertical) { | 420 | if (isVertical) { |
| 391 | if (reference) { | 421 | if (reference) { |
| 392 | - | ||
| 393 | return row === 0 ? topPosition : topPosition + boxWidthOffset * row; | 422 | return row === 0 ? topPosition : topPosition + boxWidthOffset * row; |
| 394 | } else { | 423 | } else { |
| 395 | return row === 0 ? topPosition : topPosition + (dSWidthOffset + boxWidthOffset) * row; | 424 | return row === 0 ? topPosition : topPosition + (dSWidthOffset + boxWidthOffset) * row; |
| @@ -404,23 +433,20 @@ const Typesetting = props => { | @@ -404,23 +433,20 @@ const Typesetting = props => { | ||
| 404 | }; | 433 | }; |
| 405 | const scaleXD = (clientWidth - 50) / (outerWidth + 110); | 434 | const scaleXD = (clientWidth - 50) / (outerWidth + 110); |
| 406 | const scaleYD = (clientHeight - 5) / (outerHeight + 90); | 435 | const scaleYD = (clientHeight - 5) / (outerHeight + 90); |
| 407 | - useEffect( | ||
| 408 | - () => { | ||
| 409 | - // 计算缩放比例 | ||
| 410 | - // setBoxKey(new Date().getTime()); | ||
| 411 | - setTimeout(() => { | ||
| 412 | - const scaleX = (clientWidth - 50) / (outerWidth + 110); | ||
| 413 | - const scaleY = (clientHeight - 5) / (outerHeight + 90); | ||
| 414 | - const newScale = Math.min(scaleX, scaleY); | ||
| 415 | - setScale(newScale); | ||
| 416 | - if (boxRef.current) { | ||
| 417 | - boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`; | ||
| 418 | - boxRef.current.style.transformOrigin = "top left"; | ||
| 419 | - } | ||
| 420 | - }, 0); | ||
| 421 | - }, | ||
| 422 | - [radioValue, slaveRowData, masterData, selectedNode, slaveData] | ||
| 423 | - ); | 436 | + useEffect(() => { |
| 437 | + // 计算缩放比例 | ||
| 438 | + // setBoxKey(new Date().getTime()); | ||
| 439 | + setTimeout(() => { | ||
| 440 | + const scaleX = (clientWidth - 50) / (outerWidth + 110); | ||
| 441 | + const scaleY = (clientHeight - 5) / (outerHeight + 90); | ||
| 442 | + const newScale = Math.min(scaleX, scaleY); | ||
| 443 | + setScale(newScale); | ||
| 444 | + if (boxRef.current) { | ||
| 445 | + boxRef.current.style.transform = `scale(${scaleX}, ${scaleY})`; | ||
| 446 | + boxRef.current.style.transformOrigin = "top left"; | ||
| 447 | + } | ||
| 448 | + }, 0); | ||
| 449 | + }, [radioValue, slaveRowData, masterData, selectedNode, slaveData]); | ||
| 424 | // 生成里层 div 的数组 | 450 | // 生成里层 div 的数组 |
| 425 | const innerDivs = []; | 451 | const innerDivs = []; |
| 426 | for (let col = 0; col < cols; col++) { | 452 | for (let col = 0; col < cols; col++) { |
| @@ -476,17 +502,21 @@ const Typesetting = props => { | @@ -476,17 +502,21 @@ const Typesetting = props => { | ||
| 476 | const propsDataWidth = Number(propsData.props.style.width.slice(0, -2)); | 502 | const propsDataWidth = Number(propsData.props.style.width.slice(0, -2)); |
| 477 | const propsDataHeight = Number(propsData.props.style.height.slice(0, -2)); | 503 | const propsDataHeight = Number(propsData.props.style.height.slice(0, -2)); |
| 478 | const propsDataTop = Number(propsData.props.style.top.slice(0, -2)); | 504 | const propsDataTop = Number(propsData.props.style.top.slice(0, -2)); |
| 479 | - | ||
| 480 | - const newMaterialLength = propsDataLeft + innerWidthCombined; // 原纸长 | 505 | + // 判断列是否是单独的 |
| 506 | + const newMaterialLength = propsDataLeft + (remaining ? jInnerWidth : innerWidthCombined); // 原纸长 | ||
| 481 | const newMaterialWidth = propsDataTop + propsDataHeight - dSBLB; | 507 | const newMaterialWidth = propsDataTop + propsDataHeight - dSBLB; |
| 482 | // 计算开数 | 508 | // 计算开数 |
| 483 | - const dSinglePQty = variables | 509 | + const dSinglePQty = isVertical |
| 484 | ? remaining | 510 | ? remaining |
| 485 | ? cols + cols * (rows * 2) | 511 | ? cols + cols * (rows * 2) |
| 486 | : cols * (rows * 2) | 512 | : cols * (rows * 2) |
| 487 | : remaining | 513 | : remaining |
| 488 | - ? rows + rows * (cols * 2) | ||
| 489 | - : rows * (cols * 2); | 514 | + ? rows + rows * (cols * 2) |
| 515 | + : rows * (cols * 2); | ||
| 516 | + // 计算竖版数量 | ||
| 517 | + const dHorizontalType = isVertical ? cols : remaining ? cols * 2 + 1 : cols * 2; | ||
| 518 | + const dPortraitType = isVertical ? rows * 2 : remaining ? rows : rows; | ||
| 519 | + | ||
| 490 | const newDProductQty = masterData.dProductQty; | 520 | const newDProductQty = masterData.dProductQty; |
| 491 | const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; | 521 | const dMaterialsKQty = slaveDataDetail.dMaterialsKQty || 1; |
| 492 | if ( | 522 | if ( |
| @@ -516,7 +546,9 @@ const Typesetting = props => { | @@ -516,7 +546,9 @@ const Typesetting = props => { | ||
| 516 | newMaterialLength, | 546 | newMaterialLength, |
| 517 | newMaterialWidth, | 547 | newMaterialWidth, |
| 518 | innerWidth, | 548 | innerWidth, |
| 519 | - innerHeight | 549 | + innerHeight, |
| 550 | + dHorizontalType, | ||
| 551 | + dPortraitType | ||
| 520 | ); | 552 | ); |
| 521 | } else if (dProductQty !== newDProductQty) { | 553 | } else if (dProductQty !== newDProductQty) { |
| 522 | setDProductQty(newDProductQty); | 554 | setDProductQty(newDProductQty); |
| @@ -533,7 +565,9 @@ const Typesetting = props => { | @@ -533,7 +565,9 @@ const Typesetting = props => { | ||
| 533 | slaveDataDetail.dWlcd, | 565 | slaveDataDetail.dWlcd, |
| 534 | slaveDataDetail.dWlkd, | 566 | slaveDataDetail.dWlkd, |
| 535 | innerWidth, | 567 | innerWidth, |
| 536 | - innerHeight | 568 | + innerHeight, |
| 569 | + dHorizontalType, | ||
| 570 | + dPortraitType | ||
| 537 | ); | 571 | ); |
| 538 | } | 572 | } |
| 539 | openEdition = (((newMaterialLength * newMaterialWidth) / (maxWidth * maxHeight)) * 100).toFixed(2); | 573 | openEdition = (((newMaterialLength * newMaterialWidth) / (maxWidth * maxHeight)) * 100).toFixed(2); |
| @@ -550,8 +584,9 @@ const Typesetting = props => { | @@ -550,8 +584,9 @@ const Typesetting = props => { | ||
| 550 | } | 584 | } |
| 551 | const isMax = slaveDataDetail?.dMaxLength && Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength); | 585 | const isMax = slaveDataDetail?.dMaxLength && Number(slaveDataDetail?.dMaxLength) >= Number(slaveRowData?.dMachineLength); |
| 552 | const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length; | 586 | const isShow = slaveRowData && slaveRowData.dMachineLength && slaveRowData.dMaxWidth && slaveRowData.dMaxLength && isMax && innerDivs.length; |
| 553 | - | 587 | + |
| 554 | const onClick = () => { | 588 | const onClick = () => { |
| 589 | + if (isMobile) return; | ||
| 555 | setIsModalOpen(true); | 590 | setIsModalOpen(true); |
| 556 | // setBoxKeys(new Date().getTime()); | 591 | // setBoxKeys(new Date().getTime()); |
| 557 | setTimeout(() => { | 592 | setTimeout(() => { |
src/components/QuickQuote/index.jsx
| @@ -1525,7 +1525,8 @@ const BoxComponent = props => { | @@ -1525,7 +1525,8 @@ const BoxComponent = props => { | ||
| 1525 | 1525 | ||
| 1526 | // 使用 useCallback 确保回调函数的稳定性 | 1526 | // 使用 useCallback 确保回调函数的稳定性 |
| 1527 | const handleSaveState = useCallback( | 1527 | const handleSaveState = useCallback( |
| 1528 | - (length, width, slaveData, masterData, dSinglePQty, dMaterialsKQty, dProductQty, scale, dWlcd, dWlkd, innerWidth, innerHeight) => { | 1528 | + (length, width, slaveData, masterData, dSinglePQty, dMaterialsKQty, dProductQty, scale, dWlcd, dWlkd, innerWidth, innerHeight,dHorizontal,dPortrait) => { |
| 1529 | + console.log("🚀 ~ dPortrait:",dHorizontal,dPortrait) | ||
| 1529 | // 查找符合条件的索引 | 1530 | // 查找符合条件的索引 |
| 1530 | const { selectedNode } = props.state; | 1531 | const { selectedNode } = props.state; |
| 1531 | 1532 | ||
| @@ -1564,6 +1565,10 @@ const BoxComponent = props => { | @@ -1564,6 +1565,10 @@ const BoxComponent = props => { | ||
| 1564 | scale: scale, | 1565 | scale: scale, |
| 1565 | dPartsLength: innerWidth, | 1566 | dPartsLength: innerWidth, |
| 1566 | dPartsWidth: innerHeight, | 1567 | dPartsWidth: innerHeight, |
| 1568 | + dHorizontal:dHorizontal, | ||
| 1569 | + dPortrait:dPortrait, | ||
| 1570 | + dHorizontalType:dHorizontal, | ||
| 1571 | + dPortraitType:dPortrait, | ||
| 1567 | }; | 1572 | }; |
| 1568 | // 更新状态 | 1573 | // 更新状态 |
| 1569 | props.setState(prevState => ({ | 1574 | props.setState(prevState => ({ |
| @@ -1707,6 +1712,7 @@ const BoxComponent = props => { | @@ -1707,6 +1712,7 @@ const BoxComponent = props => { | ||
| 1707 | dSvgBoxHeight: 300, | 1712 | dSvgBoxHeight: 300, |
| 1708 | showNew: 1, | 1713 | showNew: 1, |
| 1709 | }; | 1714 | }; |
| 1715 | + const isShowImg = boxList.find(x=>x.sName === '盒身')?.type !== '' || false | ||
| 1710 | return ( | 1716 | return ( |
| 1711 | <Tabs | 1717 | <Tabs |
| 1712 | key={boxModel} | 1718 | key={boxModel} |
| @@ -1773,7 +1779,7 @@ const BoxComponent = props => { | @@ -1773,7 +1779,7 @@ const BoxComponent = props => { | ||
| 1773 | <div className={styles.boxPart1Right}> | 1779 | <div className={styles.boxPart1Right}> |
| 1774 | <div className={styles.boxRreview}> | 1780 | <div className={styles.boxRreview}> |
| 1775 | <Image.PreviewGroup> | 1781 | <Image.PreviewGroup> |
| 1776 | - {slaveRowData.sPackDetailPathUpLoad ? ( | 1782 | + {!isShowImg ? ( |
| 1777 | <Image width={300} src={slaveRowData.sPackDetailPathUpLoad} /> | 1783 | <Image width={300} src={slaveRowData.sPackDetailPathUpLoad} /> |
| 1778 | ) : svgProps.boxList.length ? ( | 1784 | ) : svgProps.boxList.length ? ( |
| 1779 | <div style={{ width: " 300px", height: "300px" }}> | 1785 | <div style={{ width: " 300px", height: "300px" }}> |
src/mobile/components/SelectInput.jsx
| @@ -59,9 +59,9 @@ const SelectInput = props => { | @@ -59,9 +59,9 @@ const SelectInput = props => { | ||
| 59 | const handleConfirm = () => { | 59 | const handleConfirm = () => { |
| 60 | if (!values[0]) { | 60 | if (!values[0]) { |
| 61 | setVisible(false); | 61 | setVisible(false); |
| 62 | - | ||
| 63 | return; | 62 | return; |
| 64 | } | 63 | } |
| 64 | + // 判断是否是 | ||
| 65 | const index = columns.findIndex(item => item.value === values[0]); | 65 | const index = columns.findIndex(item => item.value === values[0]); |
| 66 | const data = coplyColumns[index]; | 66 | const data = coplyColumns[index]; |
| 67 | data[itemDetail.sName] = data[itemDetail.sName] ? data[itemDetail.sName] : data.label || data.sName || data.sProcessName || data.sColorName; | 67 | data[itemDetail.sName] = data[itemDetail.sName] ? data[itemDetail.sName] : data.label || data.sName || data.sProcessName || data.sColorName; |
src/mobile/quotation/detailNew.jsx
| 1 | import { useRef, useEffect, useState, useCallback, useMemo } from "react"; | 1 | import { useRef, useEffect, useState, useCallback, useMemo } from "react"; |
| 2 | import { history } from "umi"; | 2 | import { history } from "umi"; |
| 3 | -import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog, Radio } from "antd-mobile"; | ||
| 4 | -import { AddOutline, MinusOutline, EditFill } from "antd-mobile-icons"; | 3 | +import { Toast, Input, Tabs, Selector, Grid, Image, Button, Checkbox, Switch, Dialog, Radio, Space } from "antd-mobile"; |
| 4 | +import { AddOutline, MinusOutline, EditFill, CloseOutline } from "antd-mobile-icons"; | ||
| 5 | import commonConfig from "@/utils/config"; | 5 | import commonConfig from "@/utils/config"; |
| 6 | import * as commonServices from "@/services/services"; | 6 | import * as commonServices from "@/services/services"; |
| 7 | import * as commonFunc from "@/components/Common/commonFunc"; | 7 | import * as commonFunc from "@/components/Common/commonFunc"; |
| @@ -286,6 +286,14 @@ const QuickQuoteEvent = props => { | @@ -286,6 +286,14 @@ const QuickQuoteEvent = props => { | ||
| 286 | dMachineLength: slaveData[saveIndex].dWlcd, | 286 | dMachineLength: slaveData[saveIndex].dWlcd, |
| 287 | }; | 287 | }; |
| 288 | } | 288 | } |
| 289 | + | ||
| 290 | + if (sFieldName === "dMaxLength") { | ||
| 291 | + slaveData[saveIndex] = { | ||
| 292 | + ...slaveData[saveIndex], | ||
| 293 | + dMaxLength: changeValue.dMachineLength, | ||
| 294 | + dMaxWidth: changeValue.dMachineWidth, | ||
| 295 | + }; | ||
| 296 | + } | ||
| 289 | setState(pre => ({ ...pre, slaveData, ...extraState })); | 297 | setState(pre => ({ ...pre, slaveData, ...extraState })); |
| 290 | } else if (name === "finished") { | 298 | } else if (name === "finished") { |
| 291 | const { productProcessInfo = [] } = masterData; | 299 | const { productProcessInfo = [] } = masterData; |
| @@ -939,7 +947,6 @@ const QuickQuoteEvent = props => { | @@ -939,7 +947,6 @@ const QuickQuoteEvent = props => { | ||
| 939 | }; | 947 | }; |
| 940 | // 入口 | 948 | // 入口 |
| 941 | const QuotationAllprogressDetail = baseProps => { | 949 | const QuotationAllprogressDetail = baseProps => { |
| 942 | - // const masterProps = getProps(baseProps); | ||
| 943 | const props = QuickQuoteEvent(baseProps); | 950 | const props = QuickQuoteEvent(baseProps); |
| 944 | const { selectedNode, slaveConfig, quotationData, app, sModelsId, masterData } = props; | 951 | const { selectedNode, slaveConfig, quotationData, app, sModelsId, masterData } = props; |
| 945 | const { showName, sUnit } = quotationData; | 952 | const { showName, sUnit } = quotationData; |
| @@ -1019,7 +1026,6 @@ const QuotationAllprogressDetail = baseProps => { | @@ -1019,7 +1026,6 @@ const QuotationAllprogressDetail = baseProps => { | ||
| 1019 | // 取上机尺寸 | 1026 | // 取上机尺寸 |
| 1020 | return commonUtils.convertStrToObj(sColumnNameConfigStr, []); | 1027 | return commonUtils.convertStrToObj(sColumnNameConfigStr, []); |
| 1021 | }; | 1028 | }; |
| 1022 | - | ||
| 1023 | return ( | 1029 | return ( |
| 1024 | <div className={styles.quotationDetailBox}> | 1030 | <div className={styles.quotationDetailBox}> |
| 1025 | <QuotationDetail {...props} /> | 1031 | <QuotationDetail {...props} /> |
| @@ -1179,7 +1185,7 @@ const QuotationTabs = props => { | @@ -1179,7 +1185,7 @@ const QuotationTabs = props => { | ||
| 1179 | }; | 1185 | }; |
| 1180 | return ( | 1186 | return ( |
| 1181 | <div> | 1187 | <div> |
| 1182 | - <div> | 1188 | + <div className={styles.tabsBox}> |
| 1183 | <Tabs | 1189 | <Tabs |
| 1184 | activeKey={activeKey} | 1190 | activeKey={activeKey} |
| 1185 | onChange={key => { | 1191 | onChange={key => { |
| @@ -1188,12 +1194,23 @@ const QuotationTabs = props => { | @@ -1188,12 +1194,23 @@ const QuotationTabs = props => { | ||
| 1188 | > | 1194 | > |
| 1189 | {sAllPartsNameList && sAllPartsNameList.length | 1195 | {sAllPartsNameList && sAllPartsNameList.length |
| 1190 | ? sAllPartsNameList.map((pane, index) => ( | 1196 | ? sAllPartsNameList.map((pane, index) => ( |
| 1191 | - <Tabs.Tab key={pane} title={pane}> | 1197 | + <Tabs.Tab key={pane} title={pane} style={{ position: "relative" }}> |
| 1192 | <BoxComponent {...tabsProps} paneKey={pane} /> | 1198 | <BoxComponent {...tabsProps} paneKey={pane} /> |
| 1199 | + {/* <CloseOutline className={styles.tabClearBtn}/> */} | ||
| 1193 | </Tabs.Tab> | 1200 | </Tabs.Tab> |
| 1194 | )) | 1201 | )) |
| 1195 | : ""} | 1202 | : ""} |
| 1196 | </Tabs> | 1203 | </Tabs> |
| 1204 | + {/* <Button | ||
| 1205 | + className={styles.tabAddBtn} | ||
| 1206 | + color="primary" | ||
| 1207 | + fill="solid" | ||
| 1208 | + size="small" | ||
| 1209 | + style={{ width: "1.93rem", height: "1.93rem", display: "flex", justifyContent: "center", alignItems: "center", textAlign: "center" }} | ||
| 1210 | + onClick={() => {}} | ||
| 1211 | + > | ||
| 1212 | + <AddOutline /> | ||
| 1213 | + </Button> */} | ||
| 1197 | </div> | 1214 | </div> |
| 1198 | </div> | 1215 | </div> |
| 1199 | ); | 1216 | ); |
| @@ -1423,6 +1440,7 @@ const BoxComponent = props => { | @@ -1423,6 +1440,7 @@ const BoxComponent = props => { | ||
| 1423 | useEffect(() => { | 1440 | useEffect(() => { |
| 1424 | if (!sBackProcessData) return; | 1441 | if (!sBackProcessData) return; |
| 1425 | const newSwitchStates = downAbleConfigsNew; | 1442 | const newSwitchStates = downAbleConfigsNew; |
| 1443 | + console.log("🚀 ~ switchStates:", switchStates) | ||
| 1426 | 1444 | ||
| 1427 | setSwitchStates(newSwitchStates); | 1445 | setSwitchStates(newSwitchStates); |
| 1428 | }, [downAbleConfigsNew, boxModel]); // 依赖数组 | 1446 | }, [downAbleConfigsNew, boxModel]); // 依赖数组 |
| @@ -1469,7 +1487,8 @@ const BoxComponent = props => { | @@ -1469,7 +1487,8 @@ const BoxComponent = props => { | ||
| 1469 | tableName: "finished", | 1487 | tableName: "finished", |
| 1470 | }; | 1488 | }; |
| 1471 | const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); | 1489 | const calcMethodData = commonUtils.convertStrToObj(slaveRowData?.sColumnNameConfigExclusion, []); |
| 1472 | - const radioValue = calcMethodData[0]?.sCode; | 1490 | + // const radioValue = null; |
| 1491 | + const { radioValue = calcMethodData[0]?.sCode } = slaveRowData | ||
| 1473 | const [materialLength, setMaterialLength] = useState(0); | 1492 | const [materialLength, setMaterialLength] = useState(0); |
| 1474 | const [materialWidth, setMaterialWidth] = useState(0); | 1493 | const [materialWidth, setMaterialWidth] = useState(0); |
| 1475 | // 使用 useCallback 确保回调函数的稳定性 | 1494 | // 使用 useCallback 确保回调函数的稳定性 |
| @@ -1563,6 +1582,7 @@ const BoxComponent = props => { | @@ -1563,6 +1582,7 @@ const BoxComponent = props => { | ||
| 1563 | boxWidth: 190, | 1582 | boxWidth: 190, |
| 1564 | boxHeight: 150, | 1583 | boxHeight: 150, |
| 1565 | textSize: 9, | 1584 | textSize: 9, |
| 1585 | + isMobile: true, | ||
| 1566 | // boxPicData, | 1586 | // boxPicData, |
| 1567 | }; | 1587 | }; |
| 1568 | const showImgMProps = { | 1588 | const showImgMProps = { |
| @@ -1664,7 +1684,10 @@ const BoxComponent = props => { | @@ -1664,7 +1684,10 @@ const BoxComponent = props => { | ||
| 1664 | ); | 1684 | ); |
| 1665 | }; | 1685 | }; |
| 1666 | const { loading } = props; | 1686 | const { loading } = props; |
| 1667 | - | 1687 | + const calcMethod = calcMethodData.map(item => ({ |
| 1688 | + value: item.sCode, | ||
| 1689 | + label: item.showName, | ||
| 1690 | + })); | ||
| 1668 | return ( | 1691 | return ( |
| 1669 | <div> | 1692 | <div> |
| 1670 | <Selector | 1693 | <Selector |
| @@ -1725,7 +1748,14 @@ const BoxComponent = props => { | @@ -1725,7 +1748,14 @@ const BoxComponent = props => { | ||
| 1725 | <Grid.Item> | 1748 | <Grid.Item> |
| 1726 | <div className={styles.customer} key={x.id || x.showName}> | 1749 | <div className={styles.customer} key={x.id || x.showName}> |
| 1727 | <div>{x.showName}</div> | 1750 | <div>{x.showName}</div> |
| 1728 | - <SelectInput {...upViewProps20} itemDetail={x} bCanInput={true} /> | 1751 | + <SelectInput |
| 1752 | + {...upViewProps20} | ||
| 1753 | + itemDetail={x} | ||
| 1754 | + bCanInput={() => { | ||
| 1755 | + // if (x.showDropDown) return false; | ||
| 1756 | + return true; | ||
| 1757 | + }} | ||
| 1758 | + /> | ||
| 1729 | </div> | 1759 | </div> |
| 1730 | </Grid.Item> | 1760 | </Grid.Item> |
| 1731 | )) | 1761 | )) |
| @@ -1740,6 +1770,22 @@ const BoxComponent = props => { | @@ -1740,6 +1770,22 @@ const BoxComponent = props => { | ||
| 1740 | <ShowImgM {...showImgMProps} /> | 1770 | <ShowImgM {...showImgMProps} /> |
| 1741 | </div> | 1771 | </div> |
| 1742 | </div> | 1772 | </div> |
| 1773 | + <Radio.Group | ||
| 1774 | + value={radioValue} | ||
| 1775 | + onChange={e => { | ||
| 1776 | + const iIndex = slaveData.findIndex(item => item.sId === slaveRowData.sId); | ||
| 1777 | + console.log("🚀 ~ iIndex:", iIndex) | ||
| 1778 | + slaveData[iIndex].radioValue = e; | ||
| 1779 | + props.setState(pre => ({ | ||
| 1780 | + ...pre, | ||
| 1781 | + slaveData: slaveData, | ||
| 1782 | + })); | ||
| 1783 | + }} | ||
| 1784 | + > | ||
| 1785 | + {calcMethod.map(item => ( | ||
| 1786 | + <Radio value={item.value} style={{marginRight:'0.5rem'}}> {item.label}</Radio> | ||
| 1787 | + ))} | ||
| 1788 | + </Radio.Group> | ||
| 1743 | <div> | 1789 | <div> |
| 1744 | <MaterialsComponent {...props} slaveRowData={slaveRowData} boxModel={boxModel} /> | 1790 | <MaterialsComponent {...props} slaveRowData={slaveRowData} boxModel={boxModel} /> |
| 1745 | </div> | 1791 | </div> |
src/mobile/quotation/quotationDetail.css
| @@ -126,3 +126,17 @@ | @@ -126,3 +126,17 @@ | ||
| 126 | margin-top: 1rem; | 126 | margin-top: 1rem; |
| 127 | background-color: #dededf; | 127 | background-color: #dededf; |
| 128 | } | 128 | } |
| 129 | +.tabsBox { | ||
| 130 | + position: relative; | ||
| 131 | + width: 100%; | ||
| 132 | +} | ||
| 133 | +.tabsBox .tabAddBtn { | ||
| 134 | + position: absolute; | ||
| 135 | + right: 0; | ||
| 136 | + top: 0.75rem; | ||
| 137 | +} | ||
| 138 | +.tabsBox .tabClearBtn { | ||
| 139 | + position: absolute; | ||
| 140 | + right: 0; | ||
| 141 | + top: 0; | ||
| 142 | +} |
src/mobile/quotation/quotationDetail.less
| @@ -115,23 +115,37 @@ | @@ -115,23 +115,37 @@ | ||
| 115 | width: 3.5rem; | 115 | width: 3.5rem; |
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | -.projectBtn{ | 118 | +.projectBtn { |
| 119 | display: flex; | 119 | display: flex; |
| 120 | align-items: center; | 120 | align-items: center; |
| 121 | justify-content: space-between; | 121 | justify-content: space-between; |
| 122 | } | 122 | } |
| 123 | -.boxTitle{ | 123 | +.boxTitle { |
| 124 | font-size: 1.5rem; | 124 | font-size: 1.5rem; |
| 125 | font-weight: 700; | 125 | font-weight: 700; |
| 126 | margin-bottom: 2rem; | 126 | margin-bottom: 2rem; |
| 127 | margin-top: 1rem; | 127 | margin-top: 1rem; |
| 128 | } | 128 | } |
| 129 | -.quotationBody{ | 129 | +.quotationBody { |
| 130 | font-size: 1.25rem; | 130 | font-size: 1.25rem; |
| 131 | - .line{ | 131 | + .line { |
| 132 | width: 100%; | 132 | width: 100%; |
| 133 | height: 1px; | 133 | height: 1px; |
| 134 | margin-top: 1rem; | 134 | margin-top: 1rem; |
| 135 | background-color: #dededf; | 135 | background-color: #dededf; |
| 136 | } | 136 | } |
| 137 | -} | ||
| 138 | \ No newline at end of file | 137 | \ No newline at end of file |
| 138 | +} | ||
| 139 | +.tabsBox { | ||
| 140 | + position: relative; | ||
| 141 | + width: 100%; | ||
| 142 | + .tabAddBtn { | ||
| 143 | + position: absolute; | ||
| 144 | + right: 0; | ||
| 145 | + top: .75rem; | ||
| 146 | + } | ||
| 147 | + .tabClearBtn{ | ||
| 148 | + position: absolute; | ||
| 149 | + right: 0; | ||
| 150 | + top: 0; | ||
| 151 | + } | ||
| 152 | +} |