Commit 9aa39ea9868af1b4ac5a4956563dd3e9eb232273
Merge branch 'main' of http://git.xlyprint.cn/zhangz/xlyUmi into main
Showing
98 changed files
with
11190 additions
and
1583 deletions
Too many changes to show.
To preserve performance only 28 of 98 files are displayed.
.umirc.ts
package.json
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | "numeral": "^2.0.6", |
| 33 | 33 | "react-dnd": "^14.0.5", |
| 34 | 34 | "react-dnd-html5-backend": "^14.1.0", |
| 35 | - "react-draggable": "^4.4.6", | |
| 35 | + "react-draggable": "4.4.5", | |
| 36 | 36 | "react-fittext": "1.0.0", |
| 37 | 37 | "react-flow-renderer": "^10.3.17", |
| 38 | 38 | "react-grid-layout": "^1.3.4", |
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | "react-resizable": "^3.0.5", |
| 42 | 42 | "react-sortable-hoc": "^2.0.0", |
| 43 | 43 | "react-to-print": "^3.0.5", |
| 44 | - "umi": "^4.4.6" | |
| 44 | + "umi": "^4.4.11" | |
| 45 | 45 | }, |
| 46 | 46 | "devDependencies": { |
| 47 | 47 | "@types/react": "^18.0.33", | ... | ... |
src/components/Charts/Pie/index.js
src/components/Common/BoxDesignCompontent/index.js
| ... | ... | @@ -160,7 +160,6 @@ const BoxDesignCompontent = baseProps => { |
| 160 | 160 | tableColum.forEach(item => { |
| 161 | 161 | titleList.push(item.showName); |
| 162 | 162 | }); |
| 163 | - console.log("🚀 ~ tableColum:", tableColum); | |
| 164 | 163 | boxBodyList.forEach(item => { |
| 165 | 164 | titleList.push(item.showName); |
| 166 | 165 | }); |
| ... | ... | @@ -410,6 +409,7 @@ const BoxDesignCompontent = baseProps => { |
| 410 | 409 | const zscw = boxList.find(x => x.sName === "左(上)插位组件"); |
| 411 | 410 | const yscw = boxList.find(x => x.sName === "右(上)插位组件"); |
| 412 | 411 | const yxcw = boxList.find(x => x.sName === "右(下)插位组件"); |
| 412 | + const hdzj = boxList.find(x => x.sName === "盒底组件"); | |
| 413 | 413 | const zxcwType = zxcw?.type; |
| 414 | 414 | const zxcwValue = zxcw?.value; |
| 415 | 415 | const zscwType = zscw?.type; |
| ... | ... | @@ -432,7 +432,7 @@ const BoxDesignCompontent = baseProps => { |
| 432 | 432 | const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; |
| 433 | 433 | sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); |
| 434 | 434 | |
| 435 | - if (zxcwType === "4001" || zxcwType === "4006") { | |
| 435 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | |
| 436 | 436 | leftBottomValue = Number(zxcwValue) + boxHeight; |
| 437 | 437 | leftBottom = " + dZXCW + W"; |
| 438 | 438 | } else if (zxcwType === "4002" || zxcwType === "4003") { |
| ... | ... | @@ -445,7 +445,7 @@ const BoxDesignCompontent = baseProps => { |
| 445 | 445 | leftBottomValue = boxHeight * 2; |
| 446 | 446 | leftBottom = "+ W * 2"; |
| 447 | 447 | } |
| 448 | - if (yscwType === "6001" || yscwType === "6006") { | |
| 448 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | |
| 449 | 449 | rightTopValue = Number(yscwValue) + boxHeight; |
| 450 | 450 | rightTop = "dYSCW + W + "; |
| 451 | 451 | } else if (yscwType === "6002" || yscwType === "6003") { |
| ... | ... | @@ -458,7 +458,7 @@ const BoxDesignCompontent = baseProps => { |
| 458 | 458 | rightTopValue = boxHeight * 2; |
| 459 | 459 | rightTop = "W * 2+ "; |
| 460 | 460 | } |
| 461 | - if (zscwType === "3001" || zscwType === "3006") { | |
| 461 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | |
| 462 | 462 | leftTopValue = Number(zscwValue) + boxHeight; |
| 463 | 463 | leftTop = "dZSCW + W +"; |
| 464 | 464 | } else if (zscwType === "3002" || zscwType === "3003") { |
| ... | ... | @@ -471,7 +471,7 @@ const BoxDesignCompontent = baseProps => { |
| 471 | 471 | leftTopValue = boxHeight * 2; |
| 472 | 472 | leftTop = "W * 2 +"; |
| 473 | 473 | } |
| 474 | - if (yxcwType === "7001" || yxcwType === "7006") { | |
| 474 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | |
| 475 | 475 | rightBottomValue = Number(yxcwValue) + boxHeight; |
| 476 | 476 | rightBottom = "+ dYXCW + W"; |
| 477 | 477 | } else if (yxcwType === "7002" || yxcwType === "7003") { |
| ... | ... | @@ -484,13 +484,13 @@ const BoxDesignCompontent = baseProps => { |
| 484 | 484 | rightBottomValue = boxHeight * 2; |
| 485 | 485 | rightBottom = "+ W * 2"; |
| 486 | 486 | } |
| 487 | - sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (leftBottomValue > rightBottomValue ? leftBottom : rightBottom); | |
| 487 | + sWidthFormula = (leftTopValue > rightTopValue ? leftTop : rightTop) + "D" + (hdzj? ' + dHDC': (leftBottomValue > rightBottomValue ? leftBottom : rightBottom)) ; | |
| 488 | 488 | } else if (boxType && boxType === "2") { |
| 489 | 489 | // 单折 |
| 490 | 490 | const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; |
| 491 | 491 | const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; |
| 492 | 492 | sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L * 2 + W" + (ytbw ? " +dYTBW" : ""); |
| 493 | - if (zxcwType === "4001" || zxcwType === "4006") { | |
| 493 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | |
| 494 | 494 | leftBottomValue = Number(zxcwValue) + boxHeight; |
| 495 | 495 | leftBottom = " + dZXCW + W"; |
| 496 | 496 | } else if (zxcwType === "4002" || zxcwType === "4003") { |
| ... | ... | @@ -503,7 +503,7 @@ const BoxDesignCompontent = baseProps => { |
| 503 | 503 | leftBottomValue = boxHeight * 2; |
| 504 | 504 | leftBottom = "+ W * 2"; |
| 505 | 505 | } |
| 506 | - if (yscwType === "6001" || yscwType === "6006") { | |
| 506 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | |
| 507 | 507 | rightTopValue = Number(yscwValue) + boxHeight; |
| 508 | 508 | rightTop = "dYSCW + W + "; |
| 509 | 509 | } else if (yscwType === "6002" || yscwType === "6003") { |
| ... | ... | @@ -516,7 +516,7 @@ const BoxDesignCompontent = baseProps => { |
| 516 | 516 | rightTopValue = boxHeight * 2; |
| 517 | 517 | rightTop = "W * 2+ "; |
| 518 | 518 | } |
| 519 | - if (zscwType === "3001" || zscwType === "3006") { | |
| 519 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | |
| 520 | 520 | leftTopValue = Number(zscwValue) + boxHeight; |
| 521 | 521 | leftTop = "dZSCW + W +"; |
| 522 | 522 | } else if (zscwType === "3002" || zscwType === "3003") { |
| ... | ... | @@ -529,7 +529,7 @@ const BoxDesignCompontent = baseProps => { |
| 529 | 529 | leftTopValue = boxHeight * 2; |
| 530 | 530 | leftTop = "W * 2 +"; |
| 531 | 531 | } |
| 532 | - if (yxcwType === "7001" || yxcwType === "7006") { | |
| 532 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | |
| 533 | 533 | rightBottomValue = Number(yxcwValue) + boxHeight; |
| 534 | 534 | rightBottom = "+ dYXCW + W"; |
| 535 | 535 | } else if (yxcwType === "7002" || yxcwType === "7003") { |
| ... | ... | @@ -547,7 +547,7 @@ const BoxDesignCompontent = baseProps => { |
| 547 | 547 | const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; |
| 548 | 548 | const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; |
| 549 | 549 | sLengthFormula = (ztbw ? "dZTBW+ " : "") + "L + W * 2" + (ytbw ? " +dYTBW" : ""); |
| 550 | - if (zxcwType === "4001" || zxcwType === "4006") { | |
| 550 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | |
| 551 | 551 | leftBottomValue = Number(zxcwValue) + boxHeight; |
| 552 | 552 | leftBottom = " + dZXCW + W"; |
| 553 | 553 | } else if (zxcwType === "4002" || zxcwType === "4003") { |
| ... | ... | @@ -560,7 +560,7 @@ const BoxDesignCompontent = baseProps => { |
| 560 | 560 | leftBottomValue = boxHeight * 2; |
| 561 | 561 | leftBottom = "+ W * 2"; |
| 562 | 562 | } |
| 563 | - if (yscwType === "6001" || yscwType === "6006") { | |
| 563 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | |
| 564 | 564 | rightTopValue = Number(yscwValue) + boxHeight; |
| 565 | 565 | rightTop = "dYSCW + W + "; |
| 566 | 566 | } else if (yscwType === "6002" || yscwType === "6003") { |
| ... | ... | @@ -573,7 +573,7 @@ const BoxDesignCompontent = baseProps => { |
| 573 | 573 | rightTopValue = boxHeight * 2; |
| 574 | 574 | rightTop = "W * 2+ "; |
| 575 | 575 | } |
| 576 | - if (zscwType === "3001" || zscwType === "3006") { | |
| 576 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | |
| 577 | 577 | leftTopValue = Number(zscwValue) + boxHeight; |
| 578 | 578 | leftTop = "dZSCW + W +"; |
| 579 | 579 | } else if (zscwType === "3002" || zscwType === "3003") { |
| ... | ... | @@ -586,7 +586,7 @@ const BoxDesignCompontent = baseProps => { |
| 586 | 586 | leftTopValue = boxHeight * 2; |
| 587 | 587 | leftTop = "W * 2 +"; |
| 588 | 588 | } |
| 589 | - if (yxcwType === "7001" || yxcwType === "7006") { | |
| 589 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | |
| 590 | 590 | rightBottomValue = Number(yxcwValue) + boxHeight; |
| 591 | 591 | rightBottom = "+ dYXCW + W"; |
| 592 | 592 | } else if (yxcwType === "7002" || yxcwType === "7003") { |
| ... | ... | @@ -618,7 +618,7 @@ const BoxDesignCompontent = baseProps => { |
| 618 | 618 | let rightValue = ""; |
| 619 | 619 | let topValue = ""; |
| 620 | 620 | let bottomValue = ""; |
| 621 | - if (zxcwType === "4001" || zxcwType === "4006") { | |
| 621 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | |
| 622 | 622 | // leftValue = leftValue + Number(zxcwValue) + boxHeight * 2; |
| 623 | 623 | leftValue = "dZXCW + D * 2 +"; |
| 624 | 624 | } else if (zxcwType === "4002" || zxcwType === "4003") { |
| ... | ... | @@ -628,7 +628,7 @@ const BoxDesignCompontent = baseProps => { |
| 628 | 628 | } else if (zxcwType === "4005") { |
| 629 | 629 | leftValue = "D * 3 +"; |
| 630 | 630 | } |
| 631 | - if (yscwType === "6001" || yscwType === "6006") { | |
| 631 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | |
| 632 | 632 | rightValue = "+ dYSCW + D * 2"; |
| 633 | 633 | } else if (yscwType === "6002" || yscwType === "6003") { |
| 634 | 634 | rightValue = "+ dYSCW + D"; |
| ... | ... | @@ -637,7 +637,7 @@ const BoxDesignCompontent = baseProps => { |
| 637 | 637 | } else if (yscwType === "6005") { |
| 638 | 638 | rightValue = " + D * 3"; |
| 639 | 639 | } |
| 640 | - if (zscwType === "3001" || zscwType === "3006") { | |
| 640 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | |
| 641 | 641 | topValue = "dZSCW + D * 2 +"; |
| 642 | 642 | } else if (zscwType === "3002" || zscwType === "3003") { |
| 643 | 643 | topValue = "dZSCW + D +"; |
| ... | ... | @@ -646,7 +646,7 @@ const BoxDesignCompontent = baseProps => { |
| 646 | 646 | } else if (zscwType === "3005") { |
| 647 | 647 | topValue = "D * 3+"; |
| 648 | 648 | } |
| 649 | - if (yxcwType === "7001" || yxcwType === "7006") { | |
| 649 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | |
| 650 | 650 | bottomValue = "+ dYXCW + D * 2"; |
| 651 | 651 | } else if (yxcwType === "7002" || yxcwType === "7003") { |
| 652 | 652 | bottomValue = "+ dYXCW + D "; |
| ... | ... | @@ -664,7 +664,7 @@ const BoxDesignCompontent = baseProps => { |
| 664 | 664 | const ztbw = boxList.find(x => x.sName === "左贴边位")?.type && boxList.find(x => x.sName === "左贴边位")?.value; |
| 665 | 665 | const ytbw = boxList.find(x => x.sName === "右贴边位")?.type && boxList.find(x => x.sName === "右贴边位")?.value; |
| 666 | 666 | sLengthFormula = (ztbw ? "dZTBW+ " : "") + "D * 2 + W * 2" + (ytbw ? " +dYTBW" : ""); |
| 667 | - if (zxcwType === "4001" || zxcwType === "4006") { | |
| 667 | + if (zxcwType === "4001" || zxcwType === "4006" || zxcwType === "4007") { | |
| 668 | 668 | leftBottomValue = Number(zxcwValue) + boxHeight; |
| 669 | 669 | leftBottom = " + dZXCW + D"; |
| 670 | 670 | } else if (zxcwType === "4002" || zxcwType === "4003") { |
| ... | ... | @@ -677,7 +677,7 @@ const BoxDesignCompontent = baseProps => { |
| 677 | 677 | leftBottomValue = boxHeight * 2; |
| 678 | 678 | leftBottom = "+ D * 2"; |
| 679 | 679 | } |
| 680 | - if (yscwType === "6001" || yscwType === "6006") { | |
| 680 | + if (yscwType === "6001" || yscwType === "6006" || yscwType === "6007") { | |
| 681 | 681 | rightTopValue = Number(yscwValue) + boxHeight; |
| 682 | 682 | rightTop = "dYSCW + D + "; |
| 683 | 683 | } else if (yscwType === "6002" || yscwType === "6003") { |
| ... | ... | @@ -690,7 +690,7 @@ const BoxDesignCompontent = baseProps => { |
| 690 | 690 | rightTopValue = boxHeight * 2; |
| 691 | 691 | rightTop = "D * 2+ "; |
| 692 | 692 | } |
| 693 | - if (zscwType === "3001" || zscwType === "3006") { | |
| 693 | + if (zscwType === "3001" || zscwType === "3006" || zscwType === "3007") { | |
| 694 | 694 | leftTopValue = Number(zscwValue) + boxHeight; |
| 695 | 695 | leftTop = "dZSCW + D +"; |
| 696 | 696 | } else if (zscwType === "3002" || zscwType === "3003") { |
| ... | ... | @@ -703,7 +703,7 @@ const BoxDesignCompontent = baseProps => { |
| 703 | 703 | leftTopValue = boxHeight * 2; |
| 704 | 704 | leftTop = "D * 2 +"; |
| 705 | 705 | } |
| 706 | - if (yxcwType === "7001" || yxcwType === "7006") { | |
| 706 | + if (yxcwType === "7001" || yxcwType === "7006" || yxcwType === "7007") { | |
| 707 | 707 | rightBottomValue = Number(yxcwValue) + boxHeight; |
| 708 | 708 | rightBottom = "+ dYXCW + D"; |
| 709 | 709 | } else if (yxcwType === "7002" || yxcwType === "7003") { |
| ... | ... | @@ -729,8 +729,8 @@ const BoxDesignCompontent = baseProps => { |
| 729 | 729 | sName: boxList.find(item => item.sName === "盒型名称")?.value || "", |
| 730 | 730 | sMakeUpPath: boxList.find(item => item.sName === "盒身")?.selectImage || "", |
| 731 | 731 | sTypes: boxList.find(item => item.sName === "盒身")?.type || "", |
| 732 | - sLengthFormula: sLengthFormula, | |
| 733 | - sWidthFormula: sWidthFormula, | |
| 732 | + sLengthFormula: masterData.sLengthFormula || sLengthFormula, | |
| 733 | + sWidthFormula: masterData.sWidthFormula || sWidthFormula, | |
| 734 | 734 | }; |
| 735 | 735 | |
| 736 | 736 | onOk({ slaveData: newSlaveData, masterData: newMasterData }); // 提交数据 | ... | ... |
src/components/Common/BoxProject/index.css
0 → 100644
| 1 | +.boxDesignContent { | |
| 2 | + display: flex; | |
| 3 | + justify-content: space-between; | |
| 4 | + width: 100%; | |
| 5 | + height: 500px; | |
| 6 | + align-items: center; | |
| 7 | +} | |
| 8 | +.boxDesignContent .tabs { | |
| 9 | + width: 30%; | |
| 10 | + height: 100%; | |
| 11 | +} | |
| 12 | +.boxDesignContent .content { | |
| 13 | + width: 70%; | |
| 14 | + display: flex; | |
| 15 | + align-items: center; | |
| 16 | + height: 100%; | |
| 17 | +} | |
| 18 | +.boxDesignContent .content .boxTree { | |
| 19 | + width: 20%; | |
| 20 | + border: 1px solid #00ff55; | |
| 21 | + overflow-y: auto; | |
| 22 | + height: 500px; | |
| 23 | +} | |
| 24 | +.boxDesignContent .content .design { | |
| 25 | + width: 800px; | |
| 26 | + height: 500px; | |
| 27 | + border: 1px solid red; | |
| 28 | + overflow-y: auto; | |
| 29 | + position: relative; | |
| 30 | +} | |
| 31 | +.boxDesignContent .content .design .svgContent { | |
| 32 | + width: 50%; | |
| 33 | + height: 65%; | |
| 34 | + margin: 0 auto; | |
| 35 | + margin-top: 150px; | |
| 36 | +} | |
| 37 | +.boxDesignContent .content .design .svgContent .svgBox { | |
| 38 | + width: 100%; | |
| 39 | + height: 60%; | |
| 40 | + background-color: #00eeff; | |
| 41 | +} | |
| 42 | +.boxDesignContent .content .design .boxTop { | |
| 43 | + display: flex; | |
| 44 | + align-items: center; | |
| 45 | + justify-content: space-between; | |
| 46 | + width: 90%; | |
| 47 | +} | |
| 48 | +.boxDesignContent .content .design .boxTop .boxFlex { | |
| 49 | + display: flex; | |
| 50 | + align-items: center; | |
| 51 | + flex-wrap: wrap; | |
| 52 | + flex-direction: column; | |
| 53 | +} | |
| 54 | +.boxDesignContent .content .design .boxLeft { | |
| 55 | + width: 180px; | |
| 56 | + display: flex; | |
| 57 | + flex-wrap: wrap; | |
| 58 | + flex-direction: column; | |
| 59 | + position: absolute; | |
| 60 | + left: 0; | |
| 61 | + top: 50%; | |
| 62 | +} | |
| 63 | +.boxDesignContent .content .design .boxRight { | |
| 64 | + width: 180px; | |
| 65 | + display: flex; | |
| 66 | + flex-wrap: wrap; | |
| 67 | + flex-direction: column; | |
| 68 | + position: absolute; | |
| 69 | + right: 0; | |
| 70 | + top: 50%; | |
| 71 | +} | |
| 72 | +.svgContainer { | |
| 73 | + width: 100%; | |
| 74 | + height: 100%; | |
| 75 | + object-fit: contain; | |
| 76 | + /* 确保 SVG 保持比例 */ | |
| 77 | +} | ... | ... |
src/components/Common/BoxProject/index.js
0 → 100644
| 1 | +/* eslint-disable */ | |
| 2 | +import React, { Component, useState, useEffect } from "react"; | |
| 3 | +import CommonBase from "../../Common/CommonBase"; /* 获取配置及数据 */ | |
| 4 | +import CommonSales from "../../Common/CommonBillEvent"; /* 继承销售模块业务功能 */ | |
| 5 | +import * as commonFunc from "../../Common/commonFunc"; /* 通用单据方法 */ /* 通用单据方法 */ | |
| 6 | +import { Form } from "@ant-design/compatible"; | |
| 7 | +import { Spin, Tree, Select, Input } from "antd-v4"; | |
| 8 | +import styles from "./index.less"; | |
| 9 | +import { ArrowLeftOutlined, FolderFilled, FolderOpenFilled, FileTextFilled, PlusOutlined, MinusOutlined } from "@ant-design/icons"; | |
| 10 | +import SvgBox from "./svg"; | |
| 11 | +import img1 from "../../../assets/paiban1.png"; | |
| 12 | +class BoxProject extends Component { | |
| 13 | + constructor(props) { | |
| 14 | + super(props); | |
| 15 | + this.state = { | |
| 16 | + boxList: [], | |
| 17 | + }; | |
| 18 | + } | |
| 19 | + // 添加一个方法来更新 boxList | |
| 20 | + updateBoxList = newBoxList => { | |
| 21 | + this.setState({ boxList: newBoxList }); | |
| 22 | + }; | |
| 23 | + render() { | |
| 24 | + const { pageLoading, masterData, fastOrderModalVisible } = this.props; | |
| 25 | + const { boxList } = this.state; | |
| 26 | + return ( | |
| 27 | + <Spin spinning={pageLoading}> | |
| 28 | + <BoxProjectContent {...this.props} boxList={boxList} updateBoxList={this.updateBoxList} /> | |
| 29 | + </Spin> | |
| 30 | + ); | |
| 31 | + } | |
| 32 | +} | |
| 33 | +const BoxProjectContent = Form.create({ | |
| 34 | + mapPropsToFields(props) { | |
| 35 | + const { masterData, masterConfig } = props; | |
| 36 | + const obj = commonFunc.mapPropsToFields(masterData, Form, masterConfig); | |
| 37 | + return obj; | |
| 38 | + }, | |
| 39 | +})(props => { | |
| 40 | + const { updateBoxList, boxList } = props; // 获取父组件传递的更新方法 | |
| 41 | + // 获取树形节点 | |
| 42 | + const treeData = [ | |
| 43 | + { | |
| 44 | + title: "parent 1", | |
| 45 | + key: "0-0", | |
| 46 | + icon: <FolderOpenFilled />, | |
| 47 | + children: [ | |
| 48 | + { | |
| 49 | + title: "leaf", | |
| 50 | + key: "0-0-0", | |
| 51 | + icon: <FileTextFilled />, | |
| 52 | + }, | |
| 53 | + { | |
| 54 | + title: "leaf", | |
| 55 | + key: "0-0-1", | |
| 56 | + icon: ({ selected }) => (selected ? <FileTextFilled /> : <FileTextFilled />), | |
| 57 | + }, | |
| 58 | + ], | |
| 59 | + }, | |
| 60 | + ]; | |
| 61 | + const options = [ | |
| 62 | + { value: null, label: "", image: null }, | |
| 63 | + { value: 0, label: "图片1", image: img1 }, | |
| 64 | + { value: 1, label: "图片2", image: img1 }, | |
| 65 | + // { value: 2, label: "图片3", image: img1 }, | |
| 66 | + ]; | |
| 67 | + // 生成盒型输入框数据并更新到父组件的 state | |
| 68 | + useEffect( | |
| 69 | + () => { | |
| 70 | + let list = []; | |
| 71 | + for (let index = 0; index < 9; index++) { | |
| 72 | + const data = { | |
| 73 | + isEditable: false, | |
| 74 | + value: "", | |
| 75 | + type: null, | |
| 76 | + }; | |
| 77 | + list.push(data); | |
| 78 | + } | |
| 79 | + updateBoxList(list); // 调用父组件的方法更新 boxList | |
| 80 | + }, | |
| 81 | + [updateBoxList] | |
| 82 | + ); | |
| 83 | + | |
| 84 | + const handleFocus = (e, index) => { | |
| 85 | + if (boxList && boxList.length) { | |
| 86 | + const updatedBoxList = [...boxList]; | |
| 87 | + updatedBoxList[index].isEditable = true; | |
| 88 | + updateBoxList(updatedBoxList); | |
| 89 | + } | |
| 90 | + }; | |
| 91 | + | |
| 92 | + const handleBlur = (e, index) => { | |
| 93 | + if (boxList && boxList.length) { | |
| 94 | + const updatedBoxList = [...boxList]; | |
| 95 | + updatedBoxList[index].isEditable = false; | |
| 96 | + updateBoxList(updatedBoxList); | |
| 97 | + } | |
| 98 | + }; | |
| 99 | + | |
| 100 | + const handleChange = (e, index) => { | |
| 101 | + const updatedBoxList = [...boxList]; | |
| 102 | + updatedBoxList[index].value = e.target.value; | |
| 103 | + updateBoxList(updatedBoxList); | |
| 104 | + }; | |
| 105 | + | |
| 106 | + const handleSelect = (name, selectConfig, index) => { | |
| 107 | + const updatedBoxList = [...boxList]; | |
| 108 | + updatedBoxList[index].type = name; | |
| 109 | + updateBoxList(updatedBoxList); | |
| 110 | + }; | |
| 111 | + const titleList = [ | |
| 112 | + "上方盒舌", | |
| 113 | + "盒底组件", | |
| 114 | + "下方盒舌", | |
| 115 | + "左(上)插位组件", | |
| 116 | + "左贴边位", | |
| 117 | + "左(下)插位组件", | |
| 118 | + "右(上)插位组件", | |
| 119 | + "右贴边位", | |
| 120 | + "右(下)插位组件", | |
| 121 | + ]; | |
| 122 | + const svgProps = { | |
| 123 | + ...props, | |
| 124 | + boxList, | |
| 125 | + showNew:0 | |
| 126 | + }; | |
| 127 | + // const renderTreeNodes = data => { | |
| 128 | + // return data.map(item => { | |
| 129 | + // const { showName, children = [], sId } = item; | |
| 130 | + // const treeNodeProps = { | |
| 131 | + // title: showName, | |
| 132 | + // key: sId, | |
| 133 | + // treeNode: item, | |
| 134 | + // selectable: !children.length, | |
| 135 | + // switcherIcon: params => { | |
| 136 | + // const { expanded, isLeaf } = params; | |
| 137 | + // let icon = ""; | |
| 138 | + // if (isLeaf) { | |
| 139 | + // icon = <FileTextFilled style={{ color: "#f7cc4f", fontSize: 20 }} />; | |
| 140 | + // } else if (expanded) { | |
| 141 | + // icon = <FolderOpenFilled style={{ color: "#f7cc4f", fontSize: 20 }} />; | |
| 142 | + // } else { | |
| 143 | + // icon = <FolderFilled style={{ color: "#f7cc4f", fontSize: 20 }} />; | |
| 144 | + // } | |
| 145 | + // return icon; | |
| 146 | + // }, | |
| 147 | + // }; | |
| 148 | + | |
| 149 | + // return <Tree.TreeNode {...treeNodeProps}>{!!children.length && renderTreeNodes(children)}</Tree.TreeNode>; | |
| 150 | + // }); | |
| 151 | + // }; | |
| 152 | + return ( | |
| 153 | + <Form> | |
| 154 | + <div | |
| 155 | + style={{ | |
| 156 | + marginTop: "50px", | |
| 157 | + }} | |
| 158 | + className={styles.boxDesignContent} | |
| 159 | + > | |
| 160 | + <div className={styles.tabs}>111</div> | |
| 161 | + <div className={styles.content}> | |
| 162 | + <div className={styles.boxTree}> | |
| 163 | + <Tree | |
| 164 | + className={"hide-file-icon"} | |
| 165 | + onSelect={(e, select) => { | |
| 166 | + // props.setState(pre => ({ ...pre, selectedNode: select.selectedNodes[0]?.treeNode || {} })); | |
| 167 | + }} | |
| 168 | + // defaultSelectedKeys={[activeTree]} | |
| 169 | + defaultExpandAll={true} | |
| 170 | + selectedKeys={[1]} | |
| 171 | + treeData={treeData} | |
| 172 | + > | |
| 173 | + {/* {renderTreeNodes(treeData)} */} | |
| 174 | + </Tree> | |
| 175 | + </div> | |
| 176 | + <div className={styles.design}> | |
| 177 | + {/* 数值输入 */} | |
| 178 | + {/* 上 */} | |
| 179 | + {boxList && boxList.length ? ( | |
| 180 | + <div className={styles.boxTop}> | |
| 181 | + {Array.from({ length: 3 }).map((_, index) => ( | |
| 182 | + <div key={index} className={styles.boxFlex}> | |
| 183 | + {titleList[index]} | |
| 184 | + <Select | |
| 185 | + optionLabelProp="label" | |
| 186 | + style={{ width: 180 }} | |
| 187 | + defaultValue={options[0].value} | |
| 188 | + onSelect={(value, option) => handleSelect(value, option, index)} | |
| 189 | + > | |
| 190 | + {options.map(item => ( | |
| 191 | + <Option key={item.value} value={item.value} label={item.label}> | |
| 192 | + <div style={{ display: "flex", alignItems: "center" }}> | |
| 193 | + {item.image ? <img src={item.image} alt={item.label} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""} | |
| 194 | + <span>{item.label}</span> | |
| 195 | + </div> | |
| 196 | + </Option> | |
| 197 | + ))} | |
| 198 | + </Select> | |
| 199 | + <div> | |
| 200 | + <div>参数:</div> | |
| 201 | + <Input | |
| 202 | + value={boxList[index]?.value} | |
| 203 | + onChange={e => handleChange(e, index)} | |
| 204 | + onFocus={e => handleFocus(e, index)} | |
| 205 | + onBlur={e => handleBlur(e, index)} | |
| 206 | + readOnly={!boxList[index]?.isEditable} | |
| 207 | + style={{ width: 180 }} | |
| 208 | + /> | |
| 209 | + </div> | |
| 210 | + </div> | |
| 211 | + ))} | |
| 212 | + </div> | |
| 213 | + ) : ( | |
| 214 | + "" | |
| 215 | + )} | |
| 216 | + | |
| 217 | + {/* 左 */} | |
| 218 | + {boxList && boxList.length ? ( | |
| 219 | + <div className={styles.boxLeft}> | |
| 220 | + {Array.from({ length: 3 }, (_, i) => i + 3).map(index => ( | |
| 221 | + <div key={index} className={styles.boxFlex}> | |
| 222 | + {titleList[index]} | |
| 223 | + <Select | |
| 224 | + optionLabelProp="label" | |
| 225 | + style={{ width: 180 }} | |
| 226 | + defaultValue={options[0].value} | |
| 227 | + onSelect={(value, option) => handleSelect(value, option, index)} | |
| 228 | + > | |
| 229 | + {options.map(item => ( | |
| 230 | + <Option key={item.value} value={item.value} label={item.label}> | |
| 231 | + <div style={{ display: "flex", alignItems: "center" }}> | |
| 232 | + {item.image ? <img src={item.image} alt={item.label} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""} | |
| 233 | + <span>{item.label}</span> | |
| 234 | + </div> | |
| 235 | + </Option> | |
| 236 | + ))} | |
| 237 | + </Select> | |
| 238 | + <div> | |
| 239 | + <div>参数:</div> | |
| 240 | + <Input | |
| 241 | + value={boxList[index]?.value} | |
| 242 | + onChange={e => handleChange(e, index)} | |
| 243 | + onFocus={e => handleFocus(e, index)} | |
| 244 | + onBlur={e => handleBlur(e, index)} | |
| 245 | + readOnly={!boxList[index]?.isEditable} | |
| 246 | + style={{ width: 180 }} | |
| 247 | + /> | |
| 248 | + </div> | |
| 249 | + </div> | |
| 250 | + ))} | |
| 251 | + </div> | |
| 252 | + ) : ( | |
| 253 | + "" | |
| 254 | + )} | |
| 255 | + {/* 右 */} | |
| 256 | + {boxList && boxList.length ? ( | |
| 257 | + <div className={styles.boxRight}> | |
| 258 | + {Array.from({ length: 3 }, (_, i) => i + 6).map(index => ( | |
| 259 | + <div key={index} className={styles.boxFlex}> | |
| 260 | + {titleList[index]} | |
| 261 | + <Select | |
| 262 | + optionLabelProp="label" | |
| 263 | + style={{ width: 180 }} | |
| 264 | + defaultValue={options[0].value} | |
| 265 | + onSelect={(value, option) => handleSelect(value, option, index)} | |
| 266 | + > | |
| 267 | + {options.map(item => ( | |
| 268 | + <Option key={item.value} value={item.value} label={item.label}> | |
| 269 | + <div style={{ display: "flex", alignItems: "center" }}> | |
| 270 | + {item.image ? <img src={item.image} alt={item.label} style={{ width: 24, height: 24, marginRight: 8 }} /> : ""} | |
| 271 | + <span>{item.label}</span> | |
| 272 | + </div> | |
| 273 | + </Option> | |
| 274 | + ))} | |
| 275 | + </Select> | |
| 276 | + <div> | |
| 277 | + <div>参数:</div> | |
| 278 | + <Input | |
| 279 | + value={boxList[index]?.value} | |
| 280 | + onChange={e => handleChange(e, index)} | |
| 281 | + onFocus={e => handleFocus(e, index)} | |
| 282 | + onBlur={e => handleBlur(e, index)} | |
| 283 | + readOnly={!boxList[index]?.isEditable} | |
| 284 | + style={{ width: 180 }} | |
| 285 | + /> | |
| 286 | + </div> | |
| 287 | + </div> | |
| 288 | + ))} | |
| 289 | + </div> | |
| 290 | + ) : ( | |
| 291 | + "" | |
| 292 | + )} | |
| 293 | + <SvgConten {...svgProps} /> | |
| 294 | + </div> | |
| 295 | + </div> | |
| 296 | + </div> | |
| 297 | + </Form> | |
| 298 | + ); | |
| 299 | +}); | |
| 300 | + | |
| 301 | +const SvgConten = props => { | |
| 302 | + const [length, setLength] = useState(0); | |
| 303 | + const [width, setWidth] = useState(0); | |
| 304 | + const [height, setHeight] = useState(0); | |
| 305 | + const handleChange = (e, index) => { | |
| 306 | + if (index === 0) { | |
| 307 | + setLength(e.target.value); | |
| 308 | + } else if (index === 1) { | |
| 309 | + setWidth(e.target.value); | |
| 310 | + } else { | |
| 311 | + setHeight(e.target.value); | |
| 312 | + } | |
| 313 | + }; | |
| 314 | + const svgBoxProps = { | |
| 315 | + ...props, | |
| 316 | + boxSize:{ | |
| 317 | + length, | |
| 318 | + width, | |
| 319 | + height | |
| 320 | + } | |
| 321 | + } | |
| 322 | + return ( | |
| 323 | + <div className={styles.svgContent}> | |
| 324 | + <div className={styles.svgBox}> | |
| 325 | + <SvgBox {...svgBoxProps} /> | |
| 326 | + <div> | |
| 327 | + 盒长 | |
| 328 | + <Input value={length} style={{ width: 180 }} onChange={e => handleChange(e, 0)} /> | |
| 329 | + </div> | |
| 330 | + <div> | |
| 331 | + 盒宽 | |
| 332 | + <Input value={width} style={{ width: 180 }} onChange={e => handleChange(e, 1)} /> | |
| 333 | + </div> | |
| 334 | + <div> | |
| 335 | + 盒高 | |
| 336 | + <Input value={height} style={{ width: 180 }} onChange={e => handleChange(e, 2)} /> | |
| 337 | + </div> | |
| 338 | + </div> | |
| 339 | + </div> | |
| 340 | + ); | |
| 341 | +}; | |
| 342 | +export default CommonBase(CommonSales(BoxProject)); | ... | ... |
src/components/Common/BoxProject/index.less
0 → 100644
| 1 | +.boxDesignContent { | |
| 2 | + display: flex; | |
| 3 | + justify-content: space-between; | |
| 4 | + width: 100%; | |
| 5 | + height: 500px; | |
| 6 | + align-items: center; | |
| 7 | + .tabs { | |
| 8 | + width: 30%; | |
| 9 | + height: 100%; | |
| 10 | + } | |
| 11 | + .content { | |
| 12 | + width: 70%; | |
| 13 | + display: flex; | |
| 14 | + align-items: center; | |
| 15 | + height: 100%; | |
| 16 | + .boxTree { | |
| 17 | + width: 20%; | |
| 18 | + border: 1px solid rgb(0, 255, 85); | |
| 19 | + overflow-y: auto; | |
| 20 | + height: 500px; | |
| 21 | + } | |
| 22 | + .design { | |
| 23 | + width: 800px; | |
| 24 | + height: 500px; | |
| 25 | + border: 1px solid red; | |
| 26 | + overflow-y: auto; | |
| 27 | + position: relative; | |
| 28 | + .svgContent { | |
| 29 | + width: 50%; | |
| 30 | + height: 65%; | |
| 31 | + margin: 0 auto; | |
| 32 | + margin-top: 150px; | |
| 33 | + .svgBox { | |
| 34 | + width: 100%; | |
| 35 | + height: 60%; | |
| 36 | + background-color: rgb(0, 238, 255); | |
| 37 | + } | |
| 38 | + } | |
| 39 | + .boxTop { | |
| 40 | + display: flex; | |
| 41 | + align-items: center; | |
| 42 | + justify-content: space-between; | |
| 43 | + width: 90%; | |
| 44 | + .boxFlex { | |
| 45 | + display: flex; | |
| 46 | + align-items: center; | |
| 47 | + flex-wrap: wrap; | |
| 48 | + flex-direction: column; | |
| 49 | + } | |
| 50 | + } | |
| 51 | + .boxLeft { | |
| 52 | + width: 180px; | |
| 53 | + display: flex; | |
| 54 | + flex-wrap: wrap; | |
| 55 | + flex-direction: column; | |
| 56 | + position: absolute; | |
| 57 | + left: 0; | |
| 58 | + top: 50%; | |
| 59 | + } | |
| 60 | + .boxRight { | |
| 61 | + width: 180px; | |
| 62 | + display: flex; | |
| 63 | + flex-wrap: wrap; | |
| 64 | + flex-direction: column; | |
| 65 | + position: absolute; | |
| 66 | + right: 0; | |
| 67 | + top: 50%; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + } | |
| 71 | +} | |
| 72 | +.svgContainer { | |
| 73 | + width: 100%; | |
| 74 | + height: 100%; | |
| 75 | + object-fit: contain; /* 确保 SVG 保持比例 */ | |
| 76 | +} | |
| 77 | + | ... | ... |
src/components/Common/BoxProject/svg.js
0 → 100644
| 1 | +/* eslint-disable */ | |
| 2 | +import React, { useRef, useState, useEffect } from "react"; | |
| 3 | +import styles from "./index.less"; | |
| 4 | +import { | |
| 5 | + createPathElement, | |
| 6 | + createTopTongue, | |
| 7 | + createTopTongueType1, | |
| 8 | + createTrapezoid, | |
| 9 | + createDynamicTop, | |
| 10 | + createNoneProject, | |
| 11 | +} from "../BoxDesign/createAirplaneBox"; | |
| 12 | +const SvgBox = props => { | |
| 13 | + console.log("🚀 ~ propsprops:", props); | |
| 14 | + const svgContainerRef = useRef(null); | |
| 15 | + const svgRef = useRef(null); | |
| 16 | + const [boxKey, setBoxKey] = useState(new Date().getTime()); | |
| 17 | + const { boxList, boxSize } = props; | |
| 18 | + | |
| 19 | + // 盒身 | |
| 20 | + useEffect( | |
| 21 | + () => { | |
| 22 | + initSVG(); | |
| 23 | + }, | |
| 24 | + [boxList, boxSize] | |
| 25 | + ); | |
| 26 | + // 初始化svg | |
| 27 | + const initSVG = () => { | |
| 28 | + const svg = svgRef.current; | |
| 29 | + svg.innerHTML = ""; | |
| 30 | + // const {svgType} = props | |
| 31 | + const svgType = 0; | |
| 32 | + // 获取长宽高 | |
| 33 | + const width = Number(boxSize?.length); | |
| 34 | + const height = Number(boxSize?.width); | |
| 35 | + const deep = Number(boxSize?.height); | |
| 36 | + console.log(boxList, "boxLists"); | |
| 37 | + | |
| 38 | + let pathList = []; | |
| 39 | + // 判断盒型类型 根据不同盒型展示不同的盒身 0 四面盒身 | |
| 40 | + if (svgType === 0) { | |
| 41 | + const rectangles = [ | |
| 42 | + { x: 0, y: 0, width, height }, | |
| 43 | + { x: 0 + width, y: 0, width: deep, height }, | |
| 44 | + { x: 0 + deep + width, y: 0, width, height }, | |
| 45 | + { x: 0 + width * 2 + deep, y: 0, width: deep, height }, | |
| 46 | + ]; | |
| 47 | + rectangles.forEach(rect => { | |
| 48 | + svg.appendChild(createPathElement(rect.x, rect.y, rect.width, rect.height)); | |
| 49 | + }); | |
| 50 | + // 处理部件 | |
| 51 | + // 上方盒舌 | |
| 52 | + pathList.push(createUpperBoxTongueLeft(boxList[0]?.type, width, height, deep, Number(boxList[0]?.value), width, 0, 2, -2, 1, 5)); | |
| 53 | + // 下边盒舌 | |
| 54 | + pathList.push(createUpperBoxTongueRight(boxList[0]?.type, width, height, deep, Number(boxList[0]?.value), width * 2 + deep * 2, 0, -2, 5)); | |
| 55 | + // 左边贴边 | |
| 56 | + pathList.push(createTrapezoidLeft(boxList[4]?.type, height, 0, 0, Number(boxList[4]?.value))); | |
| 57 | + // 右边贴边 | |
| 58 | + pathList.push(createTrapezoidRight(boxList[7]?.type, height, width * 2 + deep * 2, 0, -Number(boxList[7]?.value))); | |
| 59 | + // 下边舌 | |
| 60 | + pathList.push(createUpperBoxTongueLeft(boxList[2]?.type, width, height, deep, -Number(boxList[2]?.value), width, height, 2, 2, 0, -5)); | |
| 61 | + pathList.push( | |
| 62 | + createUpperBoxTongueRight(boxList[2]?.type, width, height, deep, -Number(boxList[2]?.value), width * 2 + deep * 2, height, -2, 2, 1, -5) | |
| 63 | + ); | |
| 64 | + // 左上部件 | |
| 65 | + pathList.push(createDynamicTopLeft(boxList[3]?.type, width, height, deep, 0, 0, Number(boxList[3]?.value))); | |
| 66 | + // 右上部件 | |
| 67 | + pathList.push(createDynamicTopRight(boxList[6]?.type, width, height, deep, width + deep, 0, Number(boxList[6]?.value))); | |
| 68 | + // 左下部件 | |
| 69 | + pathList.push(createDynamicTopLeft(boxList[5]?.type, width, height, -deep, 0, height, -Number(boxList[5]?.value))); | |
| 70 | + // 右下部件 | |
| 71 | + pathList.push(createDynamicTopRight(boxList[8]?.type, width, height, -deep, width + deep, height, -Number(boxList[8]?.value))); | |
| 72 | + // 盒底组件 | |
| 73 | + pathList.push(createBoxBottomComponent(0)); | |
| 74 | + pathList.forEach(x => { | |
| 75 | + svg.appendChild(x); | |
| 76 | + }); | |
| 77 | + } | |
| 78 | + // 计算展长展宽 还需要加上贴边 | |
| 79 | + const viewBoxWidth = (width * 2 + deep * 2) * 1.5; | |
| 80 | + // 要判断是否有上下部件 | |
| 81 | + let max = 0; | |
| 82 | + if (boxList[0]?.value && boxList[0]?.type !== null) { | |
| 83 | + max = Number(boxList[0].value); | |
| 84 | + } | |
| 85 | + const targetIndicesSh = [0, 2]; | |
| 86 | + const targetIndices = [3, 5, 6, 8]; | |
| 87 | + if (boxList && boxList.length) { | |
| 88 | + const filterShData = targetIndicesSh.map(index => boxList[index]).filter(item => item.type !== null && item.value !== ""); | |
| 89 | + const filteredData = targetIndices.map(index => boxList[index]).filter(item => item.type !== null && item.value !== ""); | |
| 90 | + if (filterShData && filterShData.length) { | |
| 91 | + max = Math.max(...filterShData.map(item => Number(item.value))) ; | |
| 92 | + } | |
| 93 | + if (filteredData && filteredData.length) { | |
| 94 | + max = Math.max(...filteredData.map(item => Number(item.value))) * 3; | |
| 95 | + } | |
| 96 | + } | |
| 97 | + const viewBoxHeight = (height + max) * 2; | |
| 98 | + // 更新 SVG 的 viewBox 和尺寸 | |
| 99 | + const svgContainer = svgContainerRef.current; | |
| 100 | + svg.setAttribute("viewBox", `${-viewBoxWidth * 0.1} ${-viewBoxHeight * 0.3} ${viewBoxWidth} ${viewBoxHeight}`); | |
| 101 | + svg.setAttribute("width", `${viewBoxWidth}px`); | |
| 102 | + svg.setAttribute("height", `${viewBoxHeight}px`); | |
| 103 | + // svgContainer.style.width = `${viewBoxWidth}px`; | |
| 104 | + // svgContainer.style.height = `${viewBoxHeight}px`; | |
| 105 | + }; | |
| 106 | + // 上方盒舌左边 | |
| 107 | + const createUpperBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 108 | + if (!size) return createNoneProject(); | |
| 109 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 110 | + let data = {}; | |
| 111 | + switch (upperBoxTongueType) { | |
| 112 | + case 0: | |
| 113 | + data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2); | |
| 114 | + break; | |
| 115 | + case 1: | |
| 116 | + data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2); | |
| 117 | + break; | |
| 118 | + default: | |
| 119 | + data = createNoneProject(); | |
| 120 | + break; | |
| 121 | + } | |
| 122 | + return data; | |
| 123 | + }; | |
| 124 | + // 右上方盒舌 | |
| 125 | + const createUpperBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 126 | + if (!size) return createNoneProject(); | |
| 127 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 128 | + let data = {}; | |
| 129 | + switch (upperBoxTongueType) { | |
| 130 | + case 0: | |
| 131 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 132 | + break; | |
| 133 | + case 1: | |
| 134 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 135 | + break; | |
| 136 | + default: | |
| 137 | + data = createNoneProject(); | |
| 138 | + break; | |
| 139 | + } | |
| 140 | + return data; | |
| 141 | + }; | |
| 142 | + // 右上方盒舌 | |
| 143 | + const createBottomBoxTongueRight = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 144 | + if (!size) return createNoneProject(); | |
| 145 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 146 | + let data = {}; | |
| 147 | + switch (upperBoxTongueType) { | |
| 148 | + case 0: | |
| 149 | + data = createTopTongue(-deep, offsetX, offsetY, size, -2, 5, 0, true); | |
| 150 | + break; | |
| 151 | + case 1: | |
| 152 | + data = createTopTongueType1(-deep, offsetX, offsetY, -size, -3, -2); | |
| 153 | + break; | |
| 154 | + default: | |
| 155 | + data = createNoneProject(); | |
| 156 | + break; | |
| 157 | + } | |
| 158 | + return data; | |
| 159 | + }; | |
| 160 | + const createBottomBoxTongueLeft = (upperBoxTongueType, width, height, deep, size, offsetX, offsetY) => { | |
| 161 | + if (!size) return createNoneProject(); | |
| 162 | + // 根据不同类型创建不同形状的盒舌 upperBoxTongueType 如果null则返回 | |
| 163 | + let data = {}; | |
| 164 | + switch (upperBoxTongueType) { | |
| 165 | + case 0: | |
| 166 | + data = createTopTongue(deep, offsetX, offsetY, size, 2, 5, 1, false); | |
| 167 | + break; | |
| 168 | + case 1: | |
| 169 | + data = createTopTongueType1(deep, offsetX, offsetY, -size, 3, 2); | |
| 170 | + break; | |
| 171 | + default: | |
| 172 | + data = createNoneProject(); | |
| 173 | + break; | |
| 174 | + } | |
| 175 | + return data; | |
| 176 | + }; | |
| 177 | + | |
| 178 | + // 左边贴位 | |
| 179 | + const createTrapezoidLeft = (trapezoidLeftType, height, offsetX, offsetY, dg) => { | |
| 180 | + if (!dg) return createNoneProject(); | |
| 181 | + let data = {}; | |
| 182 | + switch (trapezoidLeftType) { | |
| 183 | + case 0: | |
| 184 | + data = createTrapezoid(height, offsetX, offsetY, dg); | |
| 185 | + break; | |
| 186 | + case 1: | |
| 187 | + break; | |
| 188 | + default: | |
| 189 | + data = createNoneProject(); | |
| 190 | + break; | |
| 191 | + } | |
| 192 | + return data; | |
| 193 | + }; | |
| 194 | + // 右边贴位 | |
| 195 | + const createTrapezoidRight = (trapezoidLeftType, height, offsetX, offsetY, dg) => { | |
| 196 | + if (!dg) return createNoneProject(); | |
| 197 | + let data = {}; | |
| 198 | + switch (trapezoidLeftType) { | |
| 199 | + case 0: | |
| 200 | + data = createTrapezoid(height, offsetX, offsetY, dg); | |
| 201 | + break; | |
| 202 | + case 1: | |
| 203 | + break; | |
| 204 | + default: | |
| 205 | + data = createNoneProject(); | |
| 206 | + break; | |
| 207 | + } | |
| 208 | + return data; | |
| 209 | + }; | |
| 210 | + // 左上部件 | |
| 211 | + const createDynamicTopLeft = (trapezoidLeftType, width, height, deep, offsetX, offsetY, size) => { | |
| 212 | + if (!size) return createNoneProject(); | |
| 213 | + let data = {}; | |
| 214 | + switch (trapezoidLeftType) { | |
| 215 | + case 0: | |
| 216 | + data = createDynamicTop(width, height, deep, offsetX, offsetY, size); | |
| 217 | + break; | |
| 218 | + case 1: | |
| 219 | + break; | |
| 220 | + default: | |
| 221 | + data = createNoneProject(); | |
| 222 | + break; | |
| 223 | + } | |
| 224 | + return data; | |
| 225 | + }; | |
| 226 | + // 右上部件 | |
| 227 | + const createDynamicTopRight = (trapezoidLeftType, width, height, deep, offsetX, offsetY, size) => { | |
| 228 | + if (!size) return createNoneProject(); | |
| 229 | + let data = {}; | |
| 230 | + switch (trapezoidLeftType) { | |
| 231 | + case 0: | |
| 232 | + data = createDynamicTop(width, height, deep, offsetX, offsetY, size); | |
| 233 | + break; | |
| 234 | + case 1: | |
| 235 | + break; | |
| 236 | + default: | |
| 237 | + data = createNoneProject(); | |
| 238 | + break; | |
| 239 | + } | |
| 240 | + return data; | |
| 241 | + }; | |
| 242 | + // 盒底组件 特殊的盒底组件 | |
| 243 | + const createBoxBottomComponent = trapezoidLeftType => { | |
| 244 | + let data = {}; | |
| 245 | + switch (trapezoidLeftType) { | |
| 246 | + case 0: | |
| 247 | + data = createNoneProject(); | |
| 248 | + break; | |
| 249 | + case 1: | |
| 250 | + break; | |
| 251 | + default: | |
| 252 | + data = createNoneProject(); | |
| 253 | + break; | |
| 254 | + } | |
| 255 | + return data; | |
| 256 | + }; | |
| 257 | + return ( | |
| 258 | + <div | |
| 259 | + id="svgContainer" | |
| 260 | + key={boxKey} | |
| 261 | + ref={svgContainerRef} | |
| 262 | + style={{ | |
| 263 | + width: "100%", | |
| 264 | + height: "100%", | |
| 265 | + }} | |
| 266 | + > | |
| 267 | + <svg | |
| 268 | + className={styles.svgContainer} | |
| 269 | + id="dynamicSvg" | |
| 270 | + xmlns="http://www.w3.org/2000/svg" | |
| 271 | + ref={svgRef} | |
| 272 | + viewBox="0 -150 400 300" | |
| 273 | + preserveAspectRatio="xMidYMid meet" | |
| 274 | + width="100%" | |
| 275 | + height="100%" | |
| 276 | + /> | |
| 277 | + </div> | |
| 278 | + ); | |
| 279 | +}; | |
| 280 | + | |
| 281 | +export default SvgBox; | ... | ... |
src/components/Common/BoxShowImgMaterial/index.less
src/components/Common/BoxShowImgMaterial/indexNew.js
| ... | ... | @@ -38,7 +38,6 @@ const BoxShowImgMaterial = props => { |
| 38 | 38 | width: `${dMachineLength}px`, |
| 39 | 39 | height: `${dMachineWidth}px`, |
| 40 | 40 | backgroundColor: "#b7e0ff", |
| 41 | - border: "1px soild #333", | |
| 42 | 41 | position: "relative", |
| 43 | 42 | }} |
| 44 | 43 | > |
| ... | ... | @@ -171,7 +170,7 @@ const BoxShowImgMaterial = props => { |
| 171 | 170 | ).toFixed(2); |
| 172 | 171 | useEffect( |
| 173 | 172 | () => { |
| 174 | - // setBoxKey(new Date().getTime()); | |
| 173 | + setBoxKey(new Date().getTime()); | |
| 175 | 174 | setTimeout(() => { |
| 176 | 175 | // if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) |
| 177 | 176 | if (boxRef.current && textRef.current && textRefs.current && nTextRef.current && nTextRefs.current) { | ... | ... |
src/components/Common/CheckModel.js
0 → 100644
| 1 | +/* eslint-disable array-callback-return,no-undef */ | |
| 2 | +import React, { Component } from 'react'; | |
| 3 | +import { Table, Button, Checkbox, Input, message } from 'antd-v4'; | |
| 4 | +import config from '@/utils/config'; | |
| 5 | +import styles from '@/index.less'; | |
| 6 | +import AntdDraggableModal from '@/components/Common/AntdDraggableModal'; | |
| 7 | + | |
| 8 | +const InputGroup = Input.Group; | |
| 9 | +const { TextArea } = Input; | |
| 10 | + | |
| 11 | +class CheckModel extends Component { | |
| 12 | + constructor(props) { | |
| 13 | + super(props); | |
| 14 | + this.state = { | |
| 15 | + visible: props.visible, | |
| 16 | + sActiveId: props.sActiveId, /* 窗体Id */ | |
| 17 | + sReturnMessage: props.sReturnMessage, | |
| 18 | + sCheckModelId: props.sCheckModelId, | |
| 19 | + loading: false, | |
| 20 | + data: [], | |
| 21 | + dataPerson: [], | |
| 22 | + listVisible: false, | |
| 23 | + inputValue: '', | |
| 24 | + checkDisplay: '', | |
| 25 | + checked: '', | |
| 26 | + sTbName: props.sTbName, | |
| 27 | + sBillKey: props.sBillKey, | |
| 28 | + sBillNo: props.sBillNo, | |
| 29 | + sCheckMemo: '', | |
| 30 | + }; | |
| 31 | + this.header = {}; | |
| 32 | + } | |
| 33 | + | |
| 34 | + | |
| 35 | + componentWillMount() { | |
| 36 | + const { systemData } = this.props.app; | |
| 37 | + const ckxTmpCheck = systemData.filter(item => (item.sName === 'CkxTmpCheck'))[0]; | |
| 38 | + const checkDisplay = ckxTmpCheck.sValue === '0' ? 'none' : 'block'; | |
| 39 | + this.setState({ checkDisplay }); | |
| 40 | + } | |
| 41 | + | |
| 42 | + | |
| 43 | + componentWillReceiveProps(nextProps) { | |
| 44 | + const { gdsformconst, sReturnMessage, sBillNo } = nextProps; | |
| 45 | + if (sReturnMessage.length > 0) { | |
| 46 | + const data = []; | |
| 47 | + sReturnMessage.forEach((child, i) => { | |
| 48 | + const sName = child.split('-'); | |
| 49 | + data.push({ | |
| 50 | + key: i, | |
| 51 | + condition: sName[0], | |
| 52 | + sMemo: sName[1], | |
| 53 | + }); | |
| 54 | + }); | |
| 55 | + this.setState({ data, sBillNo }); | |
| 56 | + } | |
| 57 | + const checkCondition = gdsformconst.filter(item => (item.sName === 'checkCondition')); | |
| 58 | + const checkSmemo = gdsformconst.filter(item => (item.sName === 'checkSmemo')); | |
| 59 | + const checkUserId = gdsformconst.filter(item => (item.sName === 'checkUserId')); | |
| 60 | + const checkUserName = gdsformconst.filter(item => (item.sName === 'checkUserName')); | |
| 61 | + if (checkCondition.length > 0) { | |
| 62 | + this.header.checkCondition = checkCondition[0].showName; | |
| 63 | + } | |
| 64 | + if (checkSmemo.length > 0) { | |
| 65 | + this.header.checkSmemo = checkSmemo[0].showName; | |
| 66 | + } | |
| 67 | + if (checkUserId.length > 0) { | |
| 68 | + this.header.checkUserId = checkUserId[0].showName; | |
| 69 | + } | |
| 70 | + if (checkUserName.length > 0) { | |
| 71 | + this.header.checkUserName = checkUserName[0].showName; | |
| 72 | + } | |
| 73 | + this.setState({ | |
| 74 | + visible: nextProps.visible, | |
| 75 | + sCheckModelId: nextProps.sCheckModelId, | |
| 76 | + sReturnMessage: nextProps.sReturnMessage, | |
| 77 | + }); | |
| 78 | + } | |
| 79 | + /* 取消 */ | |
| 80 | + handleCancel = () => { | |
| 81 | + this.setState({ visible: false }); | |
| 82 | + } | |
| 83 | + | |
| 84 | + handleChange = (e) => { | |
| 85 | + this.setState({ checked: e.target.checked, sCheckMemo: e.target.value }); | |
| 86 | + } | |
| 87 | + | |
| 88 | + handleOk = () => { | |
| 89 | + const { | |
| 90 | + checked, sCheckModelId, sTbName, sBillKey, sBillNo, sReturnMessage, dataPerson, sCheckMemo, | |
| 91 | + } = this.state; | |
| 92 | + const { sActiveId } = this.state; | |
| 93 | + const { token } = this.props.app; | |
| 94 | + const url = `${config.server_host}business/doExamine?sModelsId=${sActiveId}`; | |
| 95 | + if (checked === true) { | |
| 96 | + const paramsMap = { | |
| 97 | + iFlag: 1, | |
| 98 | + iTmpCheck: 1, | |
| 99 | + sFormGuid: sActiveId, | |
| 100 | + sGuid: this.props.app.currentPane.checkedId, | |
| 101 | + }; | |
| 102 | + const value = { | |
| 103 | + sClientType: '1', | |
| 104 | + sProName: sBillKey, | |
| 105 | + paramsMap, | |
| 106 | + }; | |
| 107 | + const options = { | |
| 108 | + method: 'POST', | |
| 109 | + headers: { | |
| 110 | + 'Content-Type': 'application/json', | |
| 111 | + authorization: token, | |
| 112 | + }, | |
| 113 | + body: JSON.stringify(value), | |
| 114 | + }; | |
| 115 | + fetch(url, options).then(response => response.json()).then((json) => { | |
| 116 | + if (json.code === 1) { | |
| 117 | + message.success(json.msg); | |
| 118 | + } else { | |
| 119 | + message.error(json.msg); | |
| 120 | + } | |
| 121 | + }); | |
| 122 | + } else { | |
| 123 | + let dataPersonString = ''; | |
| 124 | + for (const item of dataPerson) { | |
| 125 | + dataPersonString = `${dataPersonString},${item.userId}`; | |
| 126 | + } | |
| 127 | + dataPersonString = dataPersonString.substring(1); | |
| 128 | + const paramsMap = { | |
| 129 | + sFormGuid: sActiveId, | |
| 130 | + sBillKey, | |
| 131 | + sTbName, | |
| 132 | + sGuid: this.props.app.currentPane.checkedId, | |
| 133 | + sBillNo, | |
| 134 | + sCheckCondition: sReturnMessage, | |
| 135 | + sMemo: sCheckMemo, | |
| 136 | + sCheckModelGuid: sCheckModelId, | |
| 137 | + sCheckPerson: dataPersonString, | |
| 138 | + }; | |
| 139 | + | |
| 140 | + const value = { | |
| 141 | + sClientType: '1', | |
| 142 | + sProName: 'Sp_System_AutoSendCheckMsg', | |
| 143 | + paramsMap, | |
| 144 | + }; | |
| 145 | + const options = { | |
| 146 | + method: 'POST', | |
| 147 | + headers: { | |
| 148 | + 'Content-Type': 'application/json', | |
| 149 | + authorization: token, | |
| 150 | + }, | |
| 151 | + body: JSON.stringify(value), | |
| 152 | + }; | |
| 153 | + fetch(url, options).then(response => response.json()).then((json) => { | |
| 154 | + if (json.code === 1) { | |
| 155 | + message.success(json.msg); | |
| 156 | + } else { | |
| 157 | + message.error(json.msg); | |
| 158 | + } | |
| 159 | + }); | |
| 160 | + } | |
| 161 | + this.setState({ visible: false }); | |
| 162 | + }; | |
| 163 | + | |
| 164 | + handlePpopUp = () => { | |
| 165 | + const { sCheckModelId } = this.props; | |
| 166 | + const { sActiveId } = this.state; | |
| 167 | + const { token } = this.props.app; | |
| 168 | + const url = `${config.server_host}checkModel/getUserListByModelId/${sCheckModelId}?sModelsId=${sActiveId}`; | |
| 169 | + const options = { | |
| 170 | + method: 'GET', | |
| 171 | + headers: { | |
| 172 | + 'Content-Type': 'application/json', | |
| 173 | + authorization: token, | |
| 174 | + }, | |
| 175 | + }; | |
| 176 | + fetch(url, options).then(response => response.json()).then((json) => { | |
| 177 | + const { dataPerson } = this.state; | |
| 178 | + if (json.code === 1) { | |
| 179 | + const { rows } = json.dataset; | |
| 180 | + rows.forEach((child) => { | |
| 181 | + dataPerson.push({ | |
| 182 | + key: child.sUserId, | |
| 183 | + userId: child.sUserId, | |
| 184 | + UserName: child.sUserName, | |
| 185 | + }); | |
| 186 | + }); | |
| 187 | + this.setState({ dataPerson }); | |
| 188 | + message.success(json.msg); | |
| 189 | + } else { | |
| 190 | + message.error(json.msg); | |
| 191 | + } | |
| 192 | + }); | |
| 193 | + this.setState({ listVisible: true }); | |
| 194 | + }; | |
| 195 | + | |
| 196 | + handleDoubleClick = (record) => { | |
| 197 | + this.setState({ inputValue: record.UserName, listVisible: false }); | |
| 198 | + }; | |
| 199 | + | |
| 200 | + render() { | |
| 201 | + const { loading } = this.state; | |
| 202 | + const { | |
| 203 | + visible, data, listVisible, dataPerson, inputValue, | |
| 204 | + } = this.state; | |
| 205 | + const columns = [{ | |
| 206 | + title: this.header.checkCondition !== undefined ? this.header.checkCondition : '审核条件', | |
| 207 | + dataIndex: 'condition', | |
| 208 | + key: 'condition', | |
| 209 | + }, { | |
| 210 | + title: this.header.checkSmemo !== undefined ? this.header.checkSmemo : '备注', | |
| 211 | + dataIndex: 'sMemo', | |
| 212 | + key: 'sMemo', | |
| 213 | + }]; | |
| 214 | + const columnsPerson = [{ | |
| 215 | + title: this.header.checkUserId !== undefined ? this.header.checkUserId : '人员编号', | |
| 216 | + dataIndex: 'userId', | |
| 217 | + key: 'userId', | |
| 218 | + }, { | |
| 219 | + title: this.header.checkUserName !== undefined ? this.header.checkUserName : '人员名称', | |
| 220 | + dataIndex: 'UserName', | |
| 221 | + key: 'UserName', | |
| 222 | + }]; | |
| 223 | + return ( | |
| 224 | + <div> | |
| 225 | + { | |
| 226 | + visible ? | |
| 227 | + <AntdDraggableModal | |
| 228 | + zIndex={999} | |
| 229 | + visible={visible} | |
| 230 | + title="审核" | |
| 231 | + onCancel={this.handleCancel} | |
| 232 | + footer={[ | |
| 233 | + <Button key="back" onClick={this.handleCancel}>关闭</Button>, | |
| 234 | + <Button key="submit" type="primary" loading={loading} onClick={this.handleOk}> | |
| 235 | + 确定 | |
| 236 | + </Button>, | |
| 237 | + ]} | |
| 238 | + > | |
| 239 | + <Table columns={columns} dataSource={data} pagination={false} className={styles.checkTable} /> | |
| 240 | + <div style={{ display: this.state.checkDisplay }}> | |
| 241 | + <Checkbox onChange={this.handleChange}>允许临时审核通过</Checkbox> | |
| 242 | + </div> | |
| 243 | + <TextArea rows={4} onChange={this.handleChange} /> | |
| 244 | + <InputGroup compact className={styles.checkInputGroup}> | |
| 245 | + <Input style={{ width: '90%' }} value={inputValue} disabled /> | |
| 246 | + <Button onClick={this.handlePpopUp}>+</Button> | |
| 247 | + </InputGroup> | |
| 248 | + </AntdDraggableModal> | |
| 249 | + : '' | |
| 250 | + } | |
| 251 | + { | |
| 252 | + listVisible ? | |
| 253 | + <AntdDraggableModal | |
| 254 | + zIndex={1000} | |
| 255 | + visible={listVisible} | |
| 256 | + footer={null} | |
| 257 | + onClick={this.handleCancel} | |
| 258 | + > | |
| 259 | + <Table | |
| 260 | + columns={columnsPerson} | |
| 261 | + dataSource={dataPerson} | |
| 262 | + onRow={(record) => { return { onDoubleClick: () => { this.handleDoubleClick(record); } }; }} | |
| 263 | + /> | |
| 264 | + </AntdDraggableModal> | |
| 265 | + : '' | |
| 266 | + } | |
| 267 | + </div> | |
| 268 | + ); | |
| 269 | + } | |
| 270 | +} | |
| 271 | +export default CheckModel; | ... | ... |
src/components/Common/ComFunc.js
0 → 100644
| 1 | +/* eslint-disable array-callback-return,no-undef,guard-for-in,object-curly-newline,prefer-destructuring */ | |
| 2 | +/* 用于存放涉及逻辑的通用方法 */ | |
| 3 | +import React from 'react'; | |
| 4 | +import moment from 'moment'; | |
| 5 | +import ShowTableCell from './ShowTableCell'; | |
| 6 | +import * as utils from '../../utils/utils'; | |
| 7 | + | |
| 8 | +const masterPrefix = 'master.'; /* 主表前缀数据格式:字符串) */ | |
| 9 | +const slavePrefix = 'slave.'; /* 从表前缀数据格式:字符串) */ | |
| 10 | + | |
| 11 | +/** 把主表字段绑定要相应的控件上 */ | |
| 12 | +export function mapPropsToFields(masterData, Form) { | |
| 13 | + const result = {}; | |
| 14 | + Object.keys(masterData).forEach((child) => { | |
| 15 | + const firstKey = child.substring(0, 1); | |
| 16 | + if (firstKey !== 't') { | |
| 17 | + result[child] = Form.createFormField({ value: masterData[child] }); | |
| 18 | + } else { | |
| 19 | + const dateFormat = 'YYYY-MM-DD HH:mm:ss'; /* 日期控件显示格式 */ | |
| 20 | + const value = masterData[child] !== null ? moment(masterData[child], dateFormat) : null; | |
| 21 | + result[child] = Form.createFormField({ value }); | |
| 22 | + } | |
| 23 | + }); | |
| 24 | + return result; | |
| 25 | +} | |
| 26 | + | |
| 27 | +/** 把从表字段绑定要相应的控件上 */ | |
| 28 | +export function mapPropsToFieldsSlave(slaveData, Form) { | |
| 29 | + /* 待用数据声明 */ | |
| 30 | + const result = []; /* 返回值 */ | |
| 31 | + const dateFormat = 'YYYY-MM-DD HH:mm:ss'; /* 日期控件显示格式 */ | |
| 32 | + /* 执行条件 */ | |
| 33 | + if (utils.isNotEmptyArr(slaveData)) { | |
| 34 | + /* 遍历每一行从表数据 */ | |
| 35 | + for (const each of slaveData) { | |
| 36 | + /* 返回值的内部对象 */ | |
| 37 | + const resultObj = {}; | |
| 38 | + /* 遍历每一行从表对象的key */ | |
| 39 | + for (const key of Object.keys(each)) { | |
| 40 | + /* 获取key的首字母用于判断类型 */ | |
| 41 | + const firstKey = key.substring(0, 1); | |
| 42 | + /* 日期格式的稍作转换 */ | |
| 43 | + const value = firstKey === 't' ? utils.convertObjToMoment(each[key], dateFormat) : each[key]; | |
| 44 | + /* 返回值内部对象赋值 */ | |
| 45 | + resultObj[key] = Form.createFormField({ value }); | |
| 46 | + } | |
| 47 | + /* 返回值赋值 */ | |
| 48 | + result.push(resultObj); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + /* 返回值 */ | |
| 52 | + return result; | |
| 53 | +} | |
| 54 | + | |
| 55 | +/** 系统参数日期格式化 */ | |
| 56 | +export function getDateFormat(systemData) { | |
| 57 | + if (utils.isUndefined(systemData)) { | |
| 58 | + return 'YYYY-MM-DD'; | |
| 59 | + } | |
| 60 | + const sCbxDateTime = systemData.filter(item => (item.sName === 'CbxDateTime')); | |
| 61 | + const [{ sValue }] = sCbxDateTime; | |
| 62 | + let dateFormat = 'YYYY-MM-DD'; | |
| 63 | + if (sValue !== undefined) { | |
| 64 | + if (sValue === '1') { | |
| 65 | + dateFormat = 'YYYY-MM-DD HH:mm:ss'; | |
| 66 | + } else if (sValue === '3') { | |
| 67 | + dateFormat = 'HH:mm:ss'; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + return dateFormat; | |
| 71 | +} | |
| 72 | + | |
| 73 | + | |
| 74 | +/** 列表显示日期格式化 */ | |
| 75 | +export function getDate(props, data) { | |
| 76 | + const { systemData } = props.app; | |
| 77 | + const sCbxDateTime = systemData.filter(item => (item.sName === 'CbxDateTime')); | |
| 78 | + const [{ sValue }] = sCbxDateTime; | |
| 79 | + if (sValue !== undefined) { | |
| 80 | + const dataSplit = data.split(' '); | |
| 81 | + if (sValue === '2') { | |
| 82 | + data = dataSplit[0]; | |
| 83 | + } else if (sValue === '3') { | |
| 84 | + data = dataSplit[1]; | |
| 85 | + } | |
| 86 | + } | |
| 87 | + return data; | |
| 88 | +} | |
| 89 | + | |
| 90 | +/** 获取主表显示的控件集 */ | |
| 91 | +export function getMasterShowConfig(masterConfig, masterShowConfig) { | |
| 92 | + if (utils.isEmptyArr(masterShowConfig)) { | |
| 93 | + const masterConfigData = masterConfig.gdsconfigformslave; | |
| 94 | + masterShowConfig = masterConfigData.filter(item => item.sName !== '' && item.bVisible && item.showName !== ''); | |
| 95 | + } | |
| 96 | + return masterShowConfig; | |
| 97 | +} | |
| 98 | + | |
| 99 | +/** 获取主表默认值 */ | |
| 100 | +export function getDefaultMasterData(masterShowConfig) { | |
| 101 | + const masterData = {}; | |
| 102 | + masterShowConfig.forEach((childConfig) => { | |
| 103 | + const { sDefault, sName } = childConfig; | |
| 104 | + if (sDefault !== '') { | |
| 105 | + masterData[sName] = sDefault; | |
| 106 | + } | |
| 107 | + }); | |
| 108 | + return masterData; | |
| 109 | +} | |
| 110 | +/** 根据表配置获取表头 */ | |
| 111 | +export function getHeaderConfig(config, column) { | |
| 112 | + if (utils.isEmptyArr(column)) { | |
| 113 | + const tableConfig = config.gdsconfigformslave; | |
| 114 | + for (const child of tableConfig) { | |
| 115 | + if (child.sName !== '' && child.bVisible && child.showName !== '') { | |
| 116 | + column.push({ | |
| 117 | + title: child.showName, | |
| 118 | + dataIndex: child.sName, | |
| 119 | + width: child.iFitWidth, | |
| 120 | + }); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + } | |
| 124 | + return column; | |
| 125 | +} | |
| 126 | + | |
| 127 | +export function getListHeader(config, column) { | |
| 128 | + if (utils.isEmptyArr(column)) { | |
| 129 | + const tableConfig = config.gdsconfigformslave; | |
| 130 | + for (const child of tableConfig) { | |
| 131 | + if (child.sName !== '' && child.bVisible && child.showName !== '') { | |
| 132 | + column.push({ | |
| 133 | + title: child.showName, | |
| 134 | + dataIndex: child.sName, | |
| 135 | + width: child.iFitWidth, | |
| 136 | + render: text => <ShowTableCell dataIndex={child.sName} value={text} width={child.iFitWidth} />, | |
| 137 | + }); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + } | |
| 141 | + return column; | |
| 142 | +} | |
| 143 | + | |
| 144 | + | |
| 145 | +/** 获取表格宽度 */ | |
| 146 | +export function getScrollX(columns) { | |
| 147 | + let scrollX = 37; | |
| 148 | + for (const each of columns) { | |
| 149 | + scrollX += each.width; | |
| 150 | + } | |
| 151 | + return scrollX; | |
| 152 | +} | |
| 153 | + | |
| 154 | + | |
| 155 | +/** 控制主表控件是否渲染 */ | |
| 156 | +export function setIsMasterRender(isMasterRender, renderArr) { | |
| 157 | + for (const item of Object.keys(isMasterRender)) { | |
| 158 | + isMasterRender[item] = renderArr.indexOf(item) >= 0; | |
| 159 | + } | |
| 160 | + return { ...isMasterRender }; | |
| 161 | +} | |
| 162 | + | |
| 163 | +/** 获取从表显示的控件集 */ | |
| 164 | +export function getSlaveShowConfig(slaveConifg, slaveShowConfig) { | |
| 165 | + if (utils.isEmptyArr(slaveShowConfig)) { | |
| 166 | + const slaveConfigData = slaveConifg.gdsconfigformslave; | |
| 167 | + slaveShowConfig = slaveConfigData.filter(item => item.sName !== '' && item.bVisible && item.showName !== ''); | |
| 168 | + } | |
| 169 | + return slaveShowConfig; | |
| 170 | +} | |
| 171 | + | |
| 172 | +/** 控制从表控件是否渲染(数据格式:{sSlaveId1:{sProductId:true,sProductUnit:false},sSlaveId2:{sProductId:false,sProductUnit:true}}) */ | |
| 173 | +export function setIsSlaveRender(props) { | |
| 174 | + const { slaveData, slaveColumn } = props; | |
| 175 | + let { showSlaveRender } = props; | |
| 176 | + showSlaveRender = utils.isUndefined(showSlaveRender) ? {} : showSlaveRender; | |
| 177 | + const isSlaveRender = []; | |
| 178 | + for (const eachSlave of slaveData) { | |
| 179 | + const renderEach = showSlaveRender[eachSlave.sId]; | |
| 180 | + const obj = {}; | |
| 181 | + for (const eachSlaveColumn of slaveColumn) { | |
| 182 | + obj[eachSlaveColumn.dataIndex] = (utils.isNotEmptyObject(renderEach) && utils.isNotUndefined(renderEach[eachSlaveColumn.dataIndex])); | |
| 183 | + } | |
| 184 | + isSlaveRender[eachSlave.sId] = obj; | |
| 185 | + } | |
| 186 | + props.isSlaveRender = { ...isSlaveRender }; | |
| 187 | + return props; | |
| 188 | +} | |
| 189 | + | |
| 190 | +/** 控制从表控件是否渲染(渲染整列) */ | |
| 191 | +export function setIsSlaveRenderArr(isSlaveRender, showSlaveRender) { | |
| 192 | + if (utils.isNotEmptyArr(isSlaveRender)) { | |
| 193 | + for (const key of Object.keys(isSlaveRender)) { | |
| 194 | + const row = isSlaveRender[key]; | |
| 195 | + for (const cell of Object.keys(row)) { | |
| 196 | + row[cell] = showSlaveRender.indexOf(cell) >= 0; | |
| 197 | + } | |
| 198 | + } | |
| 199 | + } | |
| 200 | + return isSlaveRender; | |
| 201 | +} | |
| 202 | + | |
| 203 | +/** 根据配置和权限,筛选出显示的按钮 */ | |
| 204 | +export function getShowBtn(props) { | |
| 205 | + const menuData = []; | |
| 206 | + const { masterConfig, gdsjurisdiction, btnData, report } = props; | |
| 207 | + const { gdsconfigformslave } = masterConfig; /* 获取权限集合 */ | |
| 208 | + /* 初始赋值数据值声明 */ | |
| 209 | + const btnShowData = [...btnData]; | |
| 210 | + /* 配置先过滤出按钮或则页签的集合 */ | |
| 211 | + const baseCondition = gdsconfigformslave.filter(item => item.sName === '' && item.showName !== ''); | |
| 212 | + | |
| 213 | + /** 根据权限,筛选出显示的按钮 */ | |
| 214 | + gdsjurisdiction.forEach((child) => { | |
| 215 | + const index = btnShowData.findIndex(item => item.sControlName === child.sAction); | |
| 216 | + if (index > -1) { | |
| 217 | + btnShowData.splice(index, 1); | |
| 218 | + } | |
| 219 | + }); | |
| 220 | + | |
| 221 | + /** 权限筛选后根据配置,筛选出显示的按钮 */ | |
| 222 | + baseCondition.forEach((child) => { | |
| 223 | + const index = btnShowData.findIndex(item => item.sControlName === child.sControlName && !child.bVisible); | |
| 224 | + if (index > -1) { | |
| 225 | + btnShowData.splice(index, 1); | |
| 226 | + } | |
| 227 | + }); | |
| 228 | + /* 筛选出一级菜单 */ | |
| 229 | + const parMenu = btnShowData.filter(item => !item.sControlName.includes('.')); | |
| 230 | + /* 初始值的二级菜单 */ | |
| 231 | + const childMenu = btnShowData.filter(item => item.sControlName.includes('.')); | |
| 232 | + | |
| 233 | + /** 配置后匹配二级菜单 */ | |
| 234 | + parMenu.forEach((childPar) => { | |
| 235 | + const { pIdentify, sControlName } = childPar; | |
| 236 | + childPar.child = []; | |
| 237 | + /** 匹配相应的子菜单 */ | |
| 238 | + const childData = childMenu.filter(item => item.sControlName.startsWith(`${sControlName}.`)); | |
| 239 | + if (utils.isNotEmptyArr(childData)) { | |
| 240 | + childPar.child.push(...childData); | |
| 241 | + } | |
| 242 | + | |
| 243 | + if (sControlName === 'BtnPrint') { | |
| 244 | + /* 打印的二级菜单集合 */ | |
| 245 | + const reportChild = []; | |
| 246 | + for (const each of report) { | |
| 247 | + reportChild.push({ | |
| 248 | + sControlName: `BtnPrint.${each.sReportName}`, | |
| 249 | + showName: each.sReportName, | |
| 250 | + disabled: false, | |
| 251 | + sId: each.sId, | |
| 252 | + }); | |
| 253 | + } | |
| 254 | + childPar.child.push(...reportChild); | |
| 255 | + } | |
| 256 | + | |
| 257 | + if (pIdentify !== '') { | |
| 258 | + /* 复制到、上查、下查、复制从的二级菜单集合 */ | |
| 259 | + const pIdentifyChild = baseCondition.filter(item => item.sControlName.startsWith(childPar.pIdentify) && item.bVisible); | |
| 260 | + const pIdentifyEachChild = []; | |
| 261 | + for (const each of pIdentifyChild) { | |
| 262 | + const slaveCopeTo = []; | |
| 263 | + const obj = {}; | |
| 264 | + if (pIdentify === 'BtnCopyTo_') { | |
| 265 | + const pIdentifyOfBtnCopyToChild = baseCondition.filter(item => item.sControlName.startsWith('BtnCopyTo_')); | |
| 266 | + for (const item of pIdentifyOfBtnCopyToChild) { | |
| 267 | + const { sAssignField } = item; | |
| 268 | + const splitArray = item.sControlName.split('_'); | |
| 269 | + if (splitArray.length === 2) { | |
| 270 | + /* 返回新对象——主表赋值 */ | |
| 271 | + obj.masterCopeTo = utils.returnObjValue(sAssignField); | |
| 272 | + } else { | |
| 273 | + /* 返回新对象 */ | |
| 274 | + const slaveChild = utils.returnObjValue(sAssignField); | |
| 275 | + slaveCopeTo.push(slaveChild); | |
| 276 | + } | |
| 277 | + } | |
| 278 | + if (utils.isNotEmptyArr(slaveCopeTo)) { | |
| 279 | + obj.slaveCopeTo = slaveCopeTo; | |
| 280 | + } | |
| 281 | + } | |
| 282 | + /* 将上查、下查的三级菜单数据存入 */ | |
| 283 | + if (pIdentify === 'BtnUpCheck.' || pIdentify === 'BtnDownCheck.') { | |
| 284 | + if (each.sControlName === props.toolBarSearchUpDownThirdMenuKey) { | |
| 285 | + obj.thirdMenu = props.toolBarSearchUpDownThirdMenuData; | |
| 286 | + } | |
| 287 | + } | |
| 288 | + pIdentifyEachChild.push({ | |
| 289 | + sControlName: each.sControlName, | |
| 290 | + showName: each.showName, | |
| 291 | + sId: each.sId, | |
| 292 | + disabled: false, | |
| 293 | + sActiveId: utils.strUndefinedToEmpty(each.sActiveId), | |
| 294 | + ...obj, | |
| 295 | + }); | |
| 296 | + } | |
| 297 | + childPar.child.push(...pIdentifyEachChild); | |
| 298 | + } | |
| 299 | + menuData.push(childPar); | |
| 300 | + }); | |
| 301 | + return menuData; | |
| 302 | +} | |
| 303 | + | |
| 304 | +/** 通用失败 */ | |
| 305 | +export function handleCommonFail(props, data) { | |
| 306 | + /* 待用数据声明 */ | |
| 307 | + const { dispatch } = props; | |
| 308 | + /* 错误处理 */ | |
| 309 | + dispatch({ type: 'app/throwError', payload: data }); | |
| 310 | + /* 返回值赋值 */ | |
| 311 | + props.pageLoading = false; | |
| 312 | + /* 返回值 */ | |
| 313 | + return props; | |
| 314 | +} | |
| 315 | + | |
| 316 | +// ----------------------------获取sqlCondition start---------------------------- // | |
| 317 | +/** 获取sqlCondition对象 */ | |
| 318 | +export function getSqlCondition(sSqlCondition, sSlaveId, slaveData, masterData) { | |
| 319 | + /* 返回值声明 */ | |
| 320 | + const obj = {}; | |
| 321 | + /* 执行条件 */ | |
| 322 | + if (utils.isNotEmptyStr(sSqlCondition)) { | |
| 323 | + /* 逗号分割sqlCondition为数组 */ | |
| 324 | + const arr = sSqlCondition.split(','); | |
| 325 | + /* 遍历sqlCondition数组 */ | |
| 326 | + for (let key of arr) { | |
| 327 | + /* 去掉空格 */ | |
| 328 | + key = key.trim(); | |
| 329 | + /* 获取sqlCondition对应key的value */ | |
| 330 | + const value = this.getSqlConditionData( | |
| 331 | + key, | |
| 332 | + sSlaveId, | |
| 333 | + slaveData, | |
| 334 | + masterData, | |
| 335 | + ); | |
| 336 | + /* 可用的value进行返回值赋值 */ | |
| 337 | + if (value) { | |
| 338 | + obj[key.replace(masterPrefix, '').replace(slavePrefix, '')] = value; | |
| 339 | + } | |
| 340 | + } | |
| 341 | + } | |
| 342 | + /* 返回值 */ | |
| 343 | + return obj; | |
| 344 | +} | |
| 345 | + | |
| 346 | +/* 获取sqlCondition数据 */ | |
| 347 | +export function getSqlConditionData(key, sSlaveId, slaveData, masterData) { | |
| 348 | + if (key.startsWith(masterPrefix)) { /* 从主表中获取数据 */ | |
| 349 | + return this.getSqlConditionByMaster(key.replace(masterPrefix, ''), masterData); | |
| 350 | + } else if (key.startsWith(slavePrefix)) { /* 从从表中获取数据 */ | |
| 351 | + return this.getSqlConditionBySlave( | |
| 352 | + key.replace(slavePrefix, ''), | |
| 353 | + slaveData, | |
| 354 | + sSlaveId, | |
| 355 | + ); | |
| 356 | + } else { /* 从主表和从表中一起获取数据 */ | |
| 357 | + return this.getSqlConditionByMasterSlave( | |
| 358 | + key, | |
| 359 | + masterData, | |
| 360 | + slaveData, | |
| 361 | + sSlaveId, | |
| 362 | + ); | |
| 363 | + } | |
| 364 | +} | |
| 365 | + | |
| 366 | +/* 从主表中获取sqlCondition数据 */ | |
| 367 | +export function getSqlConditionByMaster(key, masterData) { | |
| 368 | + return masterData[key]; | |
| 369 | +} | |
| 370 | + | |
| 371 | +/* 从从表中获取sqlCondition数据 */ | |
| 372 | +export function getSqlConditionBySlave(key, slaveData, sSlaveId) { | |
| 373 | + /* 获取从表的本条数据 */ | |
| 374 | + const slaveObj = slaveData.filter(item => item.sId === sSlaveId); | |
| 375 | + /* 返回值 */ | |
| 376 | + return utils.isNotEmptyArr(slaveObj) ? slaveObj[0][key] : null; | |
| 377 | +} | |
| 378 | + | |
| 379 | +/* 从主从表中获取sqlCondition数据 */ | |
| 380 | +export function getSqlConditionByMasterSlave(key, masterData, slaveData, sSlaveId) { | |
| 381 | + /* 先从主表中获取数据 */ | |
| 382 | + let value = this.getSqlConditionByMaster(key, masterData); | |
| 383 | + /* 再从从表中获取数据 */ | |
| 384 | + if (!value && utils.isNotEmptyStr(sSlaveId)) { | |
| 385 | + value = this.getSqlConditionBySlave(key, slaveData, sSlaveId); | |
| 386 | + } | |
| 387 | + /* 返回值 */ | |
| 388 | + return value; | |
| 389 | +} | |
| 390 | +// ----------------------------获取sqlCondition end ---------------------------- // | |
| 391 | + | |
| 392 | +// ----------------------------单据渲染start---------------------------- // | |
| 393 | +// -------------------------主表单据渲染start------------------------- // | |
| 394 | +/** 设置主表渲染 */ | |
| 395 | +export function setMasterRender(masterShowConfig, masterShowRender) { | |
| 396 | + /* 填充主表渲染容器(默认值都给false) */ | |
| 397 | + let isMasterRender = setMasterRenderTrueOrFalse(masterShowConfig, false); | |
| 398 | + /* 设置主表渲染容器值 */ | |
| 399 | + isMasterRender = setMasterRenderContainerValue(isMasterRender, masterShowRender); | |
| 400 | + /* 返回值 */ | |
| 401 | + return isMasterRender; | |
| 402 | +} | |
| 403 | + | |
| 404 | +/** 设置主表渲染(全是true或false) */ | |
| 405 | +export function setMasterRenderTrueOrFalse(masterShowConfig, value) { | |
| 406 | + /* 返回值声明 */ | |
| 407 | + const isMasterRender = {}; | |
| 408 | + /* 主表配置有值才进行容器赋值,否则就返回空对象了 */ | |
| 409 | + if (utils.isNotEmptyArr(masterShowConfig)) { | |
| 410 | + /* 遍历主表配置结构:[{},{},{}...] */ | |
| 411 | + for (const each of masterShowConfig) { | |
| 412 | + /* sName为key,初始值都是false */ | |
| 413 | + isMasterRender[each.sName] = value; | |
| 414 | + } | |
| 415 | + } | |
| 416 | + /* 返回值 */ | |
| 417 | + return isMasterRender; | |
| 418 | +} | |
| 419 | + | |
| 420 | +/** 设置主表渲染容器值 */ | |
| 421 | +export function setMasterRenderContainerValue(isMasterRender, masterShowRender) { | |
| 422 | + /* 如果没设置渲染数组就直接返回都是false的渲染容器即可 */ | |
| 423 | + if (utils.isNotEmptyArr(masterShowRender)) { | |
| 424 | + /* 渲染数组有值的话就遍历并把在渲染容器中对应的sName都变成true */ | |
| 425 | + for (const sName of masterShowRender) { | |
| 426 | + isMasterRender[sName] = true; | |
| 427 | + } | |
| 428 | + } | |
| 429 | + /* 返回值 */ | |
| 430 | + return isMasterRender; | |
| 431 | +} | |
| 432 | +// -------------------------主表单据渲染end ------------------------- // | |
| 433 | + | |
| 434 | +// -------------------------从表单据渲染start------------------------- // | |
| 435 | +/** 设置从表渲染 */ | |
| 436 | +export function setSlaveRender(slaveShowConfig, slaveData, slaveShowRender) { | |
| 437 | + /* 填充从表表渲染容器(默认值都给false) */ | |
| 438 | + let isSlaveRender = setSlaveRenderTrueOrFalse(slaveShowConfig, slaveData, false); | |
| 439 | + /* 设置从表渲染容器值 */ | |
| 440 | + isSlaveRender = setSlaveRenderContainerValue(isSlaveRender, slaveShowRender); | |
| 441 | + /* 返回值 */ | |
| 442 | + return isSlaveRender; | |
| 443 | +} | |
| 444 | + | |
| 445 | +/** 设置从表渲染(全是true或false) */ | |
| 446 | +export function setSlaveRenderTrueOrFalse(slaveShowConfig, slaveData, value) { | |
| 447 | + /* 返回值声明,数据结构{sSlaveId1:{sProductId:true,sProductQty:false},sSlaveId2:{sProductId:true,sProductQty:false},sSlaveId3:{sProductId:true,sProductQty:false}...} */ | |
| 448 | + const isSlaveRender = {}; | |
| 449 | + /* 从表配置和从表数据都必须有值才进行容器赋值,否则就返回空对象了 */ | |
| 450 | + if (utils.isNotEmptyArr(slaveShowConfig) && utils.isNotEmptyArr(slaveData)) { | |
| 451 | + /* 遍历从表数据:[{},{},{}...] */ | |
| 452 | + for (const eachSlaveData of slaveData) { | |
| 453 | + /* 声明容器内部对象 */ | |
| 454 | + const isSlaveRenderEach = {}; | |
| 455 | + /* 遍历从表配置:[{},{},{}...] */ | |
| 456 | + for (const eachSlaveShowConfig of slaveShowConfig) { | |
| 457 | + /* 给每一个从表配置内部对象赋默认值为false */ | |
| 458 | + isSlaveRenderEach[eachSlaveShowConfig.sName] = value; | |
| 459 | + } | |
| 460 | + /* 给渲染容器对象的row赋值 */ | |
| 461 | + isSlaveRender[eachSlaveData.sId] = isSlaveRenderEach; | |
| 462 | + } | |
| 463 | + } | |
| 464 | + /* 返回值 */ | |
| 465 | + return isSlaveRender; | |
| 466 | +} | |
| 467 | + | |
| 468 | +/** 设置从表渲染容器值 */ | |
| 469 | +export function setSlaveRenderContainerValue(isSlaveRender, slaveShowRender) { | |
| 470 | + /* 如果没设置渲染对象就直接返回都是false的渲染容器即可 */ | |
| 471 | + if (utils.isNotEmptyObject(slaveShowRender) && utils.isNotEmptyObject(isSlaveRender)) { | |
| 472 | + /* 渲染对象有值的话就遍历并把在渲染容器中对应的sName都变成true */ | |
| 473 | + for (const sSlaveId of Object.keys(slaveShowRender)) { | |
| 474 | + /* 获取渲染对象中的从表数据 */ | |
| 475 | + const valueArr = slaveShowRender[sSlaveId]; | |
| 476 | + /* 获取渲染容器中对应的从表row */ | |
| 477 | + const isSlaveRenderEach = isSlaveRender[sSlaveId]; | |
| 478 | + /* 如果如安然对象的从表数据有值,则把这个值付给渲染对象 */ | |
| 479 | + if (utils.isNotEmptyArr(valueArr)) { | |
| 480 | + /* 循环赋值 */ | |
| 481 | + for (const key of valueArr) { | |
| 482 | + isSlaveRenderEach[key] = true; | |
| 483 | + } | |
| 484 | + } | |
| 485 | + } | |
| 486 | + } | |
| 487 | + /* 返回值 */ | |
| 488 | + return isSlaveRender; | |
| 489 | +} | |
| 490 | + | |
| 491 | +/** 设置从表渲染(整列渲染) */ | |
| 492 | +export function setSlaveCellRender(slaveShowConfig, slaveData, slaveShowRender) { | |
| 493 | + /* 填充从表表渲染容器(默认值都给false) */ | |
| 494 | + let isSlaveRender = setSlaveRenderTrueOrFalse(slaveShowConfig, slaveData, false); | |
| 495 | + /* 设置从表渲染容器值 */ | |
| 496 | + isSlaveRender = setSlaveCellRenderContainerValue(isSlaveRender, slaveShowRender); | |
| 497 | + /* 返回值 */ | |
| 498 | + return isSlaveRender; | |
| 499 | +} | |
| 500 | + | |
| 501 | +/** 设置从表渲染容器值(整列渲染) */ | |
| 502 | +export function setSlaveCellRenderContainerValue(isSlaveRender, slaveShowRender) { | |
| 503 | + /* 如果没设置渲染数组就直接返回都是false的渲染容器即可 */ | |
| 504 | + if (utils.isNotEmptyArr(slaveShowRender)) { | |
| 505 | + /* 渲染对象有值的话就遍历并把在渲染容器中对应的sName都变成true */ | |
| 506 | + for (const key of Object.keys(isSlaveRender)) { | |
| 507 | + const isSlaveRenderEach = isSlaveRender[key]; | |
| 508 | + /* 循环赋值 */ | |
| 509 | + for (const sName of Object.keys(isSlaveRenderEach)) { | |
| 510 | + isSlaveRenderEach[sName] = slaveShowRender.indexOf(sName) >= 0; | |
| 511 | + } | |
| 512 | + } | |
| 513 | + } | |
| 514 | + /* 返回值 */ | |
| 515 | + return isSlaveRender; | |
| 516 | +} | |
| 517 | +// -------------------------从表单据渲染end ------------------------- // | |
| 518 | +// ----------------------------单据渲染end ---------------------------- // | |
| 519 | + | |
| 520 | +// ----------------------------合计列start---------------------------- // | |
| 521 | +/** 添加合计列数据 */ | |
| 522 | +export function addDataTotal(slaveShowConfig, dataTotal, slaveData, isNeed) { | |
| 523 | + /* 获取待合计字段 */ | |
| 524 | + const slaveTotal = []; | |
| 525 | + const dataTotalColumn = this.getDataTotalColumn(slaveShowConfig, dataTotal); | |
| 526 | + /* 从表配置,从表数据和待合计字段都不为空的时候才进行数据合计 */ | |
| 527 | + if (utils.isNotEmptyArr(slaveShowConfig) && utils.isNotEmptyObject(dataTotalColumn) && utils.isNotEmptyArr(slaveData)) { | |
| 528 | + /* 获取合计对象 */ | |
| 529 | + const totalObj = getTotalObj(slaveShowConfig, slaveData, dataTotalColumn, isNeed); | |
| 530 | + /* 添加合计对象 */ | |
| 531 | + slaveTotal.push(totalObj); | |
| 532 | + } | |
| 533 | + /* 返回值 */ | |
| 534 | + return slaveTotal; | |
| 535 | +} | |
| 536 | + | |
| 537 | +/** 获取合计列数据 */ | |
| 538 | +export function getDataTotalColumn(slaveShowConfig, dataTotal) { | |
| 539 | + /* 如果接口传了合计字段那就用接口的合计字段 */ | |
| 540 | + if (utils.isNotEmptyObject(dataTotal)) { | |
| 541 | + return dataTotal; | |
| 542 | + } | |
| 543 | + /* 返回值 */ | |
| 544 | + const dataTotalColumn = {}; | |
| 545 | + /* 如果存在从表配置 */ | |
| 546 | + if (utils.isNotEmptyArr(slaveShowConfig)) { | |
| 547 | + /* 遍历从表配置 */ | |
| 548 | + for (const each of slaveShowConfig) { | |
| 549 | + /* 将需要合计的sName存入合计列对象中 */ | |
| 550 | + if (each.bSum) { | |
| 551 | + dataTotalColumn[each.sName] = 0; | |
| 552 | + } | |
| 553 | + } | |
| 554 | + } | |
| 555 | + /* 返回值 */ | |
| 556 | + return dataTotalColumn; | |
| 557 | +} | |
| 558 | + | |
| 559 | +/** 获取合计对象 */ | |
| 560 | +export function getTotalObj(slaveShowConfig, slaveDataNoTotal, dataTotalColumn, isNeed) { | |
| 561 | + /* 待用数据声明 */ | |
| 562 | + const sId = utils.createSid(); /* 唯一标示 */ | |
| 563 | + const totalObj = { | |
| 564 | + dataTotal: true, | |
| 565 | + key: sId, | |
| 566 | + sId, | |
| 567 | + };/* 统计对象的必须数据 */ | |
| 568 | + /* 遍历表头 */ | |
| 569 | + for (const each of slaveShowConfig) { | |
| 570 | + /* 获取sName */ | |
| 571 | + const sName = each.sName; | |
| 572 | + /* 给合计对象添加属性和值 */ | |
| 573 | + totalObj[sName] = getStatisticsValue(sName, slaveDataNoTotal, dataTotalColumn, isNeed); | |
| 574 | + } | |
| 575 | + /* 返回值 */ | |
| 576 | + return totalObj; | |
| 577 | +} | |
| 578 | + | |
| 579 | +/** 获取统计值 */ | |
| 580 | +export function getStatisticsValue(sName, slaveDataNoTotal, dataTotalColumn, isNeed) { | |
| 581 | + /* 返回值声明 */ | |
| 582 | + let res = ''; | |
| 583 | + /* 过滤出需要统计的列 */ | |
| 584 | + if (utils.isNotUndefined(dataTotalColumn[sName])) { | |
| 585 | + /* 判断是否需要统计(需要统计的话要遍历从表,不需要的话就直接取dataTotal中的数据) */ | |
| 586 | + if (isNeed) { /* 把需要统计的列sum起来 */ | |
| 587 | + for (const each of slaveDataNoTotal) { | |
| 588 | + res = utils.convertStrToNumber0(res) + utils.convertStrToNumber0(each[sName]); | |
| 589 | + } | |
| 590 | + } else { /* 不需要的统计的话直接取dataTotal中的值 */ | |
| 591 | + res = dataTotalColumn[sName]; | |
| 592 | + } | |
| 593 | + } | |
| 594 | + /* 返回值 */ | |
| 595 | + return res; | |
| 596 | +} | |
| 597 | +// ----------------------------合计列end ---------------------------- // | |
| 598 | + | |
| 599 | +// ----------------------------复制到start---------------------------- // | |
| 600 | +/* 复制到主表赋值 */ | |
| 601 | +export function getCopyToMasterAssign(masterData, masterAssign) { | |
| 602 | + /* 返回值声明 */ | |
| 603 | + const masterAssignData = {}; | |
| 604 | + /* 两个集合都不为空才执行赋值,要不就直接返回空数组就好了 */ | |
| 605 | + if (utils.isNotEmptyObject(masterAssign) && utils.isNotEmptyObject(masterData)) { | |
| 606 | + /* 遍历赋值数据 */ | |
| 607 | + for (const targetKey of Object.keys(masterAssign)) { | |
| 608 | + /* 获取主表的数据key */ | |
| 609 | + const key = masterAssign[targetKey]; | |
| 610 | + /* 主表值 */ | |
| 611 | + const value = masterData[key]; | |
| 612 | + /* 给这个目标key赋值 */ | |
| 613 | + if (utils.isNotUndefined(value)) { | |
| 614 | + masterAssignData[targetKey] = value; | |
| 615 | + } | |
| 616 | + } | |
| 617 | + } | |
| 618 | + /* 返回值 */ | |
| 619 | + return masterAssignData; | |
| 620 | +} | |
| 621 | + | |
| 622 | +/* 复制到从表赋值 */ | |
| 623 | +export function getCopyToSlaveAssign(slaveData, slaveAssign, masterData) { | |
| 624 | + /* 返回值声明 */ | |
| 625 | + const slaveAssignData = []; | |
| 626 | + /* 两个集合都不为空才执行赋值,要不就直接返回空数组就好了 */ | |
| 627 | + if (utils.isNotEmptyArr(slaveAssign) && utils.isNotEmptyArr(slaveData)) { | |
| 628 | + /* 暂时先取从表的第一条,之后再调整为动态的 */ | |
| 629 | + const slaveAssignFirst = slaveAssign[0]; | |
| 630 | + /* 遍历从表数据 */ | |
| 631 | + for (const each of slaveData) { | |
| 632 | + /* 合计行不处理 */ | |
| 633 | + if (!each.dataTotal) { | |
| 634 | + /* 创建从表sId */ | |
| 635 | + const sId = utils.createSid(); | |
| 636 | + /* 每一行的容器对象声明 */ | |
| 637 | + const slaveAssignDataEach = { | |
| 638 | + sId, | |
| 639 | + key: sId, | |
| 640 | + }; | |
| 641 | + /* 遍历从表数据的每一个key */ | |
| 642 | + for (const key of Object.keys(each)) { | |
| 643 | + const targetKey = utils.getObjKeyByValue(slaveAssignFirst, key); | |
| 644 | + /* 如果该赋值字段存在,则给数据赋值 */ | |
| 645 | + if (utils.isNotUndefined(targetKey)) { | |
| 646 | + slaveAssignDataEach[targetKey] = targetKey.startsWith('#') && targetKey.endsWith('#') ? masterData[key] : each[key]; | |
| 647 | + } | |
| 648 | + } | |
| 649 | + /* 容器赋值 */ | |
| 650 | + slaveAssignData.push(slaveAssignDataEach); | |
| 651 | + } | |
| 652 | + } | |
| 653 | + } | |
| 654 | + /* 返回值 */ | |
| 655 | + return slaveAssignData; | |
| 656 | +} | |
| 657 | + | |
| 658 | +// ----------------------------复制到end ---------------------------- // | ... | ... |
src/components/Common/CommonBase.js
| ... | ... | @@ -327,6 +327,12 @@ export default (ChildComponent) => { |
| 327 | 327 | const tableName = item.split('.')[0]; |
| 328 | 328 | let fieldName = item.split('.')[1]; |
| 329 | 329 | let fieldNameFilter = item.split('.').length > 2 ? item.split('.')[2] : fieldName; |
| 330 | + const warnArr = fieldName.split('|'); | |
| 331 | + let warnStr = ''; | |
| 332 | + if(commonUtils.isNotEmptyArr(warnArr)) { | |
| 333 | + fieldName = warnArr[0]; | |
| 334 | + warnStr = warnArr[1]; | |
| 335 | + } | |
| 330 | 336 | // master.sId 作为参数 master.sId.sId 作为filterDropdown过滤参数 |
| 331 | 337 | if (showConfig.sDropDownType === 'picArr' || showConfig.sDropDownType === 'picArrModal' ) { |
| 332 | 338 | fieldNameFilter = item.split('.').length > 2 ? item.split('.')[2] : fieldName; |
| ... | ... | @@ -376,6 +382,12 @@ export default (ChildComponent) => { |
| 376 | 382 | } |
| 377 | 383 | if (typeof data === 'object' && data.constructor === Object) { |
| 378 | 384 | conditonValues[fieldNameFilter] = data[fieldName]; |
| 385 | + if(commonUtils.isNotEmptyObject(warnStr)) { | |
| 386 | + if(commonUtils.isEmpty(data[fieldName])) { | |
| 387 | + conditonValues['warning'] = commonUtils.isNotEmptyObject(conditonValues['warning']) ? | |
| 388 | + conditonValues['warning']+ warnStr : warnStr; | |
| 389 | + } | |
| 390 | + } | |
| 379 | 391 | } |
| 380 | 392 | else if (fieldName.indexOf('_all') > -1) { |
| 381 | 393 | let sAllConditionValue = ''; |
| ... | ... | @@ -413,6 +425,11 @@ export default (ChildComponent) => { |
| 413 | 425 | } |
| 414 | 426 | } else if (commonUtils.isNotEmptyArr(data)) { |
| 415 | 427 | conditonValues[fieldNameFilter] = data[0][fieldName]; |
| 428 | + if(commonUtils.isEmpty(data[0][fieldName])) { | |
| 429 | + conditonValues['warning'] = commonUtils.isNotEmptyObject(conditonValues['warning']) ? | |
| 430 | + conditonValues['warning']+ warnStr : warnStr; | |
| 431 | + } | |
| 432 | + | |
| 416 | 433 | } |
| 417 | 434 | } |
| 418 | 435 | } |
| ... | ... | @@ -434,7 +451,8 @@ export default (ChildComponent) => { |
| 434 | 451 | } |
| 435 | 452 | const url = `${commonConfig.server_host}business/getSelectLimit/${showConfig.sId}?sModelsId=${this.state.sModelsId}&sName=${formSrcRoute}`; |
| 436 | 453 | /* 参数 */ |
| 437 | - const conditonValues = this.getSqlCondition(showConfig, name, record); | |
| 454 | + const nameNew = name.includes('slaveUp') ? 'slave' : name; | |
| 455 | + const conditonValues = this.getSqlCondition(showConfig, nameNew, record); | |
| 438 | 456 | |
| 439 | 457 | const body = { |
| 440 | 458 | sSqlCondition: commonUtils.isEmptyObject(conditonValues) ? '' : conditonValues, /* 查询条件 */ |
| ... | ... | @@ -1884,9 +1902,11 @@ export default (ChildComponent) => { |
| 1884 | 1902 | handleTableAdd = (name, isWait) => { |
| 1885 | 1903 | /* 外置处理业务 */ |
| 1886 | 1904 | const { |
| 1887 | - [`${name}Config`]: tableConfig, masterData, slaveData, slaveSelectedRowKeys, controlData, controlSelectedRowKeys, processData, processSelectedRowKeys, materialsData, materialsSelectedRowKeys | |
| 1905 | + [`${name}Config`]: tableConfig, masterData, slaveData, slaveSelectedRowKeys, controlData, controlSelectedRowKeys, | |
| 1906 | + processData, processSelectedRowKeys, materialsData, materialsSelectedRowKeys, sModelsType | |
| 1888 | 1907 | } = this.state; |
| 1889 | 1908 | let { [`${name}Data`]: tableData } = this.state; |
| 1909 | + const { app } = this.props; | |
| 1890 | 1910 | tableData = commonUtils.isEmptyObject(tableData) ? [] : tableData; |
| 1891 | 1911 | const allTableData = {}; |
| 1892 | 1912 | allTableData.master = masterData; |
| ... | ... | @@ -1926,6 +1946,7 @@ export default (ChildComponent) => { |
| 1926 | 1946 | tableDataRow.sNodeId = commonUtils.createSid(); /* 用于建立关联关系 */ |
| 1927 | 1947 | } |
| 1928 | 1948 | tableDataRow = { ...tableDataRow, ...commonFunc.getDefaultData(tableConfig, allTableData)}; |
| 1949 | + tableDataRow = commonUtils.getDefineNo(app, sModelsType, name, masterData, tableDataRow); | |
| 1929 | 1950 | if (isWait) { |
| 1930 | 1951 | return tableDataRow; |
| 1931 | 1952 | } else { | ... | ... |
src/components/Common/CommonBill/index.js
| ... | ... | @@ -227,16 +227,16 @@ class CommonBill extends Component { |
| 227 | 227 | }); |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | - if (!tableDataRow.dNProductPrice) { | |
| 231 | - tableDataRow.dNProductPrice = tableDataRow.dProductForeignPrice; | |
| 232 | - } | |
| 233 | - const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; | |
| 234 | - if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/')) { | |
| 235 | - tableDataRow = await this.props.onMaterialsChange(tableDataRow, sModelsId, masterData, {}, 'dAuxiliaryQty', app, token, models); | |
| 236 | - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, tableDataRow); | |
| 237 | - } else { | |
| 238 | - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dProductQty', masterData, tableDataRow); | |
| 239 | - } | |
| 230 | + // if (!tableDataRow.dNProductPrice) { | |
| 231 | + // tableDataRow.dNProductPrice = tableDataRow.dProductForeignPrice; | |
| 232 | + // } | |
| 233 | + // const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; | |
| 234 | + // if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/')) { | |
| 235 | + // tableDataRow = await this.props.onMaterialsChange(tableDataRow, sModelsId, masterData, {}, 'dAuxiliaryQty', app, token, models); | |
| 236 | + // tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, tableDataRow); | |
| 237 | + // } else { | |
| 238 | + // tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dProductQty', masterData, tableDataRow); | |
| 239 | + // } | |
| 240 | 240 | }); |
| 241 | 241 | this.props.onSaveState({ slaveData: returnData, slaveDelData }); |
| 242 | 242 | } else { /* 失败s */ |
| ... | ... | @@ -694,7 +694,7 @@ class CommonBill extends Component { |
| 694 | 694 | } |
| 695 | 695 | } |
| 696 | 696 | tableData.push(tableDataRow); |
| 697 | - this.props.onSaveState({ [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: [tableDataRow.sId], ...treeState }); | |
| 697 | + this.props.onSaveState({ [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: [tableDataRow.sId]}); | |
| 698 | 698 | } else if (name === 'materials' || name === 'process') { |
| 699 | 699 | tableDataRow = this.props.onDataRowAdd(name, true); |
| 700 | 700 | if (commonUtils.isEmptyArr(controlSelectedRowKeys)) { |
| ... | ... | @@ -2147,7 +2147,7 @@ class CommonBill extends Component { |
| 2147 | 2147 | {processInfo} |
| 2148 | 2148 | </Sider> |
| 2149 | 2149 | <Content> |
| 2150 | - <StaticEditTable {...processPropsType} setOpterationColumn="Y" noVlist /> | |
| 2150 | + <StaticEditTable {...processPropsType} setOpterationColumn="Y" noVlistTable /> | |
| 2151 | 2151 | </Content> |
| 2152 | 2152 | </Layout> |
| 2153 | 2153 | </div> |
| ... | ... | @@ -2188,6 +2188,7 @@ const BillComponent = Form.create({ |
| 2188 | 2188 | sModelsType, |
| 2189 | 2189 | masterData, |
| 2190 | 2190 | bDelegate, /* 是否已经转办 */ |
| 2191 | + slaveInfoList, | |
| 2191 | 2192 | } = props; |
| 2192 | 2193 | /* 回带表单 */ |
| 2193 | 2194 | onReturnForm(form); |
| ... | ... | @@ -2381,6 +2382,32 @@ const BillComponent = Form.create({ |
| 2381 | 2382 | customConfig: props.customConfig, |
| 2382 | 2383 | handleCheckBoxStatus: props.handleCheckBoxStatus, |
| 2383 | 2384 | }; |
| 2385 | + | |
| 2386 | + const slaveTablePropsList = {}; | |
| 2387 | + if (commonUtils.isNotEmptyArr(slaveInfoList)) { | |
| 2388 | + slaveInfoList.forEach((item, index) => { | |
| 2389 | + const slaveTablePagination = { | |
| 2390 | + pageSize: commonUtils.isNotEmptyNumber(props.iPageSize) && props.iPageSize !== 0 ? props.iPageSize : commonConfig.pageSize, | |
| 2391 | + ...slavePagination, | |
| 2392 | + size: isSmall ? 'small' : 'large', | |
| 2393 | + pageSizeOptions: commonConfig.pageSizeOptions, | |
| 2394 | + showSizeChanger: !isSmall, | |
| 2395 | + showQuickJumper: !isSmall, | |
| 2396 | + hideOnSinglePage: true, | |
| 2397 | + }; | |
| 2398 | + const bHasSlaveChild = commonUtils.isNotEmptyArr(props.slaveChildInfoList) && props.slaveChildInfoList.some(item => item.split('Child')[0] === `slave${index}`); | |
| 2399 | + slaveTablePropsList[`slaveTable${index}Props`] = { | |
| 2400 | + ...commonBusiness.getTableTypes(`slave${index}`, props), | |
| 2401 | + tableProps: { | |
| 2402 | + pagination: slaveTablePagination, onChange: props.onTitleChange1.bind(this, `slave${index}`), | |
| 2403 | + AutoTableHeight: bHasSlaveChild ? 150 : 375, | |
| 2404 | + }, | |
| 2405 | + }; | |
| 2406 | + }); | |
| 2407 | + } | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2384 | 2411 | let gdsconfigformmasterId = ''; |
| 2385 | 2412 | if (templateProps !== undefined) { |
| 2386 | 2413 | gdsconfigformmasterId = templateProps.sId; |
| ... | ... | @@ -2414,7 +2441,8 @@ const BillComponent = Form.create({ |
| 2414 | 2441 | const BtnimportData = commonFunc.showMessage(app.commonConst, 'importData');/* 导入数据 */ |
| 2415 | 2442 | const ImportData = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes('ImportData') && item.bVisible) : '';/* 后台是否配置导入 */ |
| 2416 | 2443 | |
| 2417 | - if (commonUtils.isNotEmptyObject(masterConfig)) { | |
| 2444 | + | |
| 2445 | + if (false && commonUtils.isNotEmptyObject(masterConfig)) { | |
| 2418 | 2446 | const iIndex0 = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'zSlaveInfo0'); |
| 2419 | 2447 | if (iIndex0 > -1) { |
| 2420 | 2448 | MainContent = masterConfig.gdsconfigformslave[iIndex0].showName; |
| ... | ... | @@ -2425,6 +2453,29 @@ const BillComponent = Form.create({ |
| 2425 | 2453 | } |
| 2426 | 2454 | } |
| 2427 | 2455 | |
| 2456 | + const slaveInfo0 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo0')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo0')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo0'); /* 表三 */ | |
| 2457 | + const slaveInfo1 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo1')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo1')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo1'); /* 表四 */ | |
| 2458 | + const slaveInfo2 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo2')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo2')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo2'); /* 表五 */ | |
| 2459 | + const slaveInfo3 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo3')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo3')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo3'); /* 表六 */ | |
| 2460 | + const slaveInfo4 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo4')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo4')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo4'); /* 表七 */ | |
| 2461 | + const slaveInfo5 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo5')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo5')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo5'); /* 表八 */ | |
| 2462 | + const slaveInfo6 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo6')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo6')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo6'); /* 表九 */ | |
| 2463 | + const slaveInfo7 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo7')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo7')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo7'); /* 表十 */ | |
| 2464 | + const slaveInfo8 = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo8')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveInfo8')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveInfo8'); /* 表十一 */ | |
| 2465 | + const zSlaveChild = masterConfig && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave) && commonUtils.isNotEmptyArr(masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveChild')) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName === 'zSlaveChild')[0].showName : commonFunc.showMessage(app.commonConst, 'zSlaveChild'); /* 子表 */ | |
| 2466 | + | |
| 2467 | + const slaveInfoArr = [ | |
| 2468 | + slaveInfo0, | |
| 2469 | + slaveInfo1, | |
| 2470 | + slaveInfo2, | |
| 2471 | + slaveInfo3, | |
| 2472 | + slaveInfo4, | |
| 2473 | + slaveInfo5, | |
| 2474 | + slaveInfo6, | |
| 2475 | + slaveInfo7, | |
| 2476 | + slaveInfo8 | |
| 2477 | + ]; | |
| 2478 | + | |
| 2428 | 2479 | const getTabPaneExtra = (tableName) => { |
| 2429 | 2480 | const { |
| 2430 | 2481 | [`${tableName}Data`]: data, |
| ... | ... | @@ -2561,10 +2612,22 @@ const BillComponent = Form.create({ |
| 2561 | 2612 | </TabPane> |
| 2562 | 2613 | {getTabPaneExtra('slave')} |
| 2563 | 2614 | { |
| 2615 | + slaveInfoList?.map((item, index) => { | |
| 2616 | + const slaveTableProps = slaveTablePropsList[`slaveTable${index}Props`]; | |
| 2617 | + const tabTitle = slaveInfoArr[index]; | |
| 2618 | + return ( | |
| 2619 | + <TabPane tab={tabTitle} className="xly-bill-list" key={30}> | |
| 2620 | + <StaticEditTable {...slaveTableProps} footer="hidden" setOpterationColumn="Y" /> | |
| 2621 | + </TabPane>); | |
| 2622 | + | |
| 2623 | + }) | |
| 2624 | + } | |
| 2625 | + | |
| 2626 | + { | |
| 2564 | 2627 | commonUtils.isNotEmptyObject(checkConfig) ? |
| 2565 | 2628 | ( |
| 2566 | 2629 | <> |
| 2567 | - <TabPane tab={CheckInfo} key={20} className="xly-bill-list"> | |
| 2630 | + <TabPane tab={CheckInfo} key={50} className="xly-bill-list"> | |
| 2568 | 2631 | <div className="TabPaneStyle"> |
| 2569 | 2632 | <StaticEditTable {...commonBusiness.getTableTypes('check', props)} /> |
| 2570 | 2633 | </div> | ... | ... |
src/components/Common/CommonBillDeliver.js
| ... | ... | @@ -12,7 +12,7 @@ import styles from '@/index.less'; |
| 12 | 12 | import CommonView from '@/components/Common/CommonView'; |
| 13 | 13 | import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ |
| 14 | 14 | import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ |
| 15 | -import commonConfig from '@/utils/config'; | |
| 15 | +import commonConfig from '@/utils/config'; | |
| 16 | 16 | import * as commonUtils from '@/utils/utils';/* 通用方法 */ |
| 17 | 17 | import * as commonServices from '@/services/services';/* 服务类 */ |
| 18 | 18 | ... | ... |
src/components/Common/CommonBillEvent.js
| ... | ... | @@ -143,6 +143,61 @@ export default (ChildComponent) => { |
| 143 | 143 | /* bGrd代表是否是表格 */ |
| 144 | 144 | let slaveConfig = formData.filter(item => item.bGrd && item.sTbName && !item.sTbName.startsWith('sysbillcheckresult'))[0]; |
| 145 | 145 | let slaveColumn = commonFunc.getHeaderConfig(slaveConfig); |
| 146 | + | |
| 147 | + let addOtherState = {}; | |
| 148 | + let slaveInfoList = []; /* 父表格名配置集合 */ | |
| 149 | + let slaveChildInfoList = []; /* 子表格名配置集合 */ | |
| 150 | + | |
| 151 | + const addStateMap ={}; /* 所有表格配置集合 */ | |
| 152 | + addStateMap['slaveConfig'] = slaveConfig; | |
| 153 | + /* commonBill 可以一带N表 */ | |
| 154 | + const tableConfigArr = formData.filter(item => item.bGrd && item.bGrdVisible && !item.sGrd?.includes("_") | |
| 155 | + && item.sTbName !== 'sysbillcheckresult'); | |
| 156 | + | |
| 157 | + const slaveOtherConfigArr = []; | |
| 158 | + if(commonUtils.isNotEmptyArr(tableConfigArr)) { | |
| 159 | + tableConfigArr.forEach((item, iIndex) => { | |
| 160 | + if(iIndex > 0) { /* 去除第一个表, 第一个表是从表 */ | |
| 161 | + const iSlaveTag = iIndex - 1; | |
| 162 | + item.slaveNameTag = iSlaveTag; | |
| 163 | + slaveOtherConfigArr.push(item); | |
| 164 | + const slaveOtherConfigName = 'slave' + iSlaveTag + 'Config'; | |
| 165 | + let slaveOtherColumnName = 'slave' + iSlaveTag + 'Column'; | |
| 166 | + const onlyslaveTag= 'onlyslave' + iSlaveTag; | |
| 167 | + const slavePageSizeTag = 'slave' + iSlaveTag + 'PageSize'; | |
| 168 | + const slaveOtherColumn = commonFunc.getHeaderConfig(item); | |
| 169 | + addOtherState[slaveOtherConfigName] = item; | |
| 170 | + addOtherState[slaveOtherColumnName] = slaveOtherColumn; | |
| 171 | + addOtherState[onlyslaveTag] = true; | |
| 172 | + const slavePageSize = commonUtils.isNotEmptyObject(item) && commonUtils.isNotEmptyNumber(item.iPageSize) && item.iPageSize !== 0 ? | |
| 173 | + item.iPageSize : commonConfig.pageSize; | |
| 174 | + addOtherState[slavePageSizeTag] = slavePageSize; | |
| 175 | + } | |
| 176 | + | |
| 177 | + /* 封装父级表格 */ | |
| 178 | + let num = 0; | |
| 179 | + if(iIndex > 0) { | |
| 180 | + num = iIndex -1; | |
| 181 | + slaveInfoList.push(`slave${num}`); | |
| 182 | + addStateMap[`slave${num}Config`] = item; | |
| 183 | + } | |
| 184 | + /* 找到父级页签下面的子级页签数据集 */ | |
| 185 | + const childFormData = formData.filter(child => !child.bGrdVisible && child.sGrd && item.sChildTableName && item.sChildTableName.includes(child.sGrd) && child.sGrd !== 'slave' ); | |
| 186 | + if(commonUtils.isNotEmptyArr(childFormData)) { | |
| 187 | + childFormData.forEach((child, tag) => { | |
| 188 | + addOtherState[`slave${num}Child${tag}Config`] = child; | |
| 189 | + addStateMap[`slave${num}Child${tag}Config`] = child; | |
| 190 | + addOtherState[`slave${num}Child${tag}Column`] = commonFunc.getHeaderConfig(child); | |
| 191 | + const sChildName = child.showName; | |
| 192 | + slaveChildInfoList.push(`slave${num}Child${tag}-${sChildName}`); | |
| 193 | + }); | |
| 194 | + } | |
| 195 | + | |
| 196 | + | |
| 197 | + }); | |
| 198 | + addOtherState.slaveOtherConfigArr = slaveOtherConfigArr; | |
| 199 | + } | |
| 200 | + | |
| 146 | 201 | let checkConfig = {}; |
| 147 | 202 | if (formRoute === '/indexOee/commonOeeBill') { /* OEE单据没有审核表 */ |
| 148 | 203 | checkConfig = undefined; |
| ... | ... | @@ -362,6 +417,20 @@ export default (ChildComponent) => { |
| 362 | 417 | packColumn = commonFunc.getHeaderConfig(packConfig); |
| 363 | 418 | } |
| 364 | 419 | this.handleGetMemoData(controlConfig, materialsConfig, processConfig, colorConfig, packConfig); |
| 420 | + | |
| 421 | + if(commonUtils.isNotEmptyArr(slaveInfoList)) { | |
| 422 | + slaveInfoList.forEach( async(name, index) => { | |
| 423 | + const tbName = name.replace('Config', ''); | |
| 424 | + | |
| 425 | + let {[`${tbName}Config`]: tableConfig } = this.props; | |
| 426 | + if (commonUtils.isEmptyObject(tableConfig)) { | |
| 427 | + tableConfig = addStateMap[tbName +'Config'] | |
| 428 | + } | |
| 429 | + if (tableConfig && tableConfig.sTbName && tableConfig.sSqlStr !== "noQuery") { | |
| 430 | + this.handleGetOneMemoData(tbName, tableConfig); | |
| 431 | + } | |
| 432 | + }); | |
| 433 | + } | |
| 365 | 434 | this.props.onSaveState({ |
| 366 | 435 | controlConfig, |
| 367 | 436 | controlColumn, |
| ... | ... | @@ -421,6 +490,7 @@ export default (ChildComponent) => { |
| 421 | 490 | } |
| 422 | 491 | this.props.onSaveState({ |
| 423 | 492 | masterConfig, slaveConfig, slaveColumn, checkConfig, checkColumn, importConfig, importColumn, sId, pageLoading: false, ...addState, |
| 493 | + addStateMap, slaveInfoList, slaveChildInfoList, ...addOtherState | |
| 424 | 494 | }); |
| 425 | 495 | } else if (commonUtils.isEmptyObject(masterConfigOld) && formData.length === 1 && (sModelsType === 'cashier/financialTransfer' || sModelsType === 'purchase/purchaseEnquiry' || sModelsType === 'cashier/financialAdjustment' || sModelsType === 'print/printLabel' || sModelsType === 'complaint/complaint' || sModelsType === 'commonBill/onlyMaster') && formRoute.indexOf('indexOee') === -1) { |
| 426 | 496 | const config = {}; |
| ... | ... | @@ -513,7 +583,6 @@ export default (ChildComponent) => { |
| 513 | 583 | }); |
| 514 | 584 | } else if (formRoute.indexOf('productionReport') !== -1 && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && JSON.stringify(slaveSelectedRowKeys) !== JSON.stringify(currentSlaveSelectedRowKeys)) { |
| 515 | 585 | const addState = await this.handleGetDataOne('slave0', nextProps.slave0Config, null, null, null, null, nextProps, true); |
| 516 | - console.log(addState); | |
| 517 | 586 | this.props.onSaveState({ |
| 518 | 587 | ...addState, |
| 519 | 588 | }); |
| ... | ... | @@ -2024,7 +2093,10 @@ export default (ChildComponent) => { |
| 2024 | 2093 | if (!commonUtils.isEmpty(masterData)) { |
| 2025 | 2094 | /* 作废订单不能审核 */ |
| 2026 | 2095 | if (masterData.bInvalid) { |
| 2027 | - message.warning(gdsformconst.filter(item => (item.sName === 'sToVoid'))[0].showName); | |
| 2096 | + message.warning(commonFunc.showMessage(app.commonConst, 'sToVoid')); | |
| 2097 | + this.props.onSaveState({ | |
| 2098 | + loading: false, | |
| 2099 | + }); | |
| 2028 | 2100 | return ''; |
| 2029 | 2101 | } |
| 2030 | 2102 | /** 数据审核 */ |
| ... | ... | @@ -2195,7 +2267,8 @@ export default (ChildComponent) => { |
| 2195 | 2267 | /** toolbar保存 */ |
| 2196 | 2268 | handleSaveData = async (params) => { |
| 2197 | 2269 | const { |
| 2198 | - token, sModelsId, currentId, masterData, masterConfig, slaveConfig, checkConfig, billnosetting, app, sModelsType, controlConfig, materialsConfig, processConfig, colorConfig, packConfig, orderDetailConfig, dispatch, | |
| 2270 | + token, sModelsId, currentId, masterData, masterConfig, slaveConfig, checkConfig, billnosetting, app, sModelsType, controlConfig, | |
| 2271 | + materialsConfig, processConfig, colorConfig, packConfig, orderDetailConfig, dispatch, slaveInfoList, | |
| 2199 | 2272 | } = this.props; |
| 2200 | 2273 | const { userinfo } = app; |
| 2201 | 2274 | const { copyTo } = app.currentPane; |
| ... | ... | @@ -2260,6 +2333,15 @@ export default (ChildComponent) => { |
| 2260 | 2333 | } else if (commonUtils.isNotEmptyObject(orderDetailConfig)) { |
| 2261 | 2334 | await this.handleGetOneMemoData('orderDetail', orderDetailConfig); |
| 2262 | 2335 | } |
| 2336 | + if(commonUtils.isNotEmptyArr(slaveInfoList)) { | |
| 2337 | + slaveInfoList.forEach( async(name, index) => { | |
| 2338 | + const tbName = name.replace('Config', ''); | |
| 2339 | + const {[`${tbName}Config`]: tableConfig } = this.props; | |
| 2340 | + if (tableConfig && tableConfig.sTbName && tableConfig.sSqlStr !== "noQuery") { | |
| 2341 | + await this.handleGetOneMemoData(tbName, tableConfig); | |
| 2342 | + } | |
| 2343 | + }); | |
| 2344 | + } | |
| 2263 | 2345 | if (this.props.app.currentPane.refresh !== undefined) { |
| 2264 | 2346 | this.props.app.currentPane.refresh(); |
| 2265 | 2347 | } |
| ... | ... | @@ -2289,7 +2371,9 @@ export default (ChildComponent) => { |
| 2289 | 2371 | }); |
| 2290 | 2372 | } else { /* 验证成功 */ |
| 2291 | 2373 | const { |
| 2292 | - masterConfig, slaveConfig, slaveData, app, sModelsType, controlConfig, controlData, controlDelData, materialsConfig, materialsData, materialsDelData, processConfig, processData, processDelData, colorConfig, colorData, colorDelData, packConfig, packData, packDelData, orderDetailConfig, orderDetailData, orderDetailDelData, | |
| 2374 | + masterConfig, slaveConfig, slaveData, app, sModelsType, controlConfig, controlData, controlDelData, materialsConfig, | |
| 2375 | + materialsData, materialsDelData, processConfig, processData, processDelData, colorConfig, colorData, colorDelData, | |
| 2376 | + packConfig, packData, packDelData, orderDetailConfig, orderDetailData, orderDetailDelData, slaveInfoList, | |
| 2293 | 2377 | } = this.props; |
| 2294 | 2378 | let { slaveDelData } = this.props; |
| 2295 | 2379 | let { masterData } = this.props; |
| ... | ... | @@ -2530,6 +2614,17 @@ export default (ChildComponent) => { |
| 2530 | 2614 | if (!commonUtils.isEmpty(orderDetailConfig)) { |
| 2531 | 2615 | data.push(commonBusiness.mergeData('detail', orderDetailConfig.sTbName, orderDetailData, orderDetailDelData)); |
| 2532 | 2616 | } |
| 2617 | + if(commonUtils.isNotEmptyArr(slaveInfoList)){ | |
| 2618 | + slaveInfoList.forEach(name => { | |
| 2619 | + const tbName = name.replace('Config', ''); | |
| 2620 | + const {[`${tbName}Config`]: tableConfig, [`${tbName}Data`]: tableData, [`${tbName}DelData`]: tableDelData } = this.props; | |
| 2621 | + if (tableConfig && tableConfig.sTbName && tableConfig.sSqlStr !== "noQuery") { | |
| 2622 | + const tableDataNew = tbName === "master" ? [tableData] : tableData; | |
| 2623 | + data.push(commonBusiness.mergeData(tbName, tableConfig.sTbName, tableDataNew, tableDelData)); | |
| 2624 | + } | |
| 2625 | + }); | |
| 2626 | + } | |
| 2627 | + | |
| 2533 | 2628 | this.handleSaveData({ data, sClientType: '1', sSysLogSrcId: masterData.sId }); |
| 2534 | 2629 | } |
| 2535 | 2630 | }); |
| ... | ... | @@ -2734,9 +2829,10 @@ export default (ChildComponent) => { |
| 2734 | 2829 | /* 上一条、下一条、首条、末条 */ |
| 2735 | 2830 | handleSearchData = async (handleType) => { |
| 2736 | 2831 | const { |
| 2737 | - sModelsId, app, currentIndexFlag, currentPageNo, | |
| 2832 | + sModelsId, app, currentIndexFlag, currentPageNo, masterData, masterConfig, slaveConfig, checkConfig | |
| 2738 | 2833 | } = this.props; |
| 2739 | - | |
| 2834 | + let { sBillIdsArray = []} = this.props; | |
| 2835 | + let { currentId } = this.props; | |
| 2740 | 2836 | // 电化铝烫金资料 特殊处理 |
| 2741 | 2837 | if (sModelsId === '12710101116943091653680') { |
| 2742 | 2838 | this.handleSearchData1(handleType); |
| ... | ... | @@ -2751,40 +2847,81 @@ export default (ChildComponent) => { |
| 2751 | 2847 | if (currentIndex === undefined) { |
| 2752 | 2848 | currentPosition = 1; |
| 2753 | 2849 | } |
| 2754 | - if (handleType === 'first') { | |
| 2755 | - currentPosition = 1; | |
| 2756 | - } else if (handleType === 'end') { | |
| 2757 | - currentPosition = pages.total; | |
| 2758 | - } | |
| 2850 | + // if (handleType === 'first') { | |
| 2851 | + // currentPosition = 1; | |
| 2852 | + // } else if (handleType === 'end') { | |
| 2853 | + // currentPosition = pages.total; | |
| 2854 | + // } | |
| 2759 | 2855 | if (!commonUtils.isNum(currentPosition)) { // 如果是列表直接点增加,就跳到第一条去 |
| 2760 | 2856 | currentPosition = 1; |
| 2761 | 2857 | } |
| 2858 | + let bExist = false; | |
| 2859 | + /* 如果sBillIdsArray已存在 则不请求 */ | |
| 2860 | + if(commonUtils.isNotEmptyArr(sBillIdsArray) && sBillIdsArray.length > 0) { | |
| 2861 | + const index = sBillIdsArray.indexOf(currentId); | |
| 2862 | + if(index > -1) { | |
| 2863 | + if ("next".includes(handleType)) { | |
| 2864 | + currentPosition = index + 1; | |
| 2865 | + if(currentPosition > sBillIdsArray.length - 1 ){ | |
| 2866 | + message.warn('当前已经是最后一条'); | |
| 2867 | + return ; | |
| 2868 | + } | |
| 2869 | + } else if ("up".includes(handleType)) { | |
| 2870 | + if(index === 0){ | |
| 2871 | + message.warn('当前已经是第一条!'); | |
| 2872 | + return ; | |
| 2873 | + } | |
| 2874 | + currentPosition = index - 1; | |
| 2875 | + } else if ("first".includes(handleType)) { | |
| 2876 | + currentPosition = 0; | |
| 2877 | + } else if ("end".includes(handleType)) { | |
| 2878 | + currentPosition = sBillIdsArray.length - 1; | |
| 2879 | + } | |
| 2880 | + currentId = sBillIdsArray[currentPosition]; | |
| 2881 | + currentPosition = currentPosition + 1; | |
| 2882 | + bExist = true; | |
| 2883 | + } else { | |
| 2884 | + bExist = false; | |
| 2885 | + } | |
| 2886 | + } | |
| 2887 | + /* 如果是第一次请求 */ | |
| 2888 | + if(!bExist) { | |
| 2889 | + const value = { | |
| 2890 | + sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, | |
| 2891 | + sUpId: masterData?.sId, | |
| 2892 | + }; | |
| 2893 | + const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; | |
| 2894 | + /* 接收返回值 */ | |
| 2895 | + const { data } = await commonServices.postValueService(token, value, url); | |
| 2896 | + /* 接收返回值 */ | |
| 2897 | + /* 成功的话刷新页面(同步主表和从表数据),不成功就弹出错误提示 */ | |
| 2898 | + if (data.code === 1) { | |
| 2899 | + /* 数据查询成功 */ | |
| 2900 | + const returnData = data.dataset.rows[0]; | |
| 2901 | + | |
| 2902 | + /* 拿到接口返回的sBillids */ | |
| 2903 | + console.log('returnData', returnData); | |
| 2904 | + const sBillIds = returnData.sBillIds; | |
| 2905 | + if(commonUtils.isNotEmptyArr(sBillIds)) { | |
| 2906 | + sBillIdsArray = sBillIds; | |
| 2907 | + } | |
| 2908 | + currentId = returnData.sId; | |
| 2909 | + currentPosition = returnData.currentPosition; | |
| 2910 | + } else { /* 失败 */ | |
| 2911 | + this.props.getServiceError(data); | |
| 2912 | + return false; | |
| 2913 | + } | |
| 2762 | 2914 | |
| 2763 | - const value = { | |
| 2764 | - sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, | |
| 2765 | - }; | |
| 2766 | - const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; | |
| 2767 | - /* 接收返回值 */ | |
| 2768 | - const { data } = await commonServices.postValueService(token, value, url); | |
| 2769 | - /* 接收返回值 */ | |
| 2770 | - /* 成功的话刷新页面(同步主表和从表数据),不成功就弹出错误提示 */ | |
| 2771 | - if (data.code === 1) { | |
| 2772 | - /* 数据查询成功 */ | |
| 2773 | - const returnData = data.dataset.rows[0]; | |
| 2774 | - const { masterConfig, slaveConfig, checkConfig } = this.props; | |
| 2775 | - this.props.onSaveState({ | |
| 2776 | - currentIndexFlag: true, | |
| 2777 | - currentPageNo: returnData.currentPosition, | |
| 2778 | - currentId: returnData.sId, | |
| 2779 | - searchUpDownData: {}, | |
| 2780 | - slaveSelectedRowKeys: [], | |
| 2781 | - }); | |
| 2782 | - this.handleGetData(masterConfig, slaveConfig, checkConfig); | |
| 2783 | - return true; | |
| 2784 | - } else { /* 失败 */ | |
| 2785 | - this.props.getServiceError(data); | |
| 2786 | - return false; | |
| 2787 | 2915 | } |
| 2916 | + this.props.onSaveState({ | |
| 2917 | + currentIndexFlag: true, | |
| 2918 | + currentPageNo: currentPosition, | |
| 2919 | + currentId, | |
| 2920 | + searchUpDownData: {}, | |
| 2921 | + slaveSelectedRowKeys: [], | |
| 2922 | + sBillIdsArray, | |
| 2923 | + }, () => this.handleGetData(masterConfig, slaveConfig, checkConfig)); | |
| 2924 | + return true; | |
| 2788 | 2925 | }; |
| 2789 | 2926 | |
| 2790 | 2927 | // 电化铝烫金资料 特殊处理 上一条、下一条、首条、末条 |
| ... | ... | @@ -2932,7 +3069,11 @@ export default (ChildComponent) => { |
| 2932 | 3069 | return; |
| 2933 | 3070 | } |
| 2934 | 3071 | // |
| 2935 | - onGetDataOk(masterConfig, slaveConfig, checkConfig); | |
| 3072 | + const bChanged = commonBusiness.handleGetChanged(that.props) ; | |
| 3073 | + if(bChanged) { | |
| 3074 | + onGetDataOk(masterConfig, slaveConfig, checkConfig); | |
| 3075 | + } | |
| 3076 | + | |
| 2936 | 3077 | onSaveStateOk({ enabled: false }); |
| 2937 | 3078 | if (commonUtils.isNotEmptyObject(copyTo)) { |
| 2938 | 3079 | const { slaveData } = copyTo; |
| ... | ... | @@ -3051,7 +3192,7 @@ export default (ChildComponent) => { |
| 3051 | 3192 | tableData = commonUtils.isEmptyObject(tableData) ? [] : tableData; |
| 3052 | 3193 | const tableDataRow = this.props.onDataRowAdd(name, true); |
| 3053 | 3194 | /* 添加行的业务处理拿出去 */ |
| 3054 | - if (sModelsType.includes('sales/')) { | |
| 3195 | + if (sModelsType.includes('sales/') && name === 'slave') { | |
| 3055 | 3196 | if (commonUtils.isEmptyStr(masterData.sCustomerId)) { |
| 3056 | 3197 | const iIndex = masterConfig.gdsconfigformslave.findIndex(item => ((item.sName === 'sCustomerId' || item.sName === 'sCustomerNo' || item.sName === 'sCustomerName') && item.bVisible)); |
| 3057 | 3198 | if (iIndex > -1) { |
| ... | ... | @@ -3222,6 +3363,244 @@ export default (ChildComponent) => { |
| 3222 | 3363 | } |
| 3223 | 3364 | }; |
| 3224 | 3365 | |
| 3366 | + // 递归函数,用于获取所有子数据 | |
| 3367 | + getChildrenData = (parentId, data, visitedNodes = new Set()) => { | |
| 3368 | + const children = []; | |
| 3369 | + | |
| 3370 | + // 防止循环引用 | |
| 3371 | + if (visitedNodes.has(parentId)) { | |
| 3372 | + console.warn(`检测到循环引用,父节点ID: ${parentId}`); | |
| 3373 | + return children; | |
| 3374 | + } | |
| 3375 | + visitedNodes.add(parentId); | |
| 3376 | + | |
| 3377 | + data.forEach(item => { | |
| 3378 | + if (item.sControlParentId === parentId) { | |
| 3379 | + children.push(item); | |
| 3380 | + const subChildren = this.getChildrenData(item.sNodeId, data, visitedNodes); | |
| 3381 | + children.push(...subChildren); | |
| 3382 | + } | |
| 3383 | + }); | |
| 3384 | + | |
| 3385 | + visitedNodes.delete(parentId); // 回溯时移除标记 | |
| 3386 | + return children; | |
| 3387 | + }; | |
| 3388 | + | |
| 3389 | + | |
| 3390 | + buildAllIds = (data) => { | |
| 3391 | + const idMap = new Map(); // 存储节点ID到完整路径的映射 | |
| 3392 | + const visitedNodes = new Set(); // 跟踪已访问的节点 | |
| 3393 | + | |
| 3394 | + // 获取所有根节点(确保没有循环引用) | |
| 3395 | + const rootNodes = data.filter(item => { | |
| 3396 | + // 确保sControlParentId不存在或对应的父节点不存在 | |
| 3397 | + return !item.sControlParentId || !data.some(parent => parent.sNodeId === item.sControlParentId); | |
| 3398 | + }); | |
| 3399 | + | |
| 3400 | + // 递归构建每个节点的sAllId | |
| 3401 | + const buildPath = (node, path = '') => { | |
| 3402 | + if (visitedNodes.has(node.sNodeId)) { | |
| 3403 | + console.warn(`检测到循环引用,节点ID: ${node.sNodeId}`); | |
| 3404 | + return; // 避免无限递归 | |
| 3405 | + } | |
| 3406 | + visitedNodes.add(node.sNodeId); | |
| 3407 | + | |
| 3408 | + // 根节点的sAllId直接等于sNodeId | |
| 3409 | + const currentPath = !node.sControlParentId ? node.sNodeId : (path ? `${path},${node.sNodeId}` : node.sNodeId); | |
| 3410 | + idMap.set(node.sNodeId, currentPath); | |
| 3411 | + node.sAllId = currentPath; | |
| 3412 | + | |
| 3413 | + // 处理子节点 | |
| 3414 | + const children = data.filter(item => item.sControlParentId === node.sNodeId); | |
| 3415 | + children.forEach(child => { | |
| 3416 | + if (!visitedNodes.has(child.sNodeId)) { // 只处理未访问过的子节点 | |
| 3417 | + buildPath(child, currentPath); | |
| 3418 | + } | |
| 3419 | + }); | |
| 3420 | + | |
| 3421 | + visitedNodes.delete(node.sNodeId); // 回溯时移除标记 | |
| 3422 | + }; | |
| 3423 | + | |
| 3424 | + rootNodes.forEach(root => { | |
| 3425 | + if (!idMap.has(root.sNodeId)) { // 只处理未处理的根节点 | |
| 3426 | + buildPath(root); | |
| 3427 | + } | |
| 3428 | + }); | |
| 3429 | + | |
| 3430 | + // 处理孤立节点(没有父节点但sControlParentId不为空) | |
| 3431 | + data.forEach(item => { | |
| 3432 | + if (!idMap.has(item.sNodeId)) { | |
| 3433 | + item.sAllId = item.sNodeId; // 设为自身ID | |
| 3434 | + console.warn(`发现孤立节点: ${item.sNodeId}, 父节点: ${item.sControlParentId}`); | |
| 3435 | + } | |
| 3436 | + }); | |
| 3437 | + | |
| 3438 | + return data; | |
| 3439 | + }; | |
| 3440 | + | |
| 3441 | + /* 工单工艺卡复制全部 */ | |
| 3442 | + handleTableWorkCopyAll = (name, isWait) => { | |
| 3443 | + const { | |
| 3444 | + [`${name}SelectedRowKeys`]: tableSelectedRowKeys, materials0Data: materialsData, app, packData = [], slaveData, | |
| 3445 | + } = this.props; | |
| 3446 | + let { [`${name}Data`]: tableData, processData } = this.props; | |
| 3447 | + if (name === 'control') { | |
| 3448 | + const { | |
| 3449 | + [`${name}SelectedRowKeys`]: treeSelectedKeys, | |
| 3450 | + } = this.props; | |
| 3451 | + const tableSelectedNewRowKeys = []; | |
| 3452 | + if (commonUtils.isEmptyArr(treeSelectedKeys)) { | |
| 3453 | + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseCopyData'));/* 请选择复制数据 */ | |
| 3454 | + } else { | |
| 3455 | + /* 获取复制节点下的所有子节点 */ | |
| 3456 | + if (commonUtils.isNotEmptyArr(tableData)) { | |
| 3457 | + // tableData = this.buildAllIds([...tableData]); // 重新构建sAllId | |
| 3458 | + const tableRow = tableData.find(item => item.sId === treeSelectedKeys[0]); | |
| 3459 | + if(commonUtils.isNotEmptyObject(tableRow)) { | |
| 3460 | + const controlChildData = tableData.filter(item => commonUtils.isNotEmptyObject(item.sControlParentId) && item.sControlParentId === tableRow.sNodeId); | |
| 3461 | + console.log('ziji', controlChildData); | |
| 3462 | + controlChildData.forEach((itemNew) => { | |
| 3463 | + tableSelectedRowKeys.push(itemNew.sId); | |
| 3464 | + }); | |
| 3465 | + } | |
| 3466 | + | |
| 3467 | + } | |
| 3468 | + const treeCopyNodes = new Map(); // 存储原节点ID到新节点ID的映射 | |
| 3469 | + const newNodes = []; // 存储所有新节点 | |
| 3470 | + | |
| 3471 | + for (const sId of tableSelectedRowKeys) { | |
| 3472 | + const tableDataIndex = tableData.findIndex(item => item.sId === sId); | |
| 3473 | + if (tableDataIndex > -1) { | |
| 3474 | + const originalNode = tableData[tableDataIndex]; | |
| 3475 | + const tableDataRow = JSON.parse(JSON.stringify(originalNode)); | |
| 3476 | + | |
| 3477 | + // 生成新ID | |
| 3478 | + const newId = commonUtils.createSid(); | |
| 3479 | + tableDataRow.sId = newId; | |
| 3480 | + tableDataRow.sNodeId = commonUtils.createSid(); | |
| 3481 | + tableDataRow.handleType = 'add'; | |
| 3482 | + tableDataRow.key = tableDataRow.sId; | |
| 3483 | + tableDataRow.sPartsName = `${tableData[tableDataIndex].sPartsName}new`; | |
| 3484 | + tableDataRow.sCombinedMemo = originalNode.sCombinedMemo; | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + // 处理层级关系 - 修改这里 | |
| 3488 | + if (originalNode.sControlParentId) { | |
| 3489 | + // 如果父节点已被复制,则从映射中获取新的父节点ID | |
| 3490 | + if (treeCopyNodes.has(originalNode.sControlParentId)) { | |
| 3491 | + tableDataRow.sControlParentId = treeCopyNodes.get(originalNode.sControlParentId); | |
| 3492 | + } else { | |
| 3493 | + // 否则保持原来的父节点ID | |
| 3494 | + tableDataRow.sControlParentId = originalNode.sControlParentId; | |
| 3495 | + } | |
| 3496 | + } | |
| 3497 | + // 存储映射关系和新节点 | |
| 3498 | + treeCopyNodes.set(originalNode.sNodeId, tableDataRow.sNodeId); | |
| 3499 | + | |
| 3500 | + const iOrderArr = []; | |
| 3501 | + tableData.forEach((item) => { | |
| 3502 | + const iOrder = commonUtils.isNotEmptyNumber(item.iOrder) ? item.iOrder : 0; /* 获取tableData中iOrder最大值 */ | |
| 3503 | + iOrderArr.push(iOrder); | |
| 3504 | + }); | |
| 3505 | + const iOrderMax = Math.max(...iOrderArr); | |
| 3506 | + tableDataRow.iOrder = commonUtils.isNotEmptyArr(tableData) ? iOrderMax + 1 : 0; | |
| 3507 | + if (commonUtils.isNotEmptyObject(tableDataRow.sCombinedMemo)) { | |
| 3508 | + const jsonStr = tableDataRow.sCombinedMemo; | |
| 3509 | + if (commonUtils.isNotEmptyObject(jsonStr) && commonUtils.isJSON(jsonStr)) { | |
| 3510 | + const JsonData = JSON.parse(jsonStr); | |
| 3511 | + if(JsonData.length > 1) { /* 超过1条不复制 合版信息 */ | |
| 3512 | + tableDataRow.sCombinedMemo = ''; | |
| 3513 | + } | |
| 3514 | + | |
| 3515 | + } | |
| 3516 | + | |
| 3517 | + } | |
| 3518 | + if (isWait) { | |
| 3519 | + return tableDataRow; | |
| 3520 | + } else if (commonUtils.isNotEmptyObject(tableDataRow)) { | |
| 3521 | + tableData.push(tableDataRow); | |
| 3522 | + packData.filter(item => item.sControlId === sId).forEach((item) => { /* 复制合版信息 */ | |
| 3523 | + const packRow = JSON.parse(JSON.stringify(item)); | |
| 3524 | + packRow.sId = commonUtils.createSid(); | |
| 3525 | + packRow.handleType = 'add'; | |
| 3526 | + packRow.sControlId = tableDataRow.sId; | |
| 3527 | + packData.push(packRow); | |
| 3528 | + }); | |
| 3529 | + processData.filter(item => item.sControlId === sId && item.sType !== '3').forEach((item) => { | |
| 3530 | + const processRow = JSON.parse(JSON.stringify(item)); | |
| 3531 | + processRow.sId = commonUtils.createSid(); | |
| 3532 | + processRow.handleType = 'add'; | |
| 3533 | + processRow.sControlId = tableDataRow.sId; | |
| 3534 | + processRow.sPartsName = tableDataRow.sPartsName; | |
| 3535 | + processRow.sSrcProcessTbId = item.sId; | |
| 3536 | + processData.push(processRow); | |
| 3537 | + }); | |
| 3538 | + processData = this.sortData(tableData, processData); | |
| 3539 | + materialsData.filter(item => item.sControlId === sId && item.sType !== '2').forEach((materialsItem) => { | |
| 3540 | + const materialsRow = JSON.parse(JSON.stringify(materialsItem)); | |
| 3541 | + materialsRow.sId = commonUtils.createSid(); | |
| 3542 | + materialsRow.handleType = 'add'; | |
| 3543 | + materialsRow.sControlId = tableDataRow.sId; | |
| 3544 | + materialsRow.sPartsName = tableDataRow.sPartsName; | |
| 3545 | + materialsRow.bPurchaseApplyComplete = 0; | |
| 3546 | + materialsRow.dPurchaseApplyAuxiliaryQty = 0; | |
| 3547 | + materialsRow.dPurchaseApplyQty = 0; | |
| 3548 | + materialsRow.bPurchaseComplete = 0; | |
| 3549 | + materialsRow.dPurchaseAuxiliaryQty = 0; | |
| 3550 | + materialsRow.dPurchaseQty = 0; | |
| 3551 | + materialsRow.dProductionAuxiliaryQty = 0; | |
| 3552 | + materialsRow.dProductionQty = 0; | |
| 3553 | + materialsRow.bProductionComplete = 0; | |
| 3554 | + | |
| 3555 | + materialsRow.dProductionApplyAuxiliaryQty = 0; | |
| 3556 | + materialsRow.dProductionApplyQty = 0; | |
| 3557 | + materialsRow.bProductionApplyComplete = 0; | |
| 3558 | + | |
| 3559 | + materialsRow.bComComplete = 0; | |
| 3560 | + materialsRow.dComAuxiliaryQty = 0; | |
| 3561 | + materialsRow.dComQty = 0; | |
| 3562 | + // 材料对应工序的ID要变化 | |
| 3563 | + if (commonUtils.isNotEmptyArr(processData)) { | |
| 3564 | + const iProcessIndex = processData.findIndex(item => item.sControlId === tableDataRow.sId && item.sSrcProcessTbId === materialsItem.sProcessTbId); | |
| 3565 | + if (iProcessIndex > -1) { | |
| 3566 | + materialsRow.sProcessTbId = processData[iProcessIndex].sId; | |
| 3567 | + } | |
| 3568 | + } | |
| 3569 | + materialsData.push(materialsRow); | |
| 3570 | + }); | |
| 3571 | + | |
| 3572 | + if (commonUtils.isNotEmptyObject(newId)) { | |
| 3573 | + tableSelectedNewRowKeys.push(newId); | |
| 3574 | + } | |
| 3575 | + // if (commonUtils.isNotEmptyArr(slaveData)) { | |
| 3576 | + // slaveData.forEach((item, index) => { | |
| 3577 | + // /* 合版信息表增加一条从表数据 */ | |
| 3578 | + // const packDataRow = this.handlePackDataAdd(item, index, tableDataRow.sId, 'add'); | |
| 3579 | + // if (commonUtils.isNotEmptyObject(packDataRow)) { | |
| 3580 | + // // packDataRow.dCombineQty = 1; | |
| 3581 | + // packData.push(packDataRow); | |
| 3582 | + // } | |
| 3583 | + // }); | |
| 3584 | + // } | |
| 3585 | + | |
| 3586 | + } | |
| 3587 | + } | |
| 3588 | + } | |
| 3589 | + | |
| 3590 | + } | |
| 3591 | + this.props.onSaveState({ | |
| 3592 | + [`${name}Data`]: tableData, | |
| 3593 | + [`${name}Pagination`]: { total: tableData.length, current: 9999 }, | |
| 3594 | + [`${name}SelectedRowKeys`]: tableSelectedNewRowKeys, | |
| 3595 | + treeSelectedKeys: tableSelectedNewRowKeys, | |
| 3596 | + materialsSelectedRowKeys: [], | |
| 3597 | + materials0Data: materialsData, | |
| 3598 | + processData, | |
| 3599 | + packData, | |
| 3600 | + }); | |
| 3601 | + | |
| 3602 | + } | |
| 3603 | + }; | |
| 3225 | 3604 | |
| 3226 | 3605 | /** 复制全部 */ |
| 3227 | 3606 | handleTableCopyAll = (name, isWait, isTree) => { |
| ... | ... | @@ -3310,6 +3689,10 @@ export default (ChildComponent) => { |
| 3310 | 3689 | } |
| 3311 | 3690 | } |
| 3312 | 3691 | } else if (name === 'control') { |
| 3692 | + if(location.pathname.includes('TableTreeNew') || location.pathname.includes('ResearchTableTree')){ | |
| 3693 | + this.handleTableWorkCopyAll(name, isWait, isTree); | |
| 3694 | + return; | |
| 3695 | + } | |
| 3313 | 3696 | const { |
| 3314 | 3697 | [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, |
| 3315 | 3698 | } = this.props; |
| ... | ... | @@ -4591,7 +4974,7 @@ export default (ChildComponent) => { |
| 4591 | 4974 | if (sFieldName === 'sSupplyId' || sFieldName === 'sSupplyNo' || sFieldName === 'sSupplyName' || sFieldName === 'sWareHouseId' || sFieldName === 'sWareHouseNo' || sFieldName === 'sWareHouseName' || |
| 4592 | 4975 | sFieldName === 'sLocationId' || sFieldName === 'sLocationNo' || sFieldName === 'sLocationName' || |
| 4593 | 4976 | sFieldName === 'sWareHouseLocationId' || sFieldName === 'sWareHouseLocationNo' || sFieldName === 'sWareHouseLocationName' || sFieldName === 'tDeliverDate' || |
| 4594 | - sFieldName === 'sCurrency' || sFieldName === 'dCurrencyRate') { | |
| 4977 | + sFieldName === 'sCurrency' || sFieldName === 'dCurrencyRate' || sFieldName ==='sCurrencyName') { | |
| 4595 | 4978 | const slaveDataNew = []; |
| 4596 | 4979 | const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; |
| 4597 | 4980 | for (const item of slaveData) { |
| ... | ... | @@ -4631,7 +5014,7 @@ export default (ChildComponent) => { |
| 4631 | 5014 | } else { |
| 4632 | 5015 | tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'sTaxId', returnData.masterData, tableDataRow); |
| 4633 | 5016 | } |
| 4634 | - } else if (sFieldName === 'sCurrency' || sFieldName === 'dCurrencyRate') { | |
| 5017 | + } else if (sFieldName === 'sCurrency' || sFieldName === 'dCurrencyRate' || sFieldName ==='sCurrencyName') { | |
| 4635 | 5018 | tableDataRow = commonBusiness.getCalculateAllMoney(app, models, `dN${models}Money`, returnData.masterData, tableDataRow); |
| 4636 | 5019 | tableDataRow.handleType = commonUtils.isEmpty(tableDataRow.handleType) ? 'update' : tableDataRow.handleType; |
| 4637 | 5020 | } |
| ... | ... | @@ -8591,6 +8974,7 @@ export default (ChildComponent) => { |
| 8591 | 8974 | materials0Data.push(tableDataRowAdd); |
| 8592 | 8975 | }); |
| 8593 | 8976 | } |
| 8977 | + console.log('222', materials0Data, copyToAssignField); | |
| 8594 | 8978 | |
| 8595 | 8979 | if(commonUtils.isNotEmptyArr(materials0Data) && location.pathname.includes('processCardPackTableTree')) { |
| 8596 | 8980 | /* 根据配置过滤数据 */ |
| ... | ... | @@ -8809,7 +9193,7 @@ export default (ChildComponent) => { |
| 8809 | 9193 | } |
| 8810 | 9194 | } else if(selectConfig.sControlName && selectConfig.sControlName.includes('BtnPopupMaterials')) { /* 报价单工序表放大镜 选择材料 */ |
| 8811 | 9195 | /* materials1ChildData:油墨, materials2ChildData:电化铝 */ |
| 8812 | - let { materials1Data, materials1ChildData, materials2Data, materials2ChildData, materials0Data } = this.props; | |
| 9196 | + let { materials1Data, materials1ChildData, materials2Data, materials2ChildData, materials0Data, processData, processSelectedRowKeys } = this.props; | |
| 8813 | 9197 | let materialsOtherData = []; |
| 8814 | 9198 | |
| 8815 | 9199 | if(commonUtils.isEmptyArr(materials0Data)){ |
| ... | ... | @@ -8857,83 +9241,126 @@ export default (ChildComponent) => { |
| 8857 | 9241 | if (commonUtils.isEmpty(materials2ChildData)) { |
| 8858 | 9242 | materials2ChildData = []; |
| 8859 | 9243 | } |
| 8860 | - const selectFilterData1 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.youmo); | |
| 8861 | - const selectFilterData1Left = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.zsm); | |
| 8862 | - // const selectFilterData1 = selectData.filter(item => item.sZmldlName === '纸张'); | |
| 8863 | - const selectFilterData2 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.dhl ); | |
| 8864 | - | |
| 8865 | - const selectFilterDataOther = selectData.filter(item => item.sZmldlName !== sMaterialsClassfiy.youmo && | |
| 8866 | - item.sZmldlName !== sMaterialsClassfiy.zsm && item.sZmldlName !== sMaterialsClassfiy.dhl ); /* 除了油墨,专色墨,电化铝之外的物料大类 */ | |
| 8867 | - | |
| 8868 | - /* 自动专色墨 */ | |
| 8869 | - if(commonUtils.isNotEmptyArr(selectFilterData1Left)) { | |
| 8870 | - selectFilterData1Left.forEach((item, index) => { | |
| 8871 | - const newCopyTo = {}; | |
| 8872 | - newCopyTo.master = masterData; | |
| 8873 | - if (iIndex > -1) { | |
| 8874 | - newCopyTo.materials1Child = item; | |
| 8875 | - } | |
| 8876 | - let tableDataRowAdd = this.handleTableAdd('materials1', true); | |
| 8877 | - item.handleType = 'add'; | |
| 8878 | - // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 8879 | - tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1Left, item) }; // 取赋值字段 | |
| 8880 | - tableDataRowAdd.sId = commonUtils.createSid(); | |
| 8881 | - tableDataRowAdd.sParentId = masterData.sId; | |
| 8882 | - tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 8883 | - materials1Data.push(tableDataRowAdd); | |
| 8884 | - }); | |
| 8885 | - } | |
| 8886 | - | |
| 8887 | - /* 油墨 */ | |
| 8888 | - if(commonUtils.isNotEmptyArr(selectFilterData1)) { | |
| 8889 | - selectFilterData1.forEach((item, index) => { | |
| 8890 | - const newCopyTo = {}; | |
| 8891 | - newCopyTo.master = masterData; | |
| 8892 | - if (iIndex > -1) { | |
| 8893 | - newCopyTo.materials1Child = item; | |
| 8894 | - } | |
| 8895 | - let tableDataRowAdd = this.handleTableAdd('materials1Child', true); | |
| 8896 | - item.handleType = 'add'; | |
| 8897 | - // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 8898 | - tableDataRowAdd = {...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1, item)}; // 取赋值字段 | |
| 8899 | - tableDataRowAdd.sId = commonUtils.createSid(); | |
| 8900 | - tableDataRowAdd.sParentId = masterData.sId; | |
| 8901 | - tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 8902 | - materials1ChildData.push(tableDataRowAdd); | |
| 8903 | - }); | |
| 8904 | - } | |
| 8905 | - | |
| 8906 | - /* 电化铝 */ | |
| 8907 | - if(commonUtils.isNotEmptyArr(selectFilterData2)) { | |
| 8908 | - selectFilterData2.forEach((item, index) => { | |
| 8909 | - const newCopyTo = {}; | |
| 8910 | - newCopyTo.master = masterData; | |
| 8911 | - if (iIndex > -1) { | |
| 8912 | - newCopyTo.materials2Child = item; | |
| 8913 | - } | |
| 8914 | - let tableDataRowAdd = this.handleTableAdd('materials2Child', true); | |
| 8915 | - item.handleType = 'add'; | |
| 8916 | - // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 8917 | - tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField2, item) }; // 取赋值字段 | |
| 8918 | - tableDataRowAdd.sId = commonUtils.createSid(); | |
| 8919 | - tableDataRowAdd.sParentId = masterData.sId; | |
| 8920 | - tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 8921 | - materials2ChildData.push(tableDataRowAdd); | |
| 8922 | - }); | |
| 8923 | - } | |
| 9244 | + // const selectFilterData1 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.youmo); | |
| 9245 | + // const selectFilterData1Left = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.zsm); | |
| 9246 | + // // const selectFilterData1 = selectData.filter(item => item.sZmldlName === '纸张'); | |
| 9247 | + // const selectFilterData2 = selectData.filter(item => item.sZmldlName === sMaterialsClassfiy.dhl ); | |
| 9248 | + // | |
| 9249 | + // const selectFilterDataOther = selectData.filter(item => item.sZmldlName !== sMaterialsClassfiy.youmo && | |
| 9250 | + // item.sZmldlName !== sMaterialsClassfiy.zsm && item.sZmldlName !== sMaterialsClassfiy.dhl ); /* 除了油墨,专色墨,电化铝之外的物料大类 */ | |
| 9251 | + // | |
| 9252 | + // /* 自动专色墨 */ | |
| 9253 | + // if(commonUtils.isNotEmptyArr(selectFilterData1Left)) { | |
| 9254 | + // selectFilterData1Left.forEach((item, index) => { | |
| 9255 | + // const newCopyTo = {}; | |
| 9256 | + // newCopyTo.master = masterData; | |
| 9257 | + // if (iIndex > -1) { | |
| 9258 | + // newCopyTo.materials1Child = item; | |
| 9259 | + // } | |
| 9260 | + // let tableDataRowAdd = this.handleTableAdd('materials1', true); | |
| 9261 | + // item.handleType = 'add'; | |
| 9262 | + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 9263 | + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1Left, item) }; // 取赋值字段 | |
| 9264 | + // tableDataRowAdd.sId = commonUtils.createSid(); | |
| 9265 | + // tableDataRowAdd.sParentId = masterData.sId; | |
| 9266 | + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 9267 | + // materials1Data.push(tableDataRowAdd); | |
| 9268 | + // }); | |
| 9269 | + // } | |
| 9270 | + // | |
| 9271 | + // /* 油墨 */ | |
| 9272 | + // if(commonUtils.isNotEmptyArr(selectFilterData1)) { | |
| 9273 | + // selectFilterData1.forEach((item, index) => { | |
| 9274 | + // const newCopyTo = {}; | |
| 9275 | + // newCopyTo.master = masterData; | |
| 9276 | + // if (iIndex > -1) { | |
| 9277 | + // newCopyTo.materials1Child = item; | |
| 9278 | + // } | |
| 9279 | + // let tableDataRowAdd = this.handleTableAdd('materials1Child', true); | |
| 9280 | + // item.handleType = 'add'; | |
| 9281 | + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 9282 | + // tableDataRowAdd = {...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField1, item)}; // 取赋值字段 | |
| 9283 | + // tableDataRowAdd.sId = commonUtils.createSid(); | |
| 9284 | + // tableDataRowAdd.sParentId = masterData.sId; | |
| 9285 | + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 9286 | + // materials1ChildData.push(tableDataRowAdd); | |
| 9287 | + // }); | |
| 9288 | + // } | |
| 9289 | + // | |
| 9290 | + // /* 电化铝 */ | |
| 9291 | + // if(commonUtils.isNotEmptyArr(selectFilterData2)) { | |
| 9292 | + // selectFilterData2.forEach((item, index) => { | |
| 9293 | + // const newCopyTo = {}; | |
| 9294 | + // newCopyTo.master = masterData; | |
| 9295 | + // if (iIndex > -1) { | |
| 9296 | + // newCopyTo.materials2Child = item; | |
| 9297 | + // } | |
| 9298 | + // let tableDataRowAdd = this.handleTableAdd('materials2Child', true); | |
| 9299 | + // item.handleType = 'add'; | |
| 9300 | + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 9301 | + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField2, item) }; // 取赋值字段 | |
| 9302 | + // tableDataRowAdd.sId = commonUtils.createSid(); | |
| 9303 | + // tableDataRowAdd.sParentId = masterData.sId; | |
| 9304 | + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 9305 | + // materials2ChildData.push(tableDataRowAdd); | |
| 9306 | + // }); | |
| 9307 | + // } | |
| 9308 | + // | |
| 9309 | + // if(commonUtils.isNotEmptyArr(materials2ChildData)) { | |
| 9310 | + // materials2ChildData.forEach((val) => { | |
| 9311 | + // const iIndex = materials2Data.findIndex(item => item.sMaterialsId === val.sMaterialsId && item.sControlId === val.sControlId && item.sMaterialsStyle === val.sMaterialsStyle); | |
| 9312 | + // if(iIndex === -1){ | |
| 9313 | + // materials2Data.push(val); | |
| 9314 | + // } | |
| 9315 | + // }); | |
| 9316 | + // } | |
| 9317 | + // | |
| 8924 | 9318 | |
| 8925 | - if(commonUtils.isNotEmptyArr(materials2ChildData)) { | |
| 8926 | - materials2ChildData.forEach((val) => { | |
| 8927 | - const iIndex = materials2Data.findIndex(item => item.sMaterialsId === val.sMaterialsId && item.sControlId === val.sControlId && item.sMaterialsStyle === val.sMaterialsStyle); | |
| 8928 | - if(iIndex === -1){ | |
| 8929 | - materials2Data.push(val); | |
| 8930 | - } | |
| 8931 | - }); | |
| 9319 | + // /* 其他材料 */ | |
| 9320 | + // if(commonUtils.isNotEmptyArr(selectFilterDataOther)) { | |
| 9321 | + // selectFilterDataOther.forEach((item, index) => { | |
| 9322 | + // const newCopyTo = {}; | |
| 9323 | + // newCopyTo.master = masterData; | |
| 9324 | + // if (iIndex > -1) { | |
| 9325 | + // newCopyTo.materials0 = item; | |
| 9326 | + // } | |
| 9327 | + // let tableDataRowAdd = this.handleTableAdd('materials0', true); | |
| 9328 | + // item.handleType = 'add'; | |
| 9329 | + // // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 9330 | + // tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 | |
| 9331 | + // tableDataRowAdd.sId = commonUtils.createSid(); | |
| 9332 | + // tableDataRowAdd.sParentId = masterData.sId; | |
| 9333 | + // tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ | |
| 9334 | + // if(commonUtils.isNotEmptyObject(processRow)) { | |
| 9335 | + // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessId) ) { | |
| 9336 | + // tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ | |
| 9337 | + // } | |
| 9338 | + // if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId) ) { | |
| 9339 | + // tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ | |
| 9340 | + // } | |
| 9341 | + // if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { | |
| 9342 | + // tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ | |
| 9343 | + // } | |
| 9344 | + // } | |
| 9345 | + // | |
| 9346 | + // materialsOtherData.push(tableDataRowAdd); | |
| 9347 | + // }); | |
| 9348 | + // } | |
| 9349 | + // const temp1Data = materials1Data.concat(materials1ChildData); | |
| 9350 | + // const temp2Data = temp1Data.concat(materials2Data); | |
| 9351 | + // | |
| 9352 | + // materials0Data = temp2Data.concat(materialsOtherData); | |
| 9353 | + let processRow = {}; | |
| 9354 | + if(commonUtils.isNotEmptyArr(processData) && commonUtils.isNotEmptyArr(processSelectedRowKeys)) { | |
| 9355 | + const iPIndex = processData.findIndex(item => processSelectedRowKeys.includes(item.sId)); | |
| 9356 | + if(iPIndex > -1) { | |
| 9357 | + processRow = processData[iPIndex]; | |
| 9358 | + } | |
| 8932 | 9359 | } |
| 8933 | - | |
| 8934 | - /* 其他材料 */ | |
| 8935 | - if(commonUtils.isNotEmptyArr(selectFilterDataOther)) { | |
| 8936 | - selectFilterDataOther.forEach((item, index) => { | |
| 9360 | + const selectFilterDataAll = selectData; /* 除了油墨,专色墨,电化铝之外的物料大类 */ | |
| 9361 | + /* 全部材料 */ | |
| 9362 | + if(commonUtils.isNotEmptyArr(selectFilterDataAll)) { | |
| 9363 | + selectFilterDataAll.forEach((item, index) => { | |
| 8937 | 9364 | const newCopyTo = {}; |
| 8938 | 9365 | newCopyTo.master = masterData; |
| 8939 | 9366 | if (iIndex > -1) { |
| ... | ... | @@ -8941,18 +9368,24 @@ export default (ChildComponent) => { |
| 8941 | 9368 | } |
| 8942 | 9369 | let tableDataRowAdd = this.handleTableAdd('materials0', true); |
| 8943 | 9370 | item.handleType = 'add'; |
| 8944 | - // tableDataRowAdd = { ...tableDataRowAdd, ...item }; // 取赋值字段 | |
| 8945 | 9371 | tableDataRowAdd = { ...tableDataRowAdd, ...commonFunc.getAssignFieldValue(copyToAssignField, item) }; // 取赋值字段 |
| 8946 | 9372 | tableDataRowAdd.sId = commonUtils.createSid(); |
| 8947 | 9373 | tableDataRowAdd.sParentId = masterData.sId; |
| 8948 | 9374 | tableDataRowAdd.sParentSlaveId = tableData[iIndex].sId; /* 选中从表的sId */ |
| 8949 | - materialsOtherData.push(tableDataRowAdd); | |
| 9375 | + if(commonUtils.isNotEmptyObject(processRow)) { | |
| 9376 | + if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessId) ) { | |
| 9377 | + tableDataRowAdd.sProcessId = processRow.sProcessId; /* 选中从表的sId */ | |
| 9378 | + } | |
| 9379 | + if(commonUtils.isEmptyObject(tableDataRowAdd.sProcessTbId) ) { | |
| 9380 | + tableDataRowAdd.sProcessTbId = processRow.sId; /* 选中从表的sId */ | |
| 9381 | + } | |
| 9382 | + if(commonUtils.isEmptyObject(tableDataRowAdd.sControlId) ) { | |
| 9383 | + tableDataRowAdd.sControlId = processRow.sControlId; /* 选中从表的sId */ | |
| 9384 | + } | |
| 9385 | + } | |
| 9386 | + materials0Data.push(tableDataRowAdd); | |
| 8950 | 9387 | }); |
| 8951 | 9388 | } |
| 8952 | - const temp1Data = materials1Data.concat(materials1ChildData); | |
| 8953 | - const temp2Data = temp1Data.concat(materials2Data); | |
| 8954 | - | |
| 8955 | - materials0Data = temp2Data.concat(materialsOtherData); | |
| 8956 | 9389 | |
| 8957 | 9390 | console.log('materials1Data1:', materials0Data, materials1Data, materials1ChildData, materials2ChildData, materialsOtherData); |
| 8958 | 9391 | |
| ... | ... | @@ -9493,7 +9926,8 @@ export default (ChildComponent) => { |
| 9493 | 9926 | const controlRow = this.handleGetSelectedData(props, 'control'); /* 控制表当前选中行 */ |
| 9494 | 9927 | let filterData = []; |
| 9495 | 9928 | if(commonUtils.isNotEmptyObject(controlRow) && commonUtils.isNotEmptyArr(processData)){ |
| 9496 | - filterData = processData.filter(item => item.sControlId === controlRow.sId); | |
| 9929 | + filterData = processData.filter(item => item.sType === '3' | |
| 9930 | + || (item.sType !== '3' && item.sControlId === controlRow.sId ) ); | |
| 9497 | 9931 | } |
| 9498 | 9932 | let tableDataRow = {}; |
| 9499 | 9933 | if( commonUtils.isNotEmptyArr(filterData)) { |
| ... | ... | @@ -9531,7 +9965,19 @@ export default (ChildComponent) => { |
| 9531 | 9965 | } |
| 9532 | 9966 | |
| 9533 | 9967 | } |
| 9534 | - | |
| 9968 | + /** 控制选择控制表时,显示部件工序与成品工序 */ | |
| 9969 | + handleFilterData = (name, dataIndex, value, record) => { | |
| 9970 | + if (value === undefined) { | |
| 9971 | + return true; | |
| 9972 | + } | |
| 9973 | + if (name === 'process') { | |
| 9974 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '3') || | |
| 9975 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 9976 | + } else { | |
| 9977 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '2') || | |
| 9978 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 9979 | + } | |
| 9980 | + }; | |
| 9535 | 9981 | render() { |
| 9536 | 9982 | const { masterData } = this.props; |
| 9537 | 9983 | const imgSrc = commonBusiness.handleAddIcon(masterData); |
| ... | ... | @@ -9609,6 +10055,7 @@ export default (ChildComponent) => { |
| 9609 | 10055 | onGetNewSelectData ={this.handleGetNewSelectData} |
| 9610 | 10056 | isSColorSerialMemo={this.isSColorSerialMemo} |
| 9611 | 10057 | onBtnParamPage ={this.handleBtnParamPage} |
| 10058 | + onFilterData ={this.handleFilterData} | |
| 9612 | 10059 | /> |
| 9613 | 10060 | ); |
| 9614 | 10061 | } | ... | ... |
src/components/Common/CommonCheckBill/index.js
| ... | ... | @@ -139,7 +139,7 @@ class CommonBill extends Component { |
| 139 | 139 | handleUploadChangeFile = async (info) => { |
| 140 | 140 | const { file } = info; |
| 141 | 141 | const { |
| 142 | - masterData, sModelsId, app, token, sModelsType, slaveConfig, slaveData, | |
| 142 | + masterData, sModelsId, sModelsType, slaveConfig, slaveData, | |
| 143 | 143 | } = this.props; |
| 144 | 144 | if (file.response) { |
| 145 | 145 | if (file.response.code === 1) { |
| ... | ... | @@ -202,16 +202,16 @@ class CommonBill extends Component { |
| 202 | 202 | }); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - if (!tableDataRow.dNProductPrice) { | |
| 206 | - tableDataRow.dNProductPrice = tableDataRow.dProductForeignPrice; | |
| 207 | - } | |
| 208 | - const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; | |
| 209 | - if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/')) { | |
| 210 | - tableDataRow = await this.props.onMaterialsChange(tableDataRow, sModelsId, masterData, {}, 'dAuxiliaryQty', app, token, models); | |
| 211 | - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, tableDataRow); | |
| 212 | - } else { | |
| 213 | - tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dProductQty', masterData, tableDataRow); | |
| 214 | - } | |
| 205 | + // if (!tableDataRow.dNProductPrice) { | |
| 206 | + // tableDataRow.dNProductPrice = tableDataRow.dProductForeignPrice; | |
| 207 | + // } | |
| 208 | + // const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; | |
| 209 | + // if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/')) { | |
| 210 | + // tableDataRow = await this.props.onMaterialsChange(tableDataRow, sModelsId, masterData, {}, 'dAuxiliaryQty', app, token, models); | |
| 211 | + // tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, tableDataRow); | |
| 212 | + // } else { | |
| 213 | + // tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dProductQty', masterData, tableDataRow); | |
| 214 | + // } | |
| 215 | 215 | }); |
| 216 | 216 | this.props.onSaveState({ slaveData: returnData, slaveDelData }); |
| 217 | 217 | } else { /* 失败s */ |
| ... | ... | @@ -2003,14 +2003,18 @@ const BillComponent = Form.create({ |
| 2003 | 2003 | </div> |
| 2004 | 2004 | { onlyMaster ? |
| 2005 | 2005 | <div id="slaveTabs" className={`${styles.bShow} bill-search-group commonCheckBill`}> |
| 2006 | - <div> | |
| 2007 | - <Avatar src={props.imgSrc} className={customStyles.bShowImg} /> | |
| 2006 | + <div className={`${styles.bShow}`}> | |
| 2007 | + <div> | |
| 2008 | + <Avatar src={props.imgSrc} /> | |
| 2009 | + </div> | |
| 2008 | 2010 | </div> |
| 2009 | 2011 | </div> : |
| 2010 | 2012 | <div id="slaveTabs" className="bill-search-group commonCheckBill"> |
| 2011 | - {/* <div> */} | |
| 2012 | - {/* <Avatar src={props.imgSrc} /> */} | |
| 2013 | - {/* </div> */} | |
| 2013 | + <div className={`${styles.bShow}`}> | |
| 2014 | + <div> | |
| 2015 | + <Avatar src={props.imgSrc} /> | |
| 2016 | + </div> | |
| 2017 | + </div> | |
| 2014 | 2018 | {/* {areaShow1 ? <Divider orientation="left" style={{ padding: '10px' }}>{areaShow1}</Divider> : '' } */} |
| 2015 | 2019 | <div className={styles.slaveTabs} tabBarStyle={{ margin: '0 10px' }} > |
| 2016 | 2020 | <div className="xly-bill-list"> | ... | ... |
src/components/Common/CommonCheckBillEvent.js
| ... | ... | @@ -2452,8 +2452,10 @@ export default (ChildComponent) => { |
| 2452 | 2452 | |
| 2453 | 2453 | return; |
| 2454 | 2454 | } |
| 2455 | - // | |
| 2456 | - onGetDataOk(masterConfig, slaveConfig, checkConfig); | |
| 2455 | + const bChanged = commonBusiness.handleGetChanged(that.props) ; | |
| 2456 | + if(bChanged) { | |
| 2457 | + onGetDataOk(masterConfig, slaveConfig, checkConfig); | |
| 2458 | + } | |
| 2457 | 2459 | onSaveStateOk({ enabled: false }); |
| 2458 | 2460 | if (commonUtils.isNotEmptyObject(copyTo)) { |
| 2459 | 2461 | const { slaveData } = copyTo; | ... | ... |
src/components/Common/CommonComponentNew/index.tsx
| 1 | -import React, { useEffect, useState } from 'react'; | |
| 2 | -import { Form, Input, InputNumber, Select, Tooltip } from 'antd-v4'; | |
| 1 | +import React, { useEffect, useState, useRef } from 'react'; | |
| 2 | +import { Form, Input, InputNumber, Select, Tooltip } from 'antd'; | |
| 3 | 3 | import * as commonUtils from "@/utils/utils"; |
| 4 | -import type { SelectProps } from 'antd-v4'; | |
| 5 | -import type { PropsType, FormItemTypeKey } from './type'; | |
| 4 | +import type { SelectProps } from 'antd'; | |
| 5 | +import type { PropsType, FormItemTypeKey, StateType } from './type'; | |
| 6 | 6 | |
| 7 | 7 | const FormItemTypeEvent = (props: PropsType) => { |
| 8 | - | |
| 8 | + const addState: any = {}; | |
| 9 | 9 | const { showConfig } = props; |
| 10 | 10 | const { sName = "", bNotEmpty } = showConfig; |
| 11 | 11 | |
| 12 | - const addState: any = {}; | |
| 13 | - addState.formItemProps = (): any => { | |
| 12 | + const [state, setState] = useState<StateType>({ | |
| 13 | + searchValue: "", | |
| 14 | + }); | |
| 15 | + addState.state = state; | |
| 16 | + const onSaveState0 = (value: StateType) => { | |
| 17 | + setState(pre => ({ ...pre, ...value })) | |
| 18 | + } | |
| 19 | + addState.onSaveState0 = onSaveState0; | |
| 20 | + | |
| 21 | + const antdRef = useRef<any>(null); | |
| 22 | + addState.antdRef = antdRef; | |
| 23 | + | |
| 24 | + useEffect(() => { | |
| 25 | + antdRef.current?.focus(); | |
| 26 | + }, []) | |
| 27 | + | |
| 28 | + const formItemProps = (): any => { | |
| 14 | 29 | return { |
| 15 | 30 | style: { margin: 0 }, |
| 16 | 31 | name: sName, |
| 17 | 32 | rules: [{ required: bNotEmpty, message: <Tooltip title="此字段必填!"><div>必填</div></Tooltip> }] |
| 18 | 33 | } |
| 19 | 34 | } |
| 35 | + addState.formItemProps = formItemProps; | |
| 36 | + | |
| 37 | + const dropDownRef = useRef<any>(null); | |
| 38 | + const getDropDownData = ({ searchValue = '', pageNum = 1 } = { searchValue: '', pageNum: 1 }) => { | |
| 39 | + const { formId, name, record, } = props; | |
| 40 | + const { dropDownData: dropDownDataOld = [], totalPageCount } = state; | |
| 41 | + if (totalPageCount && pageNum > totalPageCount) return; | |
| 42 | + const tempId = commonUtils.createSid(); | |
| 43 | + dropDownRef.current = tempId; | |
| 44 | + props.getSqlDropDownData(formId, name, showConfig, record, searchValue, pageNum).then((result: any = {}) => { | |
| 45 | + if (dropDownRef.current !== tempId) return; | |
| 46 | + const { | |
| 47 | + currentPageNo: pageNum, totalPageCount, totalCount, conditonValues, dropDownData = [], | |
| 48 | + } = result; | |
| 49 | + onSaveState0({ | |
| 50 | + pageNum, | |
| 51 | + totalPageCount, | |
| 52 | + totalCount, | |
| 53 | + // conditonValues, | |
| 54 | + dropDownData: [...(pageNum === 1 ? [] : dropDownDataOld), ...dropDownData], | |
| 55 | + }) | |
| 56 | + }); | |
| 57 | + } | |
| 58 | + addState.getDropDownData = getDropDownData; | |
| 20 | 59 | |
| 21 | 60 | return { |
| 22 | 61 | ...props, |
| ... | ... | @@ -52,37 +91,73 @@ const FormItemInput: React.FC<PropsType> = (props): React.ReactElement => { |
| 52 | 91 | return <Form.Item |
| 53 | 92 | {...props.formItemProps()} |
| 54 | 93 | > |
| 55 | - <Input ref={props.ref} onPressEnter={props.onSave} onBlur={props.onSave} /> | |
| 94 | + <Input ref={props.antdRef} onPressEnter={props.onSave} onBlur={props.onSave} /> | |
| 56 | 95 | </Form.Item> |
| 57 | 96 | } |
| 58 | 97 | |
| 59 | 98 | // 下拉框 |
| 60 | 99 | const FormItemInputSelect: React.FC<PropsType> = (props): React.ReactElement => { |
| 61 | - const { name, showConfig, record } = props; | |
| 62 | - const { sName } = showConfig; | |
| 63 | - const [options, setOptions] = useState<any[]>([]); | |
| 100 | + const { name, showConfig, record, state } = props; | |
| 101 | + const { dropDownData = [] } = state; | |
| 102 | + const { sName, sDropDownType } = showConfig; | |
| 64 | 103 | const [fieldNames, setFieldNames] = useState<any>(null); |
| 104 | + const timer = useRef<any>(null); | |
| 65 | 105 | // 获取下拉数据 |
| 66 | 106 | useEffect(() => { |
| 67 | - const { dropDownData, showDropDown, sAssignField } = showConfig; | |
| 107 | + const { dropDownData, showDropDown } = showConfig; | |
| 108 | + if (sDropDownType === "sql") { | |
| 109 | + props.getDropDownData(); | |
| 110 | + return; | |
| 111 | + } | |
| 68 | 112 | const data = dropDownData || (typeof showDropDown === 'object') ? showDropDown : commonUtils.objectToArr(commonUtils.convertStrToObj(showDropDown)); |
| 69 | 113 | if (!data?.length) return; |
| 70 | 114 | |
| 71 | - setOptions(data); | |
| 115 | + props.onSaveState0({ | |
| 116 | + dropDownData: data, | |
| 117 | + }) | |
| 118 | + | |
| 119 | + }, []) | |
| 72 | 120 | |
| 73 | - const data0 = data[0]; | |
| 121 | + useEffect(() => { | |
| 122 | + if (!dropDownData.length) return; | |
| 123 | + const data0 = dropDownData[0]; | |
| 74 | 124 | setFieldNames({ |
| 75 | 125 | label: Object.keys(data0)[0], |
| 76 | 126 | value: data0.sSlaveId ? 'sSlaveId' : 'sId', |
| 77 | 127 | }) |
| 78 | - }, []) | |
| 128 | + }, [!!dropDownData.length]) | |
| 129 | + | |
| 130 | + const handlePopupScroll = (e: React.UIEvent<HTMLDivElement>) => { | |
| 131 | + // e.persist(); | |
| 132 | + const { dropDownData } = showConfig; | |
| 133 | + const target = e.target as HTMLDivElement; | |
| 134 | + const { scrollTop, offsetHeight, scrollHeight } = target; | |
| 135 | + if (Math.ceil(scrollTop + offsetHeight) >= scrollHeight && sDropDownType === 'sql' && commonUtils.isEmptyArr(dropDownData)) { | |
| 136 | + const { | |
| 137 | + pageNum, searchPageNum, searchTotalPageCount, searchValue, totalPageCount, | |
| 138 | + } = state; | |
| 139 | + const nextPageNum = pageNum + 1; | |
| 140 | + const nextSearchPageNum = searchPageNum + 1; | |
| 141 | + props.getDropDownData({ searchValue, pageNum: searchValue === '' ? nextPageNum : nextSearchPageNum }); | |
| 142 | + } | |
| 143 | + }; | |
| 79 | 144 | |
| 80 | 145 | const selectProps: SelectProps = { |
| 146 | + filterOption: sDropDownType !== "sql", | |
| 147 | + showSearch: true, | |
| 81 | 148 | fieldNames, |
| 82 | - options, | |
| 149 | + options: dropDownData, | |
| 83 | 150 | onChange: (value: any) => { |
| 84 | - props.onChange(name, sName, { [sName]: value }, record.sId, options) | |
| 85 | - } | |
| 151 | + props.onChange(name, sName, { [sName]: dropDownData.find((item: any) => item[fieldNames.value] === value)[fieldNames.label] }, record.sId, dropDownData) | |
| 152 | + }, | |
| 153 | + onSearch: (value: string) => { | |
| 154 | + if (sDropDownType !== 'sql' || showConfig.dropDownData) return; | |
| 155 | + clearTimeout(timer.current); | |
| 156 | + timer.current = setTimeout(() => { | |
| 157 | + props.getDropDownData({ searchValue: value, pageNum: 1 }); | |
| 158 | + }, 500); | |
| 159 | + }, | |
| 160 | + onPopupScroll: handlePopupScroll | |
| 86 | 161 | } |
| 87 | 162 | |
| 88 | 163 | return <Form.Item |
| ... | ... | @@ -97,7 +172,7 @@ const FormItemInputNumber: React.FC<PropsType> = (props): React.ReactElement => |
| 97 | 172 | return <Form.Item |
| 98 | 173 | {...props.formItemProps()} |
| 99 | 174 | > |
| 100 | - <InputNumber ref={props.ref} onPressEnter={props.onSave} onBlur={props.onSave} /> | |
| 175 | + <InputNumber ref={props.antdRef} onPressEnter={props.onSave} onBlur={props.onSave} /> | |
| 101 | 176 | </Form.Item> |
| 102 | 177 | } |
| 103 | 178 | ... | ... |
src/components/Common/CommonComponentNew/type.ts
| 1 | -import type { RecordType, ShowConfigType } from '../CommonTableNew/type'; | |
| 1 | +import type { RecordType, ShowConfigType } from "../CommonTableNew/type"; | |
| 2 | 2 | |
| 3 | 3 | export interface PropsType { |
| 4 | - ref: React.RefObject<any>; | |
| 4 | + // ref: React.RefObject<any>; | |
| 5 | 5 | form: any; |
| 6 | 6 | showConfig: ShowConfigType; |
| 7 | 7 | onSave?: (data: RecordType) => void; |
| 8 | - onChange: ( | |
| 9 | - tableName: string, | |
| 10 | - sName: string, | |
| 11 | - returnValue: RecordType, | |
| 12 | - sId: string, | |
| 13 | - dropDownData: RecordType[], | |
| 14 | - ) => void; | |
| 8 | + onChange: (tableName: string, sName: string, returnValue: RecordType, sId: string, dropDownData: RecordType[]) => void; | |
| 9 | + getDropDownData: (params?: { searchValue?: string; pageNum?: number }) => void; | |
| 15 | 10 | [key: string]: any; |
| 16 | 11 | } |
| 17 | 12 | |
| 18 | -export type FormItemTypeKey = 's' | 'i' | 'b' | 'd' | 't'; | |
| 13 | +export type FormItemTypeKey = "s" | "i" | "b" | "d" | "t"; | |
| 14 | + | |
| 15 | +export interface StateType { | |
| 16 | + // 下拉搜索框的值 | |
| 17 | + searchValue?: string; // 搜索条件 | |
| 18 | + pageNum?: number; // 当前页码 | |
| 19 | + totalPageCount?: number; // 总页数 | |
| 20 | + totalCount?: number; // 总条数 | |
| 21 | + dropDownData?: RecordType[]; // 下拉框数据 | |
| 22 | + // 其他可能的字段也可以在这里添加 | |
| 23 | +} | ... | ... |
src/components/Common/CommonElementEvent.js
| 1 | +/* eslint-disable */ | |
| 1 | 2 | /* eslint-disable array-callback-return,no-undef,prefer-destructuring */ |
| 2 | 3 | import React, { Component } from 'react'; |
| 3 | 4 | import { Modal, message } from 'antd-v4'; |
| ... | ... | @@ -144,22 +145,37 @@ export default (ChildComponent) => { |
| 144 | 145 | ...addState, |
| 145 | 146 | }); |
| 146 | 147 | } |
| 147 | - if (commonUtils.isEmptyObject(machineOldConfig) && formData.length > 0 && sModelsType === 'element/processInfo') { | |
| 148 | + if (commonUtils.isEmptyObject(masterConfig) && formData.length > 0 && sModelsType === 'element/processInfo') { | |
| 148 | 149 | const sId = currentId !== undefined ? currentId : ''; |
| 149 | 150 | /* 数据Id */ |
| 150 | 151 | const masterConfig = formData.filter(item => !item.bGrd)[0]; |
| 151 | 152 | /* bGrd代表是否是表格 */ |
| 152 | - const machineConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleprocessmachine')[0]; | |
| 153 | - const machineColumn = commonFunc.getHeaderConfig(machineConfig); | |
| 154 | - const assortConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleprocessloss')[0]; /* 劲嘉 配套工序不要使用,换成 装版损设置 */ | |
| 155 | - const assortColumn = commonFunc.getHeaderConfig(assortConfig); | |
| 156 | - const outsideConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleprocessoutside')[0]; | |
| 157 | - const outsideColumn = commonFunc.getHeaderConfig(outsideConfig); | |
| 158 | - const processstyleConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleprocessstyle')[0]; | |
| 159 | - const processstyleColumn = commonFunc.getHeaderConfig(processstyleConfig); | |
| 160 | - const processApsRuleConfig = formData.filter(item => item.bGrd && item.sTbName === 'eleprocesssApsRule')[0]; /* APS定义规则 */ | |
| 161 | - const processApsRuleColumn = commonFunc.getHeaderConfig(processApsRuleConfig); | |
| 162 | - | |
| 153 | + const machineConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocessmachine')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocessmachine')[0] : {}; | |
| 154 | + let machineColumn = []; | |
| 155 | + if (commonUtils.isNotEmptyObject(machineConfig)) { | |
| 156 | + machineColumn = commonFunc.getHeaderConfig(machineConfig); | |
| 157 | + } | |
| 158 | + const assortConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocessloss')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocessloss')[0] : {}; /* 劲嘉 配套工序不要使用,换成 装版损设置 */ | |
| 159 | + let assortColumn = []; | |
| 160 | + if (commonUtils.isNotEmptyObject(assortConfig)) { | |
| 161 | + assortColumn = commonFunc.getHeaderConfig(assortConfig); | |
| 162 | + } | |
| 163 | + const outsideConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocessoutside')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocessoutside')[0] : {}; | |
| 164 | + let outsideColumn = []; | |
| 165 | + if (commonUtils.isNotEmptyObject(outsideConfig)) { | |
| 166 | + outsideColumn = commonFunc.getHeaderConfig(outsideConfig); | |
| 167 | + } | |
| 168 | + const processstyleConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocessoutside')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocessstyle')[0] : {}; | |
| 169 | + let processstyleColumn = []; | |
| 170 | + if (commonUtils.isNotEmptyObject(processstyleConfig)) { | |
| 171 | + processstyleColumn = commonFunc.getHeaderConfig(processstyleConfig); | |
| 172 | + } | |
| 173 | + console.log('22221', formData, processstyleConfig); | |
| 174 | + const processApsRuleConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocesssApsRule')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocesssApsRule')[0] : {}; /* APS定义规则 */ | |
| 175 | + let processApsRuleColumn = []; | |
| 176 | + if (commonUtils.isNotEmptyObject(processApsRuleConfig)) { | |
| 177 | + processApsRuleColumn = commonFunc.getHeaderConfig(processApsRuleConfig); | |
| 178 | + } | |
| 163 | 179 | const dynamicParamConfig = commonUtils.isNotEmptyArr(formData.filter(item => item.bGrd && item.sTbName === 'eleprocessdynamic')) ? formData.filter(item => item.bGrd && item.sTbName === 'eleprocessdynamic')[0] : {}; /* 动态参数 */ |
| 164 | 180 | const dynamicParamColumn = commonUtils.isNotEmptyObject(dynamicParamConfig) ? commonFunc.getHeaderConfig(dynamicParamConfig) : []; |
| 165 | 181 | |
| ... | ... | @@ -316,6 +332,9 @@ export default (ChildComponent) => { |
| 316 | 332 | const approveGroupConfig = formData.filter(item => item.bGrd && item.sTbName === 'sftlogininfojurisApprovalgroup')[0]; |
| 317 | 333 | const approveGroupColumn = commonFunc.getHeaderConfig(approveGroupConfig); /* 审批组权限 */ |
| 318 | 334 | |
| 335 | + const brandgroupConfig = formData.filter(item => item.bGrd && item.sTbName === 'sftlogininfobrandgroup')[0]; | |
| 336 | + const brandgroupColumn = commonFunc.getHeaderConfig(brandgroupConfig); /* 分管公司 */ | |
| 337 | + | |
| 319 | 338 | let addState = {}; |
| 320 | 339 | if (sId === '') { |
| 321 | 340 | const config = {}; |
| ... | ... | @@ -328,11 +347,12 @@ export default (ChildComponent) => { |
| 328 | 347 | config.drivergroupConfig = drivergroupConfig; |
| 329 | 348 | config.departgroupConfig = departgroupConfig; |
| 330 | 349 | config.approveGroupConfig = approveGroupConfig; |
| 350 | + config.brandgroupConfig = brandgroupConfig; | |
| 331 | 351 | addState = await this.handleAdd(config, nextProps.app.currentPane.copyTo, true); |
| 332 | 352 | } else { |
| 333 | 353 | const flag = undefined; |
| 334 | 354 | const isWait = true; |
| 335 | - const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, undefined, { approveGroupConfig }); | |
| 355 | + const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, undefined, { approveGroupConfig, brandgroupConfig }); | |
| 336 | 356 | this.handleGetUserInfoData(params); |
| 337 | 357 | } |
| 338 | 358 | this.props.onSaveState({ |
| ... | ... | @@ -353,6 +373,8 @@ export default (ChildComponent) => { |
| 353 | 373 | departgroupColumn, |
| 354 | 374 | approveGroupConfig, |
| 355 | 375 | approveGroupColumn, |
| 376 | + brandgroupConfig, | |
| 377 | + brandgroupColumn, | |
| 356 | 378 | sId, |
| 357 | 379 | pageLoading: false, |
| 358 | 380 | ...addState, |
| ... | ... | @@ -371,6 +393,7 @@ export default (ChildComponent) => { |
| 371 | 393 | |
| 372 | 394 | this.handleGetSlaveData('Set', 'param', paramConfig); |
| 373 | 395 | let addState = {}; |
| 396 | + let addStateMaster = {}; | |
| 374 | 397 | |
| 375 | 398 | const systemFunctionData = []; |
| 376 | 399 | systemFunctionData.push({ value: 'Max(round(变量,0))', sName: commonFunc.showMessage(app.commonConst, 'sysMaxInteger') }); |
| ... | ... | @@ -390,8 +413,13 @@ export default (ChildComponent) => { |
| 390 | 413 | config.customizeParamConfig = customizeParamConfig; |
| 391 | 414 | addState = await this.handleAdd(config, nextProps.app.currentPane.copyTo, true); |
| 392 | 415 | } else { |
| 393 | - this.handleGetSlaveData('One', undefined, masterConfig); | |
| 416 | + addStateMaster = await this.handleGetSlaveData('One', undefined, masterConfig); | |
| 394 | 417 | /* 通过sId找到列表跳转行数据 */ |
| 418 | + let masterDataNew = {} | |
| 419 | + if(commonUtils.isNotEmptyObject(addStateMaster) && commonUtils.isNotEmptyObject(addStateMaster.masterData) && | |
| 420 | + commonUtils.isNotEmptyObject(addStateMaster.masterData.sColTitleName)) { | |
| 421 | + masterDataNew = addStateMaster.masterData; | |
| 422 | + } | |
| 395 | 423 | |
| 396 | 424 | let currentRecords = []; |
| 397 | 425 | if (commonUtils.isNotEmptyArr(nextProps.app.currentPane.currentRecord)) { |
| ... | ... | @@ -403,7 +431,11 @@ export default (ChildComponent) => { |
| 403 | 431 | } else { |
| 404 | 432 | currentRecords = []; |
| 405 | 433 | } |
| 406 | - const currentRecordArr = commonUtils.isNotEmptyArr(currentRecords) ? currentRecords.filter(item => item.sId === sId) : []; | |
| 434 | + let currentRecordArr = commonUtils.isNotEmptyArr(currentRecords) ? currentRecords.filter(item => item.sId === sId) : []; | |
| 435 | + | |
| 436 | + if(commonUtils.isEmptyArr(currentRecordArr) && commonUtils.isNotEmptyObject(masterDataNew)) { | |
| 437 | + currentRecordArr = [masterDataNew]; | |
| 438 | + } | |
| 407 | 439 | if (commonUtils.isNotEmptyArr(currentRecordArr) && currentRecordArr[0].sColTitleName) { |
| 408 | 440 | const currentRecord = currentRecordArr[0]; /* 找到列表选中行 */ |
| 409 | 441 | /* 取自定义列名 */ |
| ... | ... | @@ -1058,10 +1090,10 @@ export default (ChildComponent) => { |
| 1058 | 1090 | name: 'address', configData: addressConfig, condition: { sSqlCondition: { sParentId: sId } }, |
| 1059 | 1091 | }); |
| 1060 | 1092 | }; |
| 1061 | - handleGetSflLoginDataAll = async (masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, { approveGroupConfig }) => { | |
| 1093 | + handleGetSflLoginDataAll = async (masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, { approveGroupConfig, brandgroupConfig }) => { | |
| 1062 | 1094 | const flag = undefined; |
| 1063 | 1095 | const isWait = true; |
| 1064 | - const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, undefined, { approveGroupConfig }); | |
| 1096 | + const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, undefined, { approveGroupConfig, brandgroupConfig }); | |
| 1065 | 1097 | this.handleGetUserInfoData(params); |
| 1066 | 1098 | }; |
| 1067 | 1099 | /** 获取印件分类主表、从表 */ |
| ... | ... | @@ -1183,7 +1215,7 @@ export default (ChildComponent) => { |
| 1183 | 1215 | }; |
| 1184 | 1216 | |
| 1185 | 1217 | /** 获取用户信息数据 */ |
| 1186 | - handleGetSflLoginData = async (masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, bEditClick, { approveGroupConfig }) => { | |
| 1218 | + handleGetSflLoginData = async (masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, bEditClick, { approveGroupConfig, brandgroupConfig }) => { | |
| 1187 | 1219 | const { currentId } = this.props; |
| 1188 | 1220 | /* 当前页签数据 */ |
| 1189 | 1221 | const sId = currentId !== undefined ? currentId : ''; |
| ... | ... | @@ -1219,8 +1251,12 @@ export default (ChildComponent) => { |
| 1219 | 1251 | name: 'approveGroup', configData: approveGroupConfig, condition: { sSqlCondition: { sParentId: sId } }, flag, isWait, |
| 1220 | 1252 | }); |
| 1221 | 1253 | |
| 1254 | + const brandgroupAddState = await this.props.handleGetDataSet({ | |
| 1255 | + name: 'brandgroup', configData: brandgroupConfig, condition: { sSqlCondition: { sParentId: sId } }, flag, isWait, | |
| 1256 | + }); | |
| 1257 | + | |
| 1222 | 1258 | return { |
| 1223 | - masterAddState, jurgroupAddState, customergroupAddState, supplygroupAddState, persongroupAddState, processgroupAddState, drivergroupAddState, departgroupAddState, approveGroupAddState, | |
| 1259 | + masterAddState, jurgroupAddState, customergroupAddState, supplygroupAddState, persongroupAddState, processgroupAddState, drivergroupAddState, departgroupAddState, approveGroupAddState, brandgroupAddState, | |
| 1224 | 1260 | }; |
| 1225 | 1261 | }; |
| 1226 | 1262 | |
| ... | ... | @@ -1234,7 +1270,7 @@ export default (ChildComponent) => { |
| 1234 | 1270 | if (dataReturn.code === 1) { |
| 1235 | 1271 | const returnData = dataReturn.dataset.rows[0]; |
| 1236 | 1272 | const { |
| 1237 | - masterAddState = {}, jurgroupAddState, customergroupAddState, supplygroupAddState, persongroupAddState, processgroupAddState, drivergroupAddState, departgroupAddState, approveGroupAddState, | |
| 1273 | + masterAddState = {}, jurgroupAddState, customergroupAddState, supplygroupAddState, persongroupAddState, processgroupAddState, drivergroupAddState, departgroupAddState, approveGroupAddState, brandgroupAddState, | |
| 1238 | 1274 | } = params; |
| 1239 | 1275 | const { jurgroupData } = jurgroupAddState; |
| 1240 | 1276 | const { customergroupData } = customergroupAddState; |
| ... | ... | @@ -1243,6 +1279,7 @@ export default (ChildComponent) => { |
| 1243 | 1279 | const { processgroupData } = processgroupAddState; |
| 1244 | 1280 | const { drivergroupData } = drivergroupAddState; |
| 1245 | 1281 | const { approveGroupData } = approveGroupAddState; |
| 1282 | + const { brandgroupData } = brandgroupAddState; | |
| 1246 | 1283 | let departgroupData = []; |
| 1247 | 1284 | if (commonUtils.isNotEmptyObject(departgroupAddState)) { |
| 1248 | 1285 | departgroupData = departgroupAddState.departgroupData; |
| ... | ... | @@ -1255,6 +1292,7 @@ export default (ChildComponent) => { |
| 1255 | 1292 | const drivergroupSelectedRowKeys = []; |
| 1256 | 1293 | const departgroupSelectedRowKeys = []; |
| 1257 | 1294 | const approveGroupSelectedRowKeys = []; |
| 1295 | + const brandgroupSelectedRowKeys = []; | |
| 1258 | 1296 | const jurgroupAllData = returnData.jurgroupData; |
| 1259 | 1297 | const customergroupAllData = returnData.customergroupData; |
| 1260 | 1298 | const supplygroupAllData = returnData.supplygroupData; |
| ... | ... | @@ -1263,6 +1301,12 @@ export default (ChildComponent) => { |
| 1263 | 1301 | const drivergroupAllData = returnData.drivergroupData; |
| 1264 | 1302 | const departgroupAllData = returnData.departgroupData; |
| 1265 | 1303 | const approveGroupAllData = returnData.sApprovalprocessData; |
| 1304 | + const brandgroupAllData = returnData.sysbrandData.map(item => ({ | |
| 1305 | + ...item, | |
| 1306 | + sCompanyName: item.sName, | |
| 1307 | + ...brandgroupData.find(x => x.sCompanyId === item.sCompanyId) || { sId: commonUtils.createSid(), handleType: 'add', sParentId: masterAddState.masterData.sId }, | |
| 1308 | + })); | |
| 1309 | + | |
| 1266 | 1310 | if (commonUtils.isNotEmptyArr(jurgroupAllData)) { |
| 1267 | 1311 | for (const itemAll of jurgroupAllData) { |
| 1268 | 1312 | if (commonUtils.isNotEmptyArr(jurgroupData)) { |
| ... | ... | @@ -1354,6 +1398,14 @@ export default (ChildComponent) => { |
| 1354 | 1398 | } |
| 1355 | 1399 | } |
| 1356 | 1400 | |
| 1401 | + if (commonUtils.isNotEmptyArr(brandgroupAllData)) { | |
| 1402 | + for (const itemAll of brandgroupAllData) { | |
| 1403 | + if (itemAll.iCheck) { | |
| 1404 | + brandgroupSelectedRowKeys.push(itemAll.sId); | |
| 1405 | + } | |
| 1406 | + } | |
| 1407 | + } | |
| 1408 | + | |
| 1357 | 1409 | this.props.onSaveState({ |
| 1358 | 1410 | ...masterAddState, |
| 1359 | 1411 | jurgroupData: jurgroupAllData, |
| ... | ... | @@ -1372,6 +1424,8 @@ export default (ChildComponent) => { |
| 1372 | 1424 | departgroupOldData: departgroupData, |
| 1373 | 1425 | approveGroupData: approveGroupAllData, |
| 1374 | 1426 | approveGroupOldData: approveGroupData, |
| 1427 | + brandgroupData: brandgroupAllData, | |
| 1428 | + brandgroupOldData: brandgroupAllData, | |
| 1375 | 1429 | jurgroupSelectedRowKeys, |
| 1376 | 1430 | customergroupSelectedRowKeys, |
| 1377 | 1431 | supplygroupSelectedRowKeys, |
| ... | ... | @@ -1380,6 +1434,7 @@ export default (ChildComponent) => { |
| 1380 | 1434 | drivergroupSelectedRowKeys, |
| 1381 | 1435 | departgroupSelectedRowKeys, |
| 1382 | 1436 | approveGroupSelectedRowKeys, |
| 1437 | + brandgroupSelectedRowKeys, | |
| 1383 | 1438 | }); |
| 1384 | 1439 | } |
| 1385 | 1440 | }; |
| ... | ... | @@ -1392,21 +1447,31 @@ export default (ChildComponent) => { |
| 1392 | 1447 | this.props.handleGetDataOne({ |
| 1393 | 1448 | name: 'master', configData: masterConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, |
| 1394 | 1449 | }); |
| 1395 | - this.props.handleGetDataSet({ | |
| 1396 | - name: 'machine', configData: machineConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1397 | - }); | |
| 1398 | - this.props.handleGetDataSet({ | |
| 1399 | - name: 'assort', configData: assortConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1400 | - }); | |
| 1401 | - this.props.handleGetDataSet({ | |
| 1402 | - name: 'outside', configData: outsideConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1403 | - }); | |
| 1404 | - this.props.handleGetDataSet({ | |
| 1405 | - name: 'processstyle', configData: processstyleConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1406 | - }); | |
| 1407 | - this.props.handleGetDataSet({ | |
| 1408 | - name: 'processApsRule', configData: processApsRuleConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1409 | - }); | |
| 1450 | + if(commonUtils.isNotEmptyObject(machineConfig)) { | |
| 1451 | + this.props.handleGetDataSet({ | |
| 1452 | + name: 'machine', configData: machineConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 1453 | + }); | |
| 1454 | + } | |
| 1455 | + if(commonUtils.isNotEmptyObject(assortConfig)) { | |
| 1456 | + this.props.handleGetDataSet({ | |
| 1457 | + name: 'assort', configData: assortConfig, condition: {sSqlCondition: {sParentId: sId}}, | |
| 1458 | + }); | |
| 1459 | + } | |
| 1460 | + if(commonUtils.isNotEmptyObject(outsideConfig)) { | |
| 1461 | + this.props.handleGetDataSet({ | |
| 1462 | + name: 'outside', configData: outsideConfig, condition: {sSqlCondition: {sParentId: sId}}, | |
| 1463 | + }); | |
| 1464 | + } | |
| 1465 | + if(commonUtils.isNotEmptyObject(processstyleConfig)) { | |
| 1466 | + this.props.handleGetDataSet({ | |
| 1467 | + name: 'processstyle', configData: processstyleConfig, condition: {sSqlCondition: {sParentId: sId}}, | |
| 1468 | + }); | |
| 1469 | + } | |
| 1470 | + if(commonUtils.isNotEmptyObject(processApsRuleConfig)) { | |
| 1471 | + this.props.handleGetDataSet({ | |
| 1472 | + name: 'processApsRule', configData: processApsRuleConfig, condition: {sSqlCondition: {sParentId: sId}}, | |
| 1473 | + }); | |
| 1474 | + } | |
| 1410 | 1475 | |
| 1411 | 1476 | this.props.handleGetDataSet({ |
| 1412 | 1477 | name: 'dynamicParam', configData: dynamicParamConfig, condition: { sSqlCondition: { sParentId: sId } }, |
| ... | ... | @@ -1472,14 +1537,22 @@ export default (ChildComponent) => { |
| 1472 | 1537 | } |
| 1473 | 1538 | |
| 1474 | 1539 | handleGetSlaveData = async (getType, sName, currConfig, slaveConfig, iPlcNoConfig, bEditClick, addStateConfig) => { |
| 1475 | - const { currentId } = this.props; | |
| 1540 | + const { currentId, sModelsType } = this.props; | |
| 1476 | 1541 | /* 当前页签数据 */ |
| 1477 | 1542 | let addState = {}; |
| 1478 | 1543 | const sId = currentId !== undefined ? currentId : ''; |
| 1479 | 1544 | if (getType === 'One') { |
| 1480 | - this.props.handleGetDataOne({ | |
| 1481 | - name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, | |
| 1482 | - }); | |
| 1545 | + if(sModelsType === 'system/sisformulaInfo') { | |
| 1546 | + const addMaster = await this.props.handleGetDataOne({ | |
| 1547 | + name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, isWait :true | |
| 1548 | + }); | |
| 1549 | + this.props.onSaveState(addMaster); | |
| 1550 | + return addMaster; | |
| 1551 | + } else { | |
| 1552 | + this.props.handleGetDataOne({ | |
| 1553 | + name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, | |
| 1554 | + }); | |
| 1555 | + } | |
| 1483 | 1556 | if (commonUtils.isNotEmptyObject(iPlcNoConfig) && commonUtils.isNotEmptyObject(slaveConfig)) { |
| 1484 | 1557 | this.props.handleGetDataOne({ |
| 1485 | 1558 | name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' }, bEditClick, |
| ... | ... | @@ -1591,7 +1664,7 @@ export default (ChildComponent) => { |
| 1591 | 1664 | /* 待用数据声明 */ |
| 1592 | 1665 | const { |
| 1593 | 1666 | app, currentId, masterConfig, contactConfig, addressConfig, supplyConfig, stockConfig, customerInfoConfig, eleknifemouldproductConfig, eleknifemouldfileConfig, siscommonstyleproductclassifyConfig, sModelsType, machineConfig, assortConfig, outsideConfig, picFileConfig, userConfig, sischeckphaselogininfoConfig, phaseConfig, conditionConfig, eleemployeeConfig, elemachineConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, |
| 1594 | - eleteststandarditemConfig, processstyleConfig, processApsRuleConfig, dynamicParamConfig, bUserModel, departgroupConfig, approveGroupConfig, | |
| 1667 | + eleteststandarditemConfig, processstyleConfig, processApsRuleConfig, dynamicParamConfig, bUserModel, departgroupConfig, approveGroupConfig, brandgroupConfig, | |
| 1595 | 1668 | } = this.props; |
| 1596 | 1669 | const { userinfo } = app; |
| 1597 | 1670 | const onSendSocketMessage = this.props.handleSendSocketMessage; |
| ... | ... | @@ -1705,7 +1778,7 @@ export default (ChildComponent) => { |
| 1705 | 1778 | confirm({ |
| 1706 | 1779 | title: obj.title, |
| 1707 | 1780 | onOk() { |
| 1708 | - onGetDataOk(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, { approveGroupConfig }); | |
| 1781 | + onGetDataOk(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, { approveGroupConfig, brandgroupConfig }); | |
| 1709 | 1782 | onSaveStateOk({ enabled: false }); |
| 1710 | 1783 | onSendSocketMessage('release', 'noAction', currentId, userinfo.sId, null, null); |
| 1711 | 1784 | }, |
| ... | ... | @@ -1824,7 +1897,7 @@ export default (ChildComponent) => { |
| 1824 | 1897 | stockConfig, customerInfoConfig, picFileConfig, eleemployeeConfig, elemachineConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, |
| 1825 | 1898 | persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, paramConfig, userConfig, phaseConfig, conditionConfig, sischeckphaselogininfoConfig, |
| 1826 | 1899 | sisproductclassifyProcessClassifyConfig, sysmsguserConfig, eleknifemouldproductConfig, eleknifemouldfileConfig, eleteststandarditemConfig, formData, approveGroupConfig, |
| 1827 | - slave0Config, memoDataList, | |
| 1900 | + brandgroupConfig, slave0Config, memoDataList, | |
| 1828 | 1901 | } = this.props; |
| 1829 | 1902 | if (sModelsType === 'element/customerInfo' || sModelsType === 'element/supplyInfo') { |
| 1830 | 1903 | this.handleGetData(masterConfig, contactConfig, addressConfig, bEditClick); |
| ... | ... | @@ -1845,7 +1918,7 @@ export default (ChildComponent) => { |
| 1845 | 1918 | } else if (sModelsType === 'element/sftloginInfo') { |
| 1846 | 1919 | const flag = undefined; |
| 1847 | 1920 | const isWait = true; |
| 1848 | - const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, bEditClick, { approveGroupConfig }); | |
| 1921 | + const params = await this.handleGetSflLoginData(masterConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, departgroupConfig, flag, isWait, bEditClick, { approveGroupConfig, brandgroupConfig }); | |
| 1849 | 1922 | this.handleGetUserInfoData(params); |
| 1850 | 1923 | } else if (sModelsType === 'element/machineInfo') { |
| 1851 | 1924 | const addStateConfig = { |
| ... | ... | @@ -1893,7 +1966,7 @@ export default (ChildComponent) => { |
| 1893 | 1966 | // tableName: masterConfig.sTbName, |
| 1894 | 1967 | // sId: [sId], |
| 1895 | 1968 | // }; |
| 1896 | - this.props.onSaveState({ pageLoading: true }); | |
| 1969 | + // this.props.onSaveState({ pageLoading: true }); | |
| 1897 | 1970 | const { masterData, bUserModel, dispatch } = this.props; |
| 1898 | 1971 | let timValue = 0; |
| 1899 | 1972 | if (this.props.app.webSocket === null || this.props.app.webSocket.readyState !== WebSocket.OPEN) { |
| ... | ... | @@ -1931,13 +2004,13 @@ export default (ChildComponent) => { |
| 1931 | 2004 | this.props.onSaveState({ |
| 1932 | 2005 | enabled: true, |
| 1933 | 2006 | bUserModel, |
| 1934 | - isEnabledPlcNo: (masterData.iPlcNo === undefined || masterData.iPlcNo === 0), | |
| 2007 | + isEnabledPlcNo: (masterData?.iPlcNo === undefined || masterData?.iPlcNo === 0), | |
| 1935 | 2008 | loading: false, |
| 1936 | 2009 | }); |
| 1937 | 2010 | } else if (this.props.app.webSocket.homeAction) { |
| 1938 | 2011 | this.props.app.webSocket.homeAction(msg); |
| 1939 | 2012 | } |
| 1940 | - this.props.onSaveState({ pageLoading: false }); | |
| 2013 | + // this.props.onSaveState({ pageLoading: false }); | |
| 1941 | 2014 | }; |
| 1942 | 2015 | this.props.handleSendSocketMessage('update', 'showMsg', this.props.currentId, this.props.app.userinfo.sId, null, null); |
| 1943 | 2016 | }, timValue); |
| ... | ... | @@ -1970,7 +2043,7 @@ export default (ChildComponent) => { |
| 1970 | 2043 | /* 数据参数 */ |
| 1971 | 2044 | const { |
| 1972 | 2045 | currentId, token, sModelsId, masterConfig, contactConfig, addressConfig, supplyConfig, stockConfig, customerInfoConfig, eleknifemouldproductConfig, eleknifemouldfileConfig, eleteststandarditemConfig, siscommonstyleproductclassifyConfig, machineConfig, assortConfig, outsideConfig, picFileConfig, eleemployeeConfig, elemachineConfig, jurgroupConfig, customergroupConfig, supplygroupConfig, persongroupConfig, processgroupConfig, drivergroupConfig, userConfig, sischeckphaselogininfoConfig, phaseConfig, conditionConfig, sModelsType, sisproductclassifyProcessClassifyConfig, |
| 1973 | - approveGroupConfig, | |
| 2046 | + approveGroupConfig, brandgroupConfig, | |
| 1974 | 2047 | } = props; |
| 1975 | 2048 | /* 当前页签数据 */ |
| 1976 | 2049 | const sId = currentId !== undefined ? currentId : ''; |
| ... | ... | @@ -2131,6 +2204,9 @@ export default (ChildComponent) => { |
| 2131 | 2204 | }, { |
| 2132 | 2205 | tableName: approveGroupConfig.sTbName, |
| 2133 | 2206 | relationName: 'sParentId', |
| 2207 | + }, { | |
| 2208 | + tableName: brandgroupConfig.sTbName, | |
| 2209 | + relationName: 'sParentId', | |
| 2134 | 2210 | }], |
| 2135 | 2211 | }, |
| 2136 | 2212 | }; |
| ... | ... | @@ -2278,7 +2354,7 @@ export default (ChildComponent) => { |
| 2278 | 2354 | processgroupOldData, processgroupOldDelData, jurgroupOldData, jurgroupOldDelData, persongroupOldData, persongroupOldDelData, drivergroupOldData, drivergroupOldDelData, |
| 2279 | 2355 | eleknifemouldproductData, eleknifemouldproductDelData, eleknifemouldfileData, eleknifemouldfileDelData, eleteststandarditemData, eleteststandarditemDelData, |
| 2280 | 2356 | customizeParamConfig, customizeParamData, customizeParamDelData, dynamicParamData, dynamicParamDelData, departgroupOldData, departgroupOldDelData, customizeParamName, |
| 2281 | - approveGroupConfig, approveGroupData, approveGroupOldData, approveGroupOldDelData, slaveInfoList, | |
| 2357 | + approveGroupConfig, approveGroupData, approveGroupOldData, approveGroupOldDelData, brandgroupConfig, brandgroupData, brandgroupOldData = [], slaveInfoList, | |
| 2282 | 2358 | } = this.props; |
| 2283 | 2359 | /* app, const { webSocket, currentPane } = app; |
| 2284 | 2360 | const { key } = currentPane; */ |
| ... | ... | @@ -2638,7 +2714,7 @@ export default (ChildComponent) => { |
| 2638 | 2714 | data.push(commonBusiness.mergeData('elemachine', elemachineConfig.sTbName, elemachineData, elemachineDelData)); |
| 2639 | 2715 | } else if (sModelsType === 'element/sftloginInfo') { |
| 2640 | 2716 | if (!commonBusiness.validateTable(jurgroupConfig, jurgroupData, this.props, '2') || !commonBusiness.validateTable(customergroupConfig, customergroupData, this.props, '3') || !commonBusiness.validateTable(supplygroupConfig, supplygroupData, this.props, '4') || !commonBusiness.validateTable(persongroupConfig, persongroupData, this.props, '5') || !commonBusiness.validateTable(processgroupConfig, processgroupData, this.props, '6') || !commonBusiness.validateTable(drivergroupConfig, drivergroupData, this.props, '7') |
| 2641 | - || !commonBusiness.validateTable(drivergroupConfig, departgroupData, this.props, '8') || !commonBusiness.validateTable(approveGroupConfig, approveGroupData, this.props, '9')) { | |
| 2717 | + || !commonBusiness.validateTable(drivergroupConfig, departgroupData, this.props, '8') || !commonBusiness.validateTable(approveGroupConfig, approveGroupData, this.props, '9') || !commonBusiness.validateTable(brandgroupConfig, brandgroupData, this.props, '10')) { | |
| 2642 | 2718 | return; |
| 2643 | 2719 | } |
| 2644 | 2720 | data.push(commonBusiness.mergeData('jurgroup', jurgroupConfig.sTbName, jurgroupOldData, jurgroupOldDelData)); |
| ... | ... | @@ -2649,6 +2725,7 @@ export default (ChildComponent) => { |
| 2649 | 2725 | data.push(commonBusiness.mergeData('drivergroup', drivergroupConfig.sTbName, drivergroupOldData, drivergroupOldDelData)); |
| 2650 | 2726 | data.push(commonBusiness.mergeData('departgroup', departgroupConfig.sTbName, departgroupOldData, departgroupOldDelData)); |
| 2651 | 2727 | data.push(commonBusiness.mergeData('approveGroup', approveGroupConfig.sTbName, approveGroupOldData, approveGroupOldDelData)); |
| 2728 | + data.push(commonBusiness.mergeData('brandgroup', brandgroupConfig.sTbName, brandgroupOldData.filter(item => item.iCheck), brandgroupOldData.filter(item => !item.iCheck).map(item => ({ ...item, handleType: 'del' })))); | |
| 2652 | 2729 | } else if (sModelsType === 'element/checkModelInfo') { |
| 2653 | 2730 | if (!commonBusiness.validateTable(userConfig, userData, this.props, '2') || !commonBusiness.validateTable(phaseConfig, phaseData, this.props, '3') || !commonBusiness.validateTable(conditionConfig, conditionData, this.props, '4')) { |
| 2654 | 2731 | return; |
| ... | ... | @@ -3707,6 +3784,21 @@ export default (ChildComponent) => { |
| 3707 | 3784 | tableDataRow.sMaterialsUnit = masterData.sMaterialsUnit; |
| 3708 | 3785 | tableDataRow.sComputeId = masterData.sComputeId; |
| 3709 | 3786 | tableDataRow = await this.handleMaterialsChange(tableDataRow, sModelsId, masterData, changeValue, sFieldName, app, token, models); |
| 3787 | + } else if (name === 'brandgroup') { | |
| 3788 | + let { brandgroupOldData = [] } = this.props; | |
| 3789 | + const iIndex = brandgroupOldData.findIndex(item => item.sId === sId); | |
| 3790 | + if (iIndex !== -1) { | |
| 3791 | + brandgroupOldData[iIndex] = { ...brandgroupOldData[iIndex], ...tableDataRow }; | |
| 3792 | + if (brandgroupOldData[iIndex].bDefault) { | |
| 3793 | + brandgroupOldData = brandgroupOldData.map((item, index) => { | |
| 3794 | + item.bDefault = index === iIndex; | |
| 3795 | + item.handleType = item.handleType || 'update'; | |
| 3796 | + return item; | |
| 3797 | + }); | |
| 3798 | + } | |
| 3799 | + } | |
| 3800 | + this.props.onSaveState({ brandgroupOldData, brandgroupData: brandgroupOldData }); | |
| 3801 | + return; | |
| 3710 | 3802 | } else if (commonUtils.isNotEmptyStr(masterData.handleType)) { |
| 3711 | 3803 | masterData.handleType = masterData.handleType === 'add' ? 'add' : 'update'; |
| 3712 | 3804 | } |
| ... | ... | @@ -3832,6 +3924,7 @@ export default (ChildComponent) => { |
| 3832 | 3924 | if (commonUtils.isNotEmptyStr(customizeParamConfig.panelName)) { |
| 3833 | 3925 | addState.customizePanelName = customizeParamConfig.panelName; |
| 3834 | 3926 | } |
| 3927 | + addState.customizeParamConfig = customizeParamConfigNew; | |
| 3835 | 3928 | addState.customizeParamColumn = commonFunc.getHeaderConfig(customizeParamConfigNew); |
| 3836 | 3929 | addState.tableKey = commonUtils.createSid(); |
| 3837 | 3930 | addState.customizeParamName = []; |
| ... | ... | @@ -4259,7 +4352,7 @@ export default (ChildComponent) => { |
| 4259 | 4352 | }, |
| 4260 | 4353 | }); |
| 4261 | 4354 | }; |
| 4262 | - handleTableSelectRowChange = (name, selectedRowKeys) => { | |
| 4355 | + handleTableSelectRowChange = (name, selectedRowKeys, bCheckBoxClick) => { | |
| 4263 | 4356 | const { |
| 4264 | 4357 | sModelsType, [`${name}OldData`]: oldData, masterData, enabled, |
| 4265 | 4358 | } = this.props; |
| ... | ... | @@ -4268,6 +4361,17 @@ export default (ChildComponent) => { |
| 4268 | 4361 | message.warn('请先点击修改!'); |
| 4269 | 4362 | return; |
| 4270 | 4363 | } |
| 4364 | + if (name === 'brandgroup') { | |
| 4365 | + if (!bCheckBoxClick) return; | |
| 4366 | + let { brandgroupOldData = [] } = this.props; | |
| 4367 | + brandgroupOldData = brandgroupOldData.map((item) => { | |
| 4368 | + item.iCheck = selectedRowKeys.includes(item.sId); | |
| 4369 | + item.handleType = item.handleType || 'update'; | |
| 4370 | + return item; | |
| 4371 | + }); | |
| 4372 | + this.props.onSaveState({ brandgroupOldData, brandgroupData: brandgroupOldData, brandgroupSelectedRowKeys: selectedRowKeys }); | |
| 4373 | + return; | |
| 4374 | + } | |
| 4271 | 4375 | const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true); |
| 4272 | 4376 | const { [`${name}SelectedRowKeys`]: rowKeys } = addState; |
| 4273 | 4377 | if (oldData.length > 0) { |
| ... | ... | @@ -4302,6 +4406,7 @@ export default (ChildComponent) => { |
| 4302 | 4406 | if (name === 'approveGroup') { |
| 4303 | 4407 | index = addkeys.indexOf(item.sJurisdictionClassifyId); |
| 4304 | 4408 | } |
| 4409 | + | |
| 4305 | 4410 | if (index === -1) { |
| 4306 | 4411 | delKeys.push(item.sId); |
| 4307 | 4412 | } else if (index > -1) { | ... | ... |
src/components/Common/CommonExamInfo/index.js
| ... | ... | @@ -35,20 +35,45 @@ class CommonExamInfo extends Component { |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | const historyList = sFlowObj?.historyList; /* 审批流程 */ |
| 38 | + const dataList = sFlowObj?.dataList; /* 数据集 */ | |
| 38 | 39 | const sBrandsId = userinfo?.sBrandsId; |
| 39 | 40 | const sSubsidiaryId = userinfo?.sSubsidiaryId; |
| 40 | 41 | const sUserId = userinfo?.sUserName; |
| 41 | 42 | const taskId = sFlowObj?.taskId; |
| 42 | 43 | const sTaskId = sFlowObj?.taskId; |
| 43 | - const commentObj = document.getElementById('comment'); | |
| 44 | - const comment = commentObj?.value ; /* 驳回理由 */ | |
| 45 | - if(btnName ==='reject' && commonUtils.isEmptyObject(comment)){ | |
| 46 | - message.error("请输入驳回理由!") | |
| 44 | + // const commentObj = document.getElementById('comment'); | |
| 45 | + // const comment = commentObj?.value ; /* 驳回理由 */ | |
| 46 | + if(btnName ==='reject' && commonUtils.isEmptyObject(textareaValue)){ | |
| 47 | + message.warn("请输入驳回理由!") | |
| 47 | 48 | return; |
| 48 | 49 | } |
| 49 | 50 | const bizFlowVo = sFlowObj.bizFlowVo; |
| 50 | 51 | const sTableParamsValue= sFlowObj.bizFlowVo?.sTableParamsValue; |
| 51 | 52 | const sFormData= commonUtils.isNotEmptyObject(sTableParamsValue) ? JSON.parse(sTableParamsValue) : {}; |
| 53 | + /* 可输入文本 */ | |
| 54 | + const dataDynamicList = commonUtils.isNotEmptyArr(dataList) ? dataList.filter(item => item.name !=='sEmployeeName') : []; | |
| 55 | + if(commonUtils.isNotEmptyArr(dataDynamicList)) { | |
| 56 | + for (const child of dataDynamicList) { | |
| 57 | + const name = child.name; | |
| 58 | + const bEdit = !child.bEdit; /* 是否编辑 */ | |
| 59 | + const type= child.type; /* 文本类型 */ | |
| 60 | + const obj = {}; | |
| 61 | + if( bEdit ) { /* 可编辑的都传入 */ | |
| 62 | + const sRealName = name +'_sRealName'; | |
| 63 | + const sValue = this.state[name]; | |
| 64 | + if (btnName === 'agree' && commonUtils.isEmptyObject(sValue)) { | |
| 65 | + message.warn(`${child.title} 为必填项!`); | |
| 66 | + return; | |
| 67 | + } | |
| 68 | + sFormData[name]= sValue; | |
| 69 | + if(child.bSelect) { /* 下拉需要传sRealName */ | |
| 70 | + sFormData[sRealName]= this.state[sRealName]; | |
| 71 | + } | |
| 72 | + | |
| 73 | + } | |
| 74 | + } | |
| 75 | + } | |
| 76 | + | |
| 52 | 77 | const prefix = commonConfig.server_host + "currencyFlow"; |
| 53 | 78 | let url = prefix + "/complete/" + taskId+"/"+sBrandsId+"/"+sSubsidiaryId+"/"+sUserId; |
| 54 | 79 | // const data = $('#form-leave-edit').serialize(); |
| ... | ... | @@ -67,8 +92,9 @@ class CommonExamInfo extends Component { |
| 67 | 92 | data.sUserName = sUserId; |
| 68 | 93 | data.messagesTitle = bizFlowVo?.title; |
| 69 | 94 | data.selectMap = {}; |
| 70 | - data.comment = this.state.textareaValue; | |
| 95 | + data.comment = textareaValue; | |
| 71 | 96 | const { token }= this.props; |
| 97 | + console.log('data传参', data); | |
| 72 | 98 | const sReturn = (await commonServices.postValueService(token, data, url)).data; |
| 73 | 99 | if(commonUtils.isNotEmptyObject(sReturn)) { |
| 74 | 100 | if (sReturn.code > 0 || sReturn.code === 0) { |
| ... | ... | @@ -107,7 +133,7 @@ class CommonExamInfo extends Component { |
| 107 | 133 | this.props.getServiceError(sReturn); |
| 108 | 134 | } |
| 109 | 135 | }else { |
| 110 | - message.error('操作异常!') | |
| 136 | + message.warn('操作异常!') | |
| 111 | 137 | } |
| 112 | 138 | |
| 113 | 139 | } |
| ... | ... | @@ -139,11 +165,11 @@ class CommonExamInfo extends Component { |
| 139 | 165 | const taskId = sFlowObj?.taskId; |
| 140 | 166 | const data =[]; |
| 141 | 167 | if(commonUtils.isEmptyObject(delegateToUser)) { |
| 142 | - message.error('请选择转办人!') | |
| 168 | + message.warn('请选择转办人!') | |
| 143 | 169 | return; |
| 144 | 170 | } |
| 145 | 171 | if(delegateToUser === sUserId){ |
| 146 | - message.error('请选择非自己的待办人'); | |
| 172 | + message.warn('请选择非自己的待办人'); | |
| 147 | 173 | return; |
| 148 | 174 | } |
| 149 | 175 | this.setState({flowLoaing:true}); |
| ... | ... | @@ -181,7 +207,7 @@ class CommonExamInfo extends Component { |
| 181 | 207 | this.props.getServiceError(sReturn); |
| 182 | 208 | } |
| 183 | 209 | } else { |
| 184 | - message.error('操作异常!') | |
| 210 | + message.warn('操作异常!') | |
| 185 | 211 | } |
| 186 | 212 | this.setState({ bTransferUserVisible:false }) |
| 187 | 213 | } |
| ... | ... | @@ -190,7 +216,6 @@ class CommonExamInfo extends Component { |
| 190 | 216 | } |
| 191 | 217 | /* 设置textareaValue */ |
| 192 | 218 | handleTextareaChange = (e) => { |
| 193 | - console.log('驳回', e); | |
| 194 | 219 | this.setState({ |
| 195 | 220 | textareaValue: e.target.value, |
| 196 | 221 | }); |
| ... | ... | @@ -201,11 +226,19 @@ class CommonExamInfo extends Component { |
| 201 | 226 | delegateToUser: value |
| 202 | 227 | }); |
| 203 | 228 | }; |
| 229 | + handleInputChange = (e, name) => { | |
| 230 | + const inputValue = e.target.value; | |
| 231 | + this.setState({ | |
| 232 | + [name]: inputValue | |
| 233 | + }); | |
| 234 | + }; | |
| 204 | 235 | |
| 205 | - handleOptionChange = (value) => { | |
| 236 | + handleOptionChange = (value, option, name) => { | |
| 237 | + const sFieldName = name; | |
| 238 | + const sKey = option?.id; | |
| 206 | 239 | this.setState({ |
| 207 | - delegateToUserId: value, | |
| 208 | - delegateToUser:'sEmployeeName' | |
| 240 | + [sFieldName + "_sRealName"]:value, | |
| 241 | + [sFieldName]: sKey | |
| 209 | 242 | }); |
| 210 | 243 | }; |
| 211 | 244 | |
| ... | ... | @@ -223,8 +256,12 @@ class CommonExamInfo extends Component { |
| 223 | 256 | // sFlowObj = sFlowArr[0]; |
| 224 | 257 | // } |
| 225 | 258 | } |
| 226 | - console.log('sFlowObj:', sFlowObj); | |
| 259 | + const isHandle = sFlowObj?.isHandle; | |
| 260 | + // console.log('sFlowObj:', sFlowObj); | |
| 227 | 261 | // const bHandleShow = sFlowObj?.bHandleShow; /* 是否展示按钮及审批意见区域 */ |
| 262 | + if(bHandleShow) { | |
| 263 | + bHandleShow = !sFlowObj.isHandle; | |
| 264 | + } | |
| 228 | 265 | let sFlowTitle = sFlowObj?.title; /* 审批标题 */ |
| 229 | 266 | const dataList = sFlowObj?.dataList; /* 审批数据源 */ |
| 230 | 267 | let historyList = sFlowObj?.historyList; /* 审批流程 */ |
| ... | ... | @@ -302,27 +339,48 @@ class CommonExamInfo extends Component { |
| 302 | 339 | const name = child.name; |
| 303 | 340 | const title = child.title; |
| 304 | 341 | const value = child.value; |
| 305 | - const bEdit = !child.bEdit; /* 是否编辑 */ | |
| 342 | + let bEdit = !child.bEdit; /* 是否编辑 */ | |
| 343 | + /* 如果 isHandle 为 true,代表只能查看, 就不允许编辑 */ | |
| 344 | + if(bEdit) { | |
| 345 | + bEdit = !isHandle; | |
| 346 | + } | |
| 306 | 347 | const type= child.type; /* 文本类型 */ |
| 307 | 348 | const bSelect = child.bSelect; /* 是否下拉 */ |
| 349 | + const selectList = child.selectList; | |
| 308 | 350 | const selectConfig = bSelect && commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sName === name) : []; |
| 309 | - const showDropDown = commonUtils.isNotEmptyArr(selectConfig) ? selectConfig[0].showDropDown : []; /* 可编辑的下拉 */ | |
| 351 | + const showDropDownStr = commonUtils.isNotEmptyArr(selectConfig) && commonUtils.isNotEmptyObject(selectConfig[0].showDropDown) ? | |
| 352 | + selectConfig[0].showDropDown : []; /* 可编辑的下拉 */ | |
| 353 | + const showDropDown = commonUtils.isNotEmptyObject(showDropDownStr) && commonUtils.isJSON(showDropDownStr) ? [JSON.parse(showDropDownStr)] : []; | |
| 310 | 354 | return ( |
| 311 | 355 | <div className={styles.cardLine}> |
| 312 | 356 | <div className={styles.cardColumn}>{title}</div> |
| 313 | 357 | { |
| 314 | - bEdit && type === 's' ? | |
| 315 | - <Input placeholder="请输入" id={name} /> : | |
| 358 | + bEdit && type === 's' && !bSelect ? | |
| 359 | + <div className={styles.cardValue}><Input placeholder="请输入" id={name} onChange={(e) => this.handleInputChange(e, name)} /> </div> : | |
| 316 | 360 | bEdit && type === 's' && bSelect ? |
| 317 | - <Select | |
| 361 | + <div className={styles.cardValue}> <Select | |
| 318 | 362 | id ={name} |
| 319 | 363 | defaultValue="" |
| 320 | 364 | style={{ width: 200 }} |
| 321 | 365 | disabled={false} |
| 322 | - options={showDropDown} | |
| 323 | - onChange={this.handleOptionChange} | |
| 324 | - /> : | |
| 325 | - <div className={styles.cardValue}>{value}</div> | |
| 366 | + options={selectList} | |
| 367 | + onChange={(value, option) => this.handleOptionChange(value, option, name)} | |
| 368 | + /></div> : | |
| 369 | + bEdit && type === 'm' && !bSelect ? | |
| 370 | + <TextArea | |
| 371 | + className={styles.memo} | |
| 372 | + rows={3} | |
| 373 | + id ={name} | |
| 374 | + onChange={(e) => this.handleInputChange(e, name)} | |
| 375 | + placeholder="请输入" | |
| 376 | + /> : | |
| 377 | + <div className={styles.cardValue}> | |
| 378 | + { | |
| 379 | + type === 's' && (name?.includes('sProcessName') || name?.toLowerCase().indexOf('memo') > -1) ? | |
| 380 | + <pre className={styles.preStyle}> {value} </pre> : value | |
| 381 | + } | |
| 382 | + | |
| 383 | + </div> | |
| 326 | 384 | } |
| 327 | 385 | |
| 328 | 386 | </div> | ... | ... |
src/components/Common/CommonGroupBill.js
| ... | ... | @@ -16,7 +16,7 @@ import CommonViewTable from '@/components/Common/CommonViewTable'; |
| 16 | 16 | import CommonViewDrag from '@/components/Common/CommonViewDrag'; |
| 17 | 17 | import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ |
| 18 | 18 | import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ |
| 19 | -import commonConfig from '@/utils/config'; | |
| 19 | +import commonConfig from '@/utils/config'; | |
| 20 | 20 | import * as commonUtils from '@/utils/utils';/* 通用方法 */ |
| 21 | 21 | import * as commonServices from '@/services/services';/* 服务类 */ |
| 22 | 22 | import AddIcon from '@/assets/add.svg'; | ... | ... |
src/components/Common/CommonGroupBillEvent.js
| ... | ... | @@ -1780,10 +1780,10 @@ export default (ChildComponent) => { |
| 1780 | 1780 | confirm({ |
| 1781 | 1781 | title: obj.title, |
| 1782 | 1782 | onOk() { |
| 1783 | - // const bChanged = commonBusiness.handleGetChanged(that.props) ; | |
| 1784 | - // if(bChanged) { | |
| 1785 | - // onGetDataOk(masterConfig, slaveConfig, slave1Config); | |
| 1786 | - // } | |
| 1783 | + const bChanged = commonBusiness.handleGetChanged(that.props) ; | |
| 1784 | + if(bChanged) { | |
| 1785 | + onGetDataOk(masterConfig, slaveConfig, slave1Config); | |
| 1786 | + } | |
| 1787 | 1787 | onSaveStateOk({ enabled: false }); |
| 1788 | 1788 | if (commonUtils.isNotEmptyObject(copyTo)) { |
| 1789 | 1789 | const { slaveData } = copyTo; | ... | ... |
src/components/Common/CommonJurisdictionEvent.js
0 → 100644
| 1 | +/* eslint-disable array-callback-return,no-undef,prefer-destructuring */ | |
| 2 | +import React, { Component } from 'react'; | |
| 3 | +import { Modal, message } from 'antd-v4'; | |
| 4 | +import commonConfig from '../../utils/config'; | |
| 5 | +import * as commonBusiness from './commonBusiness'; /* 单据业务功能 */ | |
| 6 | +import * as commonUtils from '../../utils/utils'; /* 通用方法 */ | |
| 7 | +import * as commonServices from './../../services/services'; /* 服务类 */ | |
| 8 | + | |
| 9 | +const { confirm } = Modal; | |
| 10 | + | |
| 11 | +export default (ChildComponent) => { | |
| 12 | + return class extends Component { | |
| 13 | + constructor(props) { | |
| 14 | + super(props); | |
| 15 | + this.state = {}; | |
| 16 | + this.form = {}; | |
| 17 | + /* 表单对象 */ | |
| 18 | + } | |
| 19 | + | |
| 20 | + componentWillReceiveProps(nextProps) { | |
| 21 | + const { | |
| 22 | + formData, currentId, groupConfig, treeData, | |
| 23 | + } = nextProps; | |
| 24 | + let { bReceived } = nextProps; | |
| 25 | + const sId = currentId !== undefined ? currentId : ''; | |
| 26 | + | |
| 27 | + if (commonUtils.isEmptyObject(groupConfig) && bReceived === undefined) { | |
| 28 | + const masterConfig = formData.filter(item => !item.bGrd)[0]; | |
| 29 | + this.handleGetChangeData({ name: 'tree' }, 'SysjurisdictionTree'); | |
| 30 | + bReceived = true; | |
| 31 | + const group = this.imitateTableColumnConfig('group', [this.imitateTableColumn('组权限', 'sName', 'sId')]); | |
| 32 | + const user = this.imitateTableColumnConfig('user', [this.imitateTableColumn('用户账号', 'sUserName', 'sId')]); | |
| 33 | + | |
| 34 | + const userGroup = this.imitateTableColumnConfig('userGroup', [this.imitateTableColumn('组成员', 'sUserName', 'sUsersId')]); | |
| 35 | + const groupUser = this.imitateTableColumnConfig('groupUser', [this.imitateTableColumn('所属分组', 'sGroupName', 'sGroupsId')]); | |
| 36 | + | |
| 37 | + const checkedNodes = this.imitateTableColumnConfig('checkedNodes', [this.imitateTableColumn('名称', 'showName', 'sId')]); | |
| 38 | + | |
| 39 | + const tree = this.imitateTableColumnConfig('tree', [this.imitateTableColumn('名称', 'showName', 'key')]); | |
| 40 | + | |
| 41 | + const search = this.imitateTableColumnConfig('search', [this.imitateTableColumn('名称', 'showName', 'sAllId')]); | |
| 42 | + | |
| 43 | + this.props.onSaveState({ | |
| 44 | + masterConfig, | |
| 45 | + sId, | |
| 46 | + bReceived, | |
| 47 | + treeKeyName: 'key', | |
| 48 | + showLine: false, | |
| 49 | + // pageLoading: false, | |
| 50 | + ...tree, | |
| 51 | + ...group, | |
| 52 | + ...user, | |
| 53 | + ...userGroup, | |
| 54 | + ...groupUser, | |
| 55 | + ...checkedNodes, | |
| 56 | + ...search, | |
| 57 | + }); | |
| 58 | + } | |
| 59 | + if (commonUtils.isNotEmptyArr(treeData) && bReceived) { | |
| 60 | + this.handleGetChangeData({ name: 'group' }, 'GroupData'); | |
| 61 | + this.handleGetChangeData({ name: 'user' }, 'UserData'); | |
| 62 | + this.props.onSaveState({ | |
| 63 | + bReceived: false, | |
| 64 | + pageLoading: false, | |
| 65 | + }); | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + | |
| 70 | + shouldComponentUpdate(nextProps, nextState) { | |
| 71 | + let flag = true; | |
| 72 | + /* 追加弹出框数值回填放行判断ppopupPane */ | |
| 73 | + if (nextProps.sTabId === nextProps.app.currentPane.key || ((nextProps.app.ppopupPane !== undefined | |
| 74 | + && nextProps.app.ppopupPane.mainConfig !== undefined) | |
| 75 | + ? nextProps.sTabId === nextProps.app.ppopupPane.mainConfig.key : false)) { | |
| 76 | + if (nextState.disabled !== this.state.disabled) { | |
| 77 | + return true; | |
| 78 | + } | |
| 79 | + flag = true; | |
| 80 | + } else { | |
| 81 | + flag = false; | |
| 82 | + } | |
| 83 | + return flag; | |
| 84 | + } | |
| 85 | + | |
| 86 | + componentWillUpdate(nextProps) { | |
| 87 | + const { masterData, sModelsType, elemachineData } = nextProps; | |
| 88 | + if (sModelsType === 'element/teamInfo' && masterData !== undefined) { | |
| 89 | + if (commonUtils.isNotEmptyObject(elemachineData)) { | |
| 90 | + elemachineData.forEach((row, index) => { | |
| 91 | + if (row.sMachineId === masterData.sMachineId) { | |
| 92 | + elemachineData[index].bDefault = true; | |
| 93 | + } else { | |
| 94 | + elemachineData[index].bDefault = false; | |
| 95 | + } | |
| 96 | + }); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + /** 表单回带 */ | |
| 103 | + handleForm = (form) => { | |
| 104 | + this.form = form; | |
| 105 | + }; | |
| 106 | + /** 主表控件是否全部显示 */ | |
| 107 | + handleToggle = () => { | |
| 108 | + const { expand } = this.props; | |
| 109 | + this.props.onSaveState({ expand: !expand }); | |
| 110 | + }; | |
| 111 | + | |
| 112 | + handleValidateSave = async (componentName) => { | |
| 113 | + const { | |
| 114 | + token, sModelsId, sJurisdictionClassifyId, sUserId, treeAllNodes, [`${componentName}KeyName`]: skeyName, treeCheckedKeys, treeAllCheckKeys, | |
| 115 | + app, | |
| 116 | + } = this.props; | |
| 117 | + const value = {}; | |
| 118 | + if ((commonUtils.isEmptyArr(sJurisdictionClassifyId) && commonUtils.isEmptyArr(sUserId))) { | |
| 119 | + message.warn(commonFunc.showMessage(app.commonConst, 'NotEmptyJurisdictionGroup'));/* 组员,所属或权限组不能为空! */ | |
| 120 | + this.props.onSaveState({ | |
| 121 | + loading: false, | |
| 122 | + }); | |
| 123 | + return; | |
| 124 | + } | |
| 125 | + if (commonUtils.isNotEmptyArr(sJurisdictionClassifyId) && commonUtils.isEmptyArr(sUserId)) { | |
| 126 | + value.sJurisdictionClassifyId = sJurisdictionClassifyId[0]; | |
| 127 | + } else if (commonUtils.isNotEmptyArr(sUserId) && commonUtils.isEmptyArr(sJurisdictionClassifyId)) { | |
| 128 | + value.sUserId = sUserId[0]; | |
| 129 | + } else { | |
| 130 | + message.warn(commonFunc.showMessage(app.commonConst, 'NotEmptyGroup'));/* 组或者组员不能为空 */ | |
| 131 | + this.props.onSaveState({ | |
| 132 | + loading: false, | |
| 133 | + }); | |
| 134 | + return; | |
| 135 | + } | |
| 136 | + /* | |
| 137 | + if (commonUtils.isNotEmptyArr(treeCheckedKeys) && treeCheckedKeys.length === treeAllCheckKeys.length) { | |
| 138 | + message.warn('请选择不需要的权限!'); | |
| 139 | + return; | |
| 140 | + } | |
| 141 | + */ | |
| 142 | + const newUncheckedKeys = []; | |
| 143 | + const saveData = []; | |
| 144 | + | |
| 145 | + treeAllCheckKeys.forEach((key) => { | |
| 146 | + const iIndex = treeCheckedKeys.indexOf(key); | |
| 147 | + if (iIndex === -1) { | |
| 148 | + newUncheckedKeys.push(key); | |
| 149 | + } | |
| 150 | + }); | |
| 151 | + newUncheckedKeys.forEach((key) => { | |
| 152 | + const nodes = treeAllNodes.get(key); | |
| 153 | + saveData.push({ sKey: nodes[`${skeyName}`], sAction: nodes.sName }); | |
| 154 | + }); | |
| 155 | + | |
| 156 | + value.data = saveData; | |
| 157 | + value.sTreeAllKet = treeAllCheckKeys; | |
| 158 | + | |
| 159 | + const dataUrl = `${commonConfig.server_host}/sysjurisdiction/addSysjurisdiction?sModelsId=${sModelsId}`; | |
| 160 | + const dataReturn = (await commonServices.postValueService(token, value, dataUrl)).data; | |
| 161 | + /* 成功的话返回数据 */ | |
| 162 | + if (dataReturn.code === 1) { /* 成功 */ | |
| 163 | + message.success(dataReturn.msg); | |
| 164 | + this.props.onSaveState({ enabled: false, loading: false }); | |
| 165 | + return dataReturn; | |
| 166 | + } else { /* 失败 */ | |
| 167 | + this.props.getServiceError(dataReturn); | |
| 168 | + this.props.onSaveState({ | |
| 169 | + loading: false, | |
| 170 | + }); | |
| 171 | + return false; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** 点击修改按钮操作 */ | |
| 176 | + handleEdit = () => { | |
| 177 | + this.props.onSaveState({ enabled: true, loading: false }); | |
| 178 | + } | |
| 179 | + handleCancel = (obj) => { | |
| 180 | + const { groupUserData } = this.props; | |
| 181 | + const onGetChangeData = this.handleGetChangeData; | |
| 182 | + const onSaveStateOk = this.props.onSaveState; | |
| 183 | + confirm({ | |
| 184 | + title: obj.title, | |
| 185 | + onOk() { | |
| 186 | + const sId = groupUserData.length > 0 ? groupUserData[0].sId : ''; | |
| 187 | + onSaveStateOk({ enabled: false }); | |
| 188 | + onGetChangeData({ name: 'authority', sId }, 'GroupAuthority'); | |
| 189 | + }, | |
| 190 | + onCancel() { | |
| 191 | + }, | |
| 192 | + }); | |
| 193 | + } | |
| 194 | + | |
| 195 | + handleGetSisformulaData = (masterConfig) => { | |
| 196 | + this.handleGetSlaveData('One', null, masterConfig); | |
| 197 | + } | |
| 198 | + | |
| 199 | + handleGetSlaveData = (getType, sName, currConfig) => { | |
| 200 | + const { currentId } = this.props; | |
| 201 | + /* 当前页签数据 */ | |
| 202 | + const sId = currentId !== undefined ? currentId : ''; | |
| 203 | + if (getType === 'One') { | |
| 204 | + this.props.handleGetDataOne({ | |
| 205 | + name: 'master', configData: currConfig, condition: { sId, pageSize: '', pageNum: '' }, | |
| 206 | + }); | |
| 207 | + } | |
| 208 | + if (getType === 'Set') { | |
| 209 | + this.props.handleGetDataSet({ | |
| 210 | + name: sName, configData: currConfig, condition: { sSqlCondition: { sParentId: sId } }, | |
| 211 | + }); | |
| 212 | + } | |
| 213 | + } | |
| 214 | + /* 获取分组列表 | |
| 215 | + yw_权限分配 | |
| 216 | + 获取分组列表 | |
| 217 | + 获取人员列表 | |
| 218 | + qx_获取权限树 | |
| 219 | + qx_根据组sId获取已选择权限 | |
| 220 | + qx_根据人sId获取已选择权限 | |
| 221 | + qx_根据组sId获取组人员 | |
| 222 | + 根据人员sId获取所属分组 | |
| 223 | + 保存组已选权限 | |
| 224 | + * */ | |
| 225 | + handleGetChangeData = async (params, urlKey) => { | |
| 226 | + const { app, sModelsId } = this.props; | |
| 227 | + const { token } = app; | |
| 228 | + const { name, sId, treeComponentName } = params; // name, | |
| 229 | + let dataUrl = ''; | |
| 230 | + if (urlKey === 'SysjurisdictionTree') { // 树结构 | |
| 231 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getSysjurisdictionTree?sModelsId=${sModelsId}`; | |
| 232 | + } else if (urlKey === 'GroupData') { // 组 | |
| 233 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getGroupData?sModelsId=${sModelsId}`; | |
| 234 | + } else if (urlKey === 'UserData') { // 用户 | |
| 235 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getUserData?sModelsId=${sModelsId}`; | |
| 236 | + } else if (urlKey === 'UserGroupId') { // 组成员 | |
| 237 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getsUserGroupId/${sId}?sModelsId=${sModelsId}`; | |
| 238 | + } else if (urlKey === 'GroupUserId') { // 用户所属组 | |
| 239 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getGroupUserId/${sId}?sModelsId=${sModelsId}`; | |
| 240 | + } else if (urlKey === 'GroupAuthority') { // 组权限 | |
| 241 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getHaveAuthorityGroupId/${sId}?sModelsId=${sModelsId}`; | |
| 242 | + } else if (urlKey === 'UserAuthority') { // 用户所有权限查询 :用户权限,组权限 | |
| 243 | + dataUrl = `${commonConfig.server_host}sysjurisdiction/getHaveAuthorityUserId/${sId}?sModelsId=${sModelsId}`; | |
| 244 | + } | |
| 245 | + const dataReturn = (await commonServices.getService(token, dataUrl)).data; | |
| 246 | + if (dataReturn.code === 1) { | |
| 247 | + const returnData = dataReturn.dataset.rows; | |
| 248 | + let addState = {}; | |
| 249 | + if (urlKey === 'SysjurisdictionTree') { // 树结构 | |
| 250 | + const allInitArr = []; | |
| 251 | + const allInitMap = new Map(); | |
| 252 | + this.handleAllCheckKeys(allInitArr, allInitMap, returnData); | |
| 253 | + this.props.onSaveState({ [`${name}Data`]: returnData, treeAllCheckKeys: allInitArr, treeAllNodes: allInitMap }); | |
| 254 | + } else if (urlKey === 'GroupData') { // 获取组后默认查询组权限,以及组成员 | |
| 255 | + this.props.onSaveState({ [`${name}Data`]: returnData }); | |
| 256 | + if (commonUtils.isNotEmptyArr(returnData)) { | |
| 257 | + this.handleTableSelectRowChange('group', [returnData[0].sId]); // 查询第一组成员 | |
| 258 | + } | |
| 259 | + } else if (urlKey === 'UserData') { // 获取成员后默认 成员自己的权限,以及成员所属组 | |
| 260 | + this.props.onSaveState({ [`${name}Data`]: returnData }); | |
| 261 | + if (commonUtils.isNotEmptyArr(returnData)) { | |
| 262 | + this.handleGetChangeData({ name: 'groupUser', sId: returnData[0].sId }, 'GroupUserId'); // 查询第一个成员归属组 | |
| 263 | + } | |
| 264 | + } else if (urlKey === 'GroupAuthority') { | |
| 265 | + let groupAuth = ''; | |
| 266 | + let groupAuthData = []; | |
| 267 | + if (commonUtils.isNotEmptyArr(returnData)) { | |
| 268 | + if (commonUtils.isNotEmptyObject(returnData[0])) { | |
| 269 | + groupAuth = commonUtils.isNotEmptyObject(returnData[0]) ? returnData[0].sKeys : []; | |
| 270 | + groupAuthData = commonUtils.isNotEmptyObject(groupAuth) ? groupAuth.split(',') : []; | |
| 271 | + } | |
| 272 | + } | |
| 273 | + addState = this.handleUnCheckedForFunction(treeComponentName, groupAuthData); | |
| 274 | + this.props.onSaveState({ | |
| 275 | + [`${name}Data`]: returnData, userAuth: undefined, sJurisdictionClassifyId: sId, sUserId: undefined, ...addState, | |
| 276 | + }); | |
| 277 | + } else if (urlKey === 'UserAuthority') { | |
| 278 | + let gAuth = ''; | |
| 279 | + let groupAuthData = []; | |
| 280 | + let uAuth = ''; | |
| 281 | + let userAuthData = []; | |
| 282 | + if (commonUtils.isNotEmptyArr(returnData)) { | |
| 283 | + if (commonUtils.isNotEmptyObject(returnData[0])) { | |
| 284 | + const { groupAuth, userAuth } = returnData[0]; | |
| 285 | + if (commonUtils.isNotEmptyObject(groupAuth)) { | |
| 286 | + gAuth = groupAuth.sKeys; | |
| 287 | + groupAuthData = gAuth.split(','); | |
| 288 | + } | |
| 289 | + | |
| 290 | + if (commonUtils.isNotEmptyObject(userAuth)) { | |
| 291 | + uAuth = userAuth.sKeys; | |
| 292 | + userAuthData = uAuth.split(','); | |
| 293 | + } | |
| 294 | + } | |
| 295 | + } | |
| 296 | + addState = this.handleGroupForFunction(treeComponentName, groupAuthData, userAuthData); | |
| 297 | + this.props.onSaveState({ | |
| 298 | + [`${name}Data`]: returnData, userAuthData, sJurisdictionClassifyId: undefined, sUserId: sId, ...addState, | |
| 299 | + }); | |
| 300 | + } else { | |
| 301 | + this.props.onSaveState({ [`${name}Data`]: returnData }); | |
| 302 | + } | |
| 303 | + } else { | |
| 304 | + this.props.getServiceError(dataReturn); | |
| 305 | + } | |
| 306 | + } | |
| 307 | + | |
| 308 | + // 模拟 列 | |
| 309 | + imitateTableColumn = (title, dataIndex, key) => { | |
| 310 | + return { | |
| 311 | + title, dataIndex, key, width: '120', | |
| 312 | + }; | |
| 313 | + } | |
| 314 | + // 模拟config的 gdsconfigformslave 配置 | |
| 315 | + imitateTableConfig = (title, dataIndex) => { | |
| 316 | + return { | |
| 317 | + bCanInput: false, | |
| 318 | + bFilter: false, | |
| 319 | + bFind: false, | |
| 320 | + bFirstEmpty: false, | |
| 321 | + bIsOther: false, | |
| 322 | + bNewRecord: false, | |
| 323 | + bNotEmpty: false, | |
| 324 | + bNotRepeat: false, | |
| 325 | + bReadonly: true, | |
| 326 | + bSum: false, | |
| 327 | + bTree: false, | |
| 328 | + bVisible: true, | |
| 329 | + iColValue: 1, | |
| 330 | + iFitWidth: 0, | |
| 331 | + sBrandsId: '1111111111', | |
| 332 | + sChinese: title, | |
| 333 | + sChineseDropDown: '', | |
| 334 | + sControlName: 'BtnLast', | |
| 335 | + sId: commonUtils.createSid(), | |
| 336 | + sParentId: '11811781131121915102156308120', | |
| 337 | + sSubsidiaryId: '1111111111', | |
| 338 | + showName: title, | |
| 339 | + sName: dataIndex, | |
| 340 | + }; | |
| 341 | + } | |
| 342 | + // 根据模拟列,模拟列配置 | |
| 343 | + imitateTableColumnConfig = (name, columns) => { | |
| 344 | + const gdsconfigformslave = []; | |
| 345 | + columns.forEach((itmes) => { | |
| 346 | + gdsconfigformslave.push(this.imitateTableConfig(itmes.title, itmes.dataIndex)); | |
| 347 | + }); | |
| 348 | + const config = { bGrd: true, gdsconfigformslave }; | |
| 349 | + return { [`${name}Column`]: columns, [`${name}Config`]: config }; | |
| 350 | + } | |
| 351 | + /** 处理选择行发生改变 */ | |
| 352 | + handleTableSelectRowChange = (name, selectedRowKeys) => { | |
| 353 | + const addState = {}; | |
| 354 | + if (name === 'group') { | |
| 355 | + this.handleGetChangeData({ name: 'userGroup', sId: selectedRowKeys }, 'UserGroupId'); | |
| 356 | + this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'GroupAuthority'); | |
| 357 | + addState.groupSelectedRowKeys = selectedRowKeys; | |
| 358 | + } else if (name === 'user') { | |
| 359 | + this.handleGetChangeData({ name: 'groupUser', sId: selectedRowKeys }, 'GroupUserId'); | |
| 360 | + this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'UserAuthority'); | |
| 361 | + addState.userSelectedRowKeys = selectedRowKeys; | |
| 362 | + } else if (name === 'userGroup') { | |
| 363 | + this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'UserAuthority'); | |
| 364 | + addState.userGroupSelectedRowKeys = selectedRowKeys; | |
| 365 | + } else if (name === 'groupUser') { | |
| 366 | + this.handleGetChangeData({ name: 'master', sId: selectedRowKeys, treeComponentName: 'tree' }, 'GroupAuthority'); | |
| 367 | + addState.groupUserSelectedRowKeys = selectedRowKeys; | |
| 368 | + } | |
| 369 | + this.props.onSaveState({ ...addState }); | |
| 370 | + } | |
| 371 | + | |
| 372 | + handleCheckBoxCheck = (componentName, checkedKeys) => { | |
| 373 | + this.handleCheckedForFunction(componentName, checkedKeys); | |
| 374 | + } | |
| 375 | + | |
| 376 | + /* 选择权限同时处理保存的数据以及将要展现的已选择权限 */ | |
| 377 | + handleCheckedForFunction = (componentName, checkedKeys) => { | |
| 378 | + const { | |
| 379 | + treeAllNodes, | |
| 380 | + } = this.props; | |
| 381 | + const data = []; | |
| 382 | + const checkedData = []; | |
| 383 | + if (commonUtils.isNotEmptyArr(treeAllNodes) && treeAllNodes.size > 0) { | |
| 384 | + const newCheckedKeys = []; | |
| 385 | + if (commonUtils.isNotEmptyArr(checkedKeys) && checkedKeys[0] !== null) { | |
| 386 | + checkedKeys.forEach((key, i) => { | |
| 387 | + if (checkedKeys.indexOf(key) === i) { | |
| 388 | + newCheckedKeys.push(key); | |
| 389 | + } | |
| 390 | + }); | |
| 391 | + newCheckedKeys.forEach((key) => { | |
| 392 | + const nodes = treeAllNodes.get(key); | |
| 393 | + if (commonUtils.isNotEmptyObject(nodes)) { | |
| 394 | + checkedData.push({ sId: nodes.sId, showName: nodes.showName }); | |
| 395 | + } | |
| 396 | + }); | |
| 397 | + } | |
| 398 | + this.props.onSaveState({ | |
| 399 | + [`${componentName}CheckedKeys`]: newCheckedKeys, | |
| 400 | + treeSaveParams: data, | |
| 401 | + checkedNodesData: checkedData, | |
| 402 | + }); | |
| 403 | + } | |
| 404 | + } | |
| 405 | + | |
| 406 | + handleUnCheckedForFunction = (componentName, unCheckedKeys) => { | |
| 407 | + const { treeAllNodes, treeAllCheckKeys } = this.props; | |
| 408 | + const addState = {}; | |
| 409 | + const checkedData = []; | |
| 410 | + let checkKeys = []; | |
| 411 | + checkKeys = checkKeys.concat(treeAllCheckKeys); | |
| 412 | + | |
| 413 | + if (commonUtils.isNotEmptyArr(unCheckedKeys)) { | |
| 414 | + for (const checkId of unCheckedKeys) { | |
| 415 | + treeAllCheckKeys.forEach((key) => { | |
| 416 | + if (checkId.includes(key)) { | |
| 417 | + checkKeys.forEach((item, index) => { | |
| 418 | + if (item === key) { | |
| 419 | + checkKeys.splice(index, 1); | |
| 420 | + } | |
| 421 | + }); | |
| 422 | + } | |
| 423 | + }); | |
| 424 | + } | |
| 425 | + } | |
| 426 | + checkKeys.forEach((key) => { | |
| 427 | + const nodes = treeAllNodes.get(key); | |
| 428 | + if (commonUtils.isNotEmptyObject(nodes)) { | |
| 429 | + checkedData.push({ sId: nodes.sId, showName: nodes.showName }); | |
| 430 | + } | |
| 431 | + }); | |
| 432 | + addState[`${componentName}CheckedKeys`] = checkKeys; | |
| 433 | + addState.checkedNodesData = checkedData; | |
| 434 | + addState.disabledCheckedKeys = []; | |
| 435 | + return addState; | |
| 436 | + } | |
| 437 | + | |
| 438 | + handleGroupForFunction = (treeComponentName, groupAuthData, userAuthData) => { | |
| 439 | + const { treeAllNodes, treeAllCheckKeys } = this.props; | |
| 440 | + const addState = {}; | |
| 441 | + const checkedData = []; | |
| 442 | + let checkKeys = []; | |
| 443 | + let userAuthDataNew = []; | |
| 444 | + checkKeys = checkKeys.concat(treeAllCheckKeys); | |
| 445 | + if (commonUtils.isEmptyArr(userAuthData)) { /* 只有组权限 没有用户权限时 */ | |
| 446 | + userAuthDataNew = JSON.parse(JSON.stringify(groupAuthData)); /* 深拷贝 */ | |
| 447 | + userAuthData = userAuthDataNew; | |
| 448 | + } | |
| 449 | + if (commonUtils.isNotEmptyArr(userAuthData)) { | |
| 450 | + treeAllCheckKeys.forEach((key) => { | |
| 451 | + for (const checkId of userAuthData) { | |
| 452 | + if (checkId.includes(key)) { | |
| 453 | + checkKeys.forEach((item, index) => { | |
| 454 | + if (item === key) { | |
| 455 | + checkKeys.splice(index, 1); | |
| 456 | + } | |
| 457 | + }); | |
| 458 | + } | |
| 459 | + } | |
| 460 | + }); | |
| 461 | + checkKeys.forEach((key) => { | |
| 462 | + const nodes = treeAllNodes.get(key); | |
| 463 | + if (commonUtils.isNotEmptyObject(nodes)) { | |
| 464 | + checkedData.push({ sId: nodes.sId, showName: nodes.showName }); | |
| 465 | + } | |
| 466 | + }); | |
| 467 | + } | |
| 468 | + | |
| 469 | + let groupCheckKeys = []; | |
| 470 | + if (commonUtils.isNotEmptyArr(groupAuthData)) { | |
| 471 | + groupCheckKeys = groupCheckKeys.concat(treeAllCheckKeys); | |
| 472 | + treeAllCheckKeys.forEach((key) => { | |
| 473 | + for (const checkId of groupAuthData) { | |
| 474 | + if (checkId === key) { | |
| 475 | + groupCheckKeys.splice(groupCheckKeys.indexOf(key), 1); | |
| 476 | + } | |
| 477 | + } | |
| 478 | + }); | |
| 479 | + } else { | |
| 480 | + groupCheckKeys = treeAllCheckKeys; /* 组权限没有 */ | |
| 481 | + } | |
| 482 | + addState[`${treeComponentName}CheckedKeys`] = checkKeys.concat(groupCheckKeys); | |
| 483 | + addState.checkedNodesData = checkedData; | |
| 484 | + addState.disabledCheckedKeys = groupCheckKeys; | |
| 485 | + return addState; | |
| 486 | + }; | |
| 487 | + | |
| 488 | + handleAllCheckKeys = (arrObj, mapObj, returnData) => { | |
| 489 | + const { treeKeyName } = this.props; | |
| 490 | + returnData.forEach((item) => { | |
| 491 | + if (item.children.length > 0) { | |
| 492 | + arrObj.push(item[`${treeKeyName}`]); | |
| 493 | + mapObj.set(item[`${treeKeyName}`], item); | |
| 494 | + this.handleAllCheckKeys(arrObj, mapObj, item.children); | |
| 495 | + } else { | |
| 496 | + arrObj.push(item[`${treeKeyName}`]); | |
| 497 | + mapObj.set(item[`${treeKeyName}`], item); | |
| 498 | + } | |
| 499 | + }); | |
| 500 | + }; | |
| 501 | + handleRefresh = () => { | |
| 502 | + this.handleGetChangeData({ name: 'tree' }, 'SysjurisdictionTree'); | |
| 503 | + this.handleGetChangeData({ name: 'group' }, 'GroupData'); | |
| 504 | + this.handleGetChangeData({ name: 'user' }, 'UserData'); | |
| 505 | + this.props.onSaveState({ | |
| 506 | + treeAllCheckKeys: undefined, | |
| 507 | + treeAllNodes: undefined, | |
| 508 | + }); | |
| 509 | + } | |
| 510 | + handleSearch = async (sSearchValue) => { | |
| 511 | + const { sModelsId } = this.props; | |
| 512 | + const url = `${commonConfig.server_host}gdsmodule/getGdsmoduleList?sModelsId=${sModelsId}&sName=${sSearchValue}`; | |
| 513 | + const dataReturn = (await commonServices.getService(this.props.app.token, url)).data; | |
| 514 | + if (dataReturn.code === 1) { | |
| 515 | + /* 数据查询成功 */ | |
| 516 | + this.props.onSaveState({ searchData: dataReturn.dataset.rows }); | |
| 517 | + } else { /* 失败 */ | |
| 518 | + this.props.getServiceError(dataReturn); | |
| 519 | + } | |
| 520 | + } | |
| 521 | + handleSetTreeOptionData = (name, optionName, value) => { | |
| 522 | + this.props.onSaveState({ [`${name}${optionName}Keys`]: value }); | |
| 523 | + } | |
| 524 | + render() { | |
| 525 | + const { masterData } = this.props; | |
| 526 | + const imgSrc = commonBusiness.handleAddIcon(masterData); | |
| 527 | + return ( | |
| 528 | + <ChildComponent | |
| 529 | + {...this.props} | |
| 530 | + {...this.state} | |
| 531 | + onReturnForm={this.handleForm} | |
| 532 | + onSubmit={this.handleValidateSave.bind(this, 'tree')} | |
| 533 | + onEdit={this.handleEdit} | |
| 534 | + onTableSelectRowChange={this.handleTableSelectRowChange} | |
| 535 | + onCancel={this.handleCancel} | |
| 536 | + imgSrc={imgSrc} | |
| 537 | + onToggle={this.handleToggle} | |
| 538 | + onTreeCheck={this.handleCheckBoxCheck} | |
| 539 | + onRefresh={this.handleRefresh} | |
| 540 | + onSearch={this.handleSearch} | |
| 541 | + onDoubleClick={this.handleDoubleClick} | |
| 542 | + onSetTreeOptionKeys={this.handleSetTreeOptionData} | |
| 543 | + /> | |
| 544 | + ); | |
| 545 | + } | |
| 546 | + }; | |
| 547 | +}; | ... | ... |
src/components/Common/CommonList.js
| ... | ... | @@ -7,7 +7,6 @@ import CommonListEvent from '@/components/Common/CommonListEvent';/* ç»§æ‰¿é”€å” |
| 7 | 7 | import * as commonFunc from '@/components/Common/commonFunc';/* é€šç”¨å•æ®æ–¹æ³• */ /* é€šç”¨å•æ®æ–¹æ³• */ |
| 8 | 8 | import Toolbar from '@/components/Common/ToolBar/ToolBarNew'; |
| 9 | 9 | import StaticEditTable from '@/components/Common/CommonTable';/* å¯ç¼–è¾‘è¡¨æ ¼ */ |
| 10 | -// import StaticEditTableNew from '@/components/Common/CommonTableNew';/* å¯ç¼–è¾‘è¡¨æ ¼ */ | |
| 11 | 10 | import styles from '@/index.less'; |
| 12 | 11 | import CommonBase from '@/components/Common/CommonBase';/* 获å–é…ç½®åŠæ•°æ® */ |
| 13 | 12 | import * as commonBusiness from '@/components/Common/commonBusiness';/* 啿®ä¸šåŠ¡åŠŸèƒ½ */ |
| ... | ... | @@ -418,7 +417,7 @@ const TreeTableComponent = (props) => { |
| 418 | 417 | }; |
| 419 | 418 | |
| 420 | 419 | let slaveTreeData = slaveData; |
| 421 | - const bTree = slaveConfig?.sTableType === 'single' && slaveData?.some(item => !!item.sFatherSlaveId); | |
| 420 | + const bTree = slaveConfig?.sTableType === 'single' && slaveData?.some(item => !!item.sFatherSlaveId || !!item.sParentId); | |
| 422 | 421 | if (bTree) { |
| 423 | 422 | let keyField = 'sId'; |
| 424 | 423 | let keyParentField = 'sParentId'; |
| ... | ... | @@ -427,6 +426,14 @@ const TreeTableComponent = (props) => { |
| 427 | 426 | if (commonUtils.isNotEmptyArr(formData)) { |
| 428 | 427 | // eslint-disable-next-line prefer-destructuring |
| 429 | 428 | sSqlCondition = formData[0].sSqlCondition; |
| 429 | + if (commonUtils.isEmptyObject(sSqlCondition)) { | |
| 430 | + const bParentId = slaveConfig?.sTableType === 'single' && slaveData?.some(item => !!item.sParentId); | |
| 431 | + if (bParentId) { | |
| 432 | + sSqlCondition = 'slave.sId.sParentId'; | |
| 433 | + } else { | |
| 434 | + sSqlCondition = 'slave.sId.sFatherSlaveId'; | |
| 435 | + } | |
| 436 | + } | |
| 430 | 437 | const parts = sSqlCondition.split('.'); |
| 431 | 438 | if (commonUtils.isNotEmptyObject(sSqlCondition) && commonUtils.isNotEmptyArr(parts) && parts.length > 2) { |
| 432 | 439 | // eslint-disable-next-line prefer-destructuring |
| ... | ... | @@ -464,7 +471,6 @@ const TreeTableComponent = (props) => { |
| 464 | 471 | }} |
| 465 | 472 | > |
| 466 | 473 | <StaticEditTable {...tableProps} tableBelone="list" /> |
| 467 | - {/* <StaticEditTableNew {...tableProps} /> */} | |
| 468 | 474 | </div> |
| 469 | 475 | ); |
| 470 | 476 | }; | ... | ... |
src/components/Common/CommonListEdit.js
| 1 | 1 | /* 此组件作用是 可编辑列表 */ |
| 2 | 2 | import React, { Component } from 'react'; |
| 3 | 3 | import { Form } from '@ant-design/compatible'; |
| 4 | +import '@ant-design/compatible/assets/index.css'; | |
| 4 | 5 | import { Layout, Spin, Slider } from 'antd-v4'; |
| 5 | 6 | import CommonListEvent from '@/components/Common/CommonListEditEvent';/* 继承销售模块业务功能 */ |
| 6 | 7 | import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ | ... | ... |
src/components/Common/CommonListEvent.js
| ... | ... | @@ -210,7 +210,7 @@ export default (ChildComponent) => { |
| 210 | 210 | } |
| 211 | 211 | // const employeeData = commonUtils.isNotEmptyObject(app.employeeAndProcessData) && commonUtils.isNotEmptyArr(app.employeeAndProcessData.employeeData) ? app.employeeAndProcessData.employeeData : []; |
| 212 | 212 | // 为oee历史记录员工数据进行数据缓存 |
| 213 | - if (commonUtils.isJSON(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData_${app.sTeamNameSId}`)) && JSON.parse(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData_${app.sTeamNameSId}`)).length > 0 && !this.props.employeeDataSetted) { | |
| 213 | + if (commonUtils.isNotEmptyObject(getData) && commonUtils.isJSON(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData_${app.sTeamNameSId}`)) && JSON.parse(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData_${app.sTeamNameSId}`)).length > 0 && !this.props.employeeDataSetted) { | |
| 214 | 214 | getData.employeeData = JSON.parse(localStorage.getItem(`${commonConfig.prefix}oeeEmployeeData_${app.sTeamNameSId}`)); |
| 215 | 215 | } |
| 216 | 216 | addState = { |
| ... | ... | @@ -218,77 +218,7 @@ export default (ChildComponent) => { |
| 218 | 218 | }; |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | - } else if (commonUtils.isNotEmptyObject(sModelsType) && sModelsType.includes('dynamicList')) { /* 改分支用于动态列处理 */ | |
| 222 | - if (commonUtils.isNotEmptyNumber(formData[0].iPageSize) && formData[0].iPageSize !== 0) { | |
| 223 | - iPageSize = formData[0].iPageSize; | |
| 224 | - } | |
| 225 | - const bFilter = []; | |
| 226 | - if (!commonUtils.isEmptyArr(filterCondition)) { | |
| 227 | - bFilter.push(...filterCondition); | |
| 228 | - } | |
| 229 | - addState = await this.props.handleGetDataSet({ | |
| 230 | - name: 'slave', | |
| 231 | - configData: slaveConfig, | |
| 232 | - condition: { | |
| 233 | - pageNum: 1, pageSize: iPageSize, bFilter, | |
| 234 | - }, | |
| 235 | - flag: true, | |
| 236 | - isWait: true, | |
| 237 | - }); | |
| 238 | - if (commonUtils.isNotEmptyObject(addState)) { | |
| 239 | - const { slaveData } = addState; | |
| 240 | - if (commonUtils.isNotEmptyArr(slaveData)) { | |
| 241 | - const gdsconfigformslave = slaveConfig.gdsconfigformslave; | |
| 242 | - const columnConfig = commonUtils.isNotEmptyObject(slaveConfig) ? slaveConfig.gdsconfigformslave.filter(item => item.bVisible && item.sName !== '' && item.showName !== '' && !(item.sControlName !== '' && item.sControlName.indexOf('Btn') > -1)) : []; | |
| 243 | - const slaveRow = slaveData[0]; | |
| 244 | - if (commonUtils.isNotEmptyObject(slaveRow)) { | |
| 245 | - const iOrderArr = []; | |
| 246 | - for (const key of Object.keys(slaveRow)) { | |
| 247 | - let splitData = []; | |
| 248 | - splitData = commonUtils.isNotEmptyObject(key) ? key.split('_') : []; | |
| 249 | - /* 标题需要按照s_名称_序号 规则设定 */ | |
| 250 | - if (splitData.length > 1) { | |
| 251 | - let title = splitData[1];/* 标题名称 */ | |
| 252 | - /* 如果有### ,替换为 . */ | |
| 253 | - if (commonUtils.isNotEmptyObject(title) && title.includes('###')) { | |
| 254 | - title = title.replace('###', '.'); | |
| 255 | - } | |
| 256 | - const iOrder = splitData[2];/* 排序号 */ | |
| 257 | - iOrderArr.push(iOrder); | |
| 258 | - /* 根据接口返回列的序号 匹配后台配置列下标 */ | |
| 259 | - if (commonUtils.isNotEmptyObject(columnConfig[iOrder])) { | |
| 260 | - columnConfig[iOrder].showName = title; | |
| 261 | - columnConfig[iOrder].sChinese = title; | |
| 262 | - columnConfig[iOrder].sName = key; | |
| 263 | - const iIndex = gdsconfigformslave.findIndex(item => item.sId === columnConfig[iOrder].sId); | |
| 264 | - if (iIndex > -1) { | |
| 265 | - gdsconfigformslave[iIndex] = columnConfig[iOrder]; | |
| 266 | - } | |
| 267 | - } | |
| 268 | - } | |
| 269 | - } | |
| 270 | - | |
| 271 | - /* 把多余字段隐藏掉 找到最大下标 把其他多余显示行隐藏掉 */ | |
| 272 | - if (commonUtils.isNotEmptyArr(iOrderArr)) { | |
| 273 | - const iOrderMax = Math.max(...iOrderArr); | |
| 274 | - if (commonUtils.isNotEmptyArr(columnConfig)) { | |
| 275 | - columnConfig.forEach((itemConfig, iIndex) => { | |
| 276 | - if (iIndex > iOrderMax) { | |
| 277 | - const iIndexConfig = gdsconfigformslave.findIndex(item => item.sId === itemConfig.sId); | |
| 278 | - if (iIndexConfig > -1) { | |
| 279 | - gdsconfigformslave[iIndexConfig].bVisible = false; | |
| 280 | - } | |
| 281 | - } | |
| 282 | - }); | |
| 283 | - } | |
| 284 | - } | |
| 285 | - | |
| 286 | - slaveConfig.gdsconfigformslave = gdsconfigformslave; | |
| 287 | - slaveColumn = commonFunc.getHeaderConfig(slaveConfig); | |
| 288 | - } | |
| 289 | - } | |
| 290 | - } | |
| 291 | - } else if (sModelsType === 'commonGantte') { /* 获取甘特图列表数据集 */ | |
| 221 | + } else if (sModelsType === 'commonGantte') { /* 获取甘特图列表数据集 */ | |
| 292 | 222 | /* 找到配置的存储过程名称 */ |
| 293 | 223 | const ganntObj = { |
| 294 | 224 | sProcedureName: slaveConfig.sTbName, |
| ... | ... | @@ -824,6 +754,7 @@ export default (ChildComponent) => { |
| 824 | 754 | } |
| 825 | 755 | |
| 826 | 756 | const picArr = slaveConfig.gdsconfigformslave.filter(item => (item.sName === 'picArr')); |
| 757 | + const picArrDefault = slaveConfig.gdsconfigformslave.filter(item => (item.sName === 'picArrDefault')); | |
| 827 | 758 | const getData = (formRoute === '/indexPage/commonListLeft') ? (...args) => { |
| 828 | 759 | this.handleGetData(...args); |
| 829 | 760 | const filterTreeConfigArr = slaveConfig.gdsconfigformslave.filter(item => item.bTree); |
| ... | ... | @@ -833,9 +764,15 @@ export default (ChildComponent) => { |
| 833 | 764 | this.handleGetFilterTreeData(filterTreeConfig, slaveFilterCondition, 1); |
| 834 | 765 | } |
| 835 | 766 | } : this.handleGetData; |
| 836 | - if (picArr.length > 0) { | |
| 767 | + if (picArr.length > 0 || picArrDefault.length > 0) { | |
| 837 | 768 | let sActiveId = ''; |
| 838 | - if (picArr[0].sName === 'picArr' && picArr[0].sDropDownType === 'picArr' && sModelsType !== 'commonList/msg') { | |
| 769 | + if (commonUtils.isNotEmptyArr(picArrDefault) && picArrDefault[0].sName === 'picArrDefault' && picArrDefault[0].sDropDownType === 'picArr') { | |
| 770 | + [{ sActiveId }] = picArrDefault; | |
| 771 | + if (sActiveId === '1') { | |
| 772 | + sActiveId = sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : sActiveId; | |
| 773 | + } | |
| 774 | + console.log('picArrDefault', sActiveId, picArrDefault); | |
| 775 | + } else if (picArr[0].sName === 'picArr' && picArr[0].sDropDownType === 'picArr' && sModelsType !== 'commonList/msg') { | |
| 839 | 776 | [{ sActiveId }] = picArr; |
| 840 | 777 | if (sActiveId === '1') { |
| 841 | 778 | sActiveId = sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : sActiveId; | ... | ... |