Commit 35b66650672d30fdff621f5a9db1f21a4f3b65bb

Authored by zhangzzzz
1 parent a61aec4e

回滚生产执行代码;

src/mes/productionExec/productionExecMain/index.js
@@ -31,8 +31,7 @@ const list = [ @@ -31,8 +31,7 @@ const list = [
31 { sName: "qztable0", sGrd: "qztable0" }, // 切纸生产执行 31 { sName: "qztable0", sGrd: "qztable0" }, // 切纸生产执行
32 { sName: "jytable0", sGrd: "jytable0" }, // 胶印生产执行 32 { sName: "jytable0", sGrd: "jytable0" }, // 胶印生产执行
33 { sName: "wytable0", sGrd: "wytable0" }, // 凹印生产执行 33 { sName: "wytable0", sGrd: "wytable0" }, // 凹印生产执行
34 - { sName: "wytgtable0", sGrd: "wytgtable0" }, // 凹印挑规生产执行  
35 - { sName: "zztable0", sGrd: "zztable0" } 34 + { sName: "wytgtable0", sGrd: "wytgtable0" } // 凹印挑规生产执行
36 ]; 35 ];
37 36
38 const useProductionExecMainEvent = props => { 37 const useProductionExecMainEvent = props => {
@@ -58,8 +57,8 @@ const useProductionExecMainEvent = props => { @@ -58,8 +57,8 @@ const useProductionExecMainEvent = props => {
58 57
59 const { app } = props; 58 const { app } = props;
60 const { userinfo = {} } = app; 59 const { userinfo = {} } = app;
61 - const iInterface = 1;  
62 - // iInterfaceOld === undefined ? userinfo.iInterface : iInterfaceOld; 60 + const iInterface =
  61 + iInterfaceOld === undefined ? userinfo.iInterface : iInterfaceOld;
63 useEffect( 62 useEffect(
64 async () => { 63 async () => {
65 if (commonUtils.isEmptyArr(formData)) return; 64 if (commonUtils.isEmptyArr(formData)) return;
@@ -69,8 +68,6 @@ const useProductionExecMainEvent = props => { @@ -69,8 +68,6 @@ const useProductionExecMainEvent = props => {
69 ? list 68 ? list
70 : list.filter((_, index) => iInterface == index); 69 : list.filter((_, index) => iInterface == index);
71 70
72 - listFilter.push({ sName: "zztable0", sGrd: "zztable0" });  
73 -  
74 // 页面表明和配置表名对应关系 71 // 页面表明和配置表名对应关系
75 const tableNameCompareJson = {}; 72 const tableNameCompareJson = {};
76 [...listFilter, ...props.execListExtra].forEach(item => { 73 [...listFilter, ...props.execListExtra].forEach(item => {
@@ -413,19 +410,11 @@ const ProductionExecMain = baseProps => { @@ -413,19 +410,11 @@ const ProductionExecMain = baseProps => {
413 const { app = {} } = baseProps; 410 const { app = {} } = baseProps;
414 411
415 const [refreshCount, setRefreshCount] = useState(0); 412 const [refreshCount, setRefreshCount] = useState(0);
416 - const [sStatusNew, setStatusNew] = useState(undefined);  
417 413
418 useEffect(() => { 414 useEffect(() => {
419 const getValue = () => { 415 const getValue = () => {
420 const changeExecInfo = commonUtils.getAppData("changeExecInfo"); 416 const changeExecInfo = commonUtils.getAppData("changeExecInfo");
421 - setStatusNew(changeExecInfo.sStatus);  
422 -  
423 - const refreshExecInfo = commonUtils.getAppData("refreshExecInfo");  
424 - if (refreshExecInfo.dReplyPalletERp === 1) {  
425 - commonUtils.setAppData("refreshExecInfo", {  
426 - ...refreshExecInfo,  
427 - dReplyPalletERp: 0  
428 - }); 417 + if (changeExecInfo.dReplyPalletERp === 1) {
429 props.onRefresh(); 418 props.onRefresh();
430 setRefreshCount(pre => pre + 1); 419 setRefreshCount(pre => pre + 1);
431 } 420 }
@@ -515,7 +504,6 @@ const ProductionExecMain = baseProps => { @@ -515,7 +504,6 @@ const ProductionExecMain = baseProps => {
515 {...props} 504 {...props}
516 changeExecInfo={app.changeExecInfo} 505 changeExecInfo={app.changeExecInfo}
517 refreshCount={refreshCount} 506 refreshCount={refreshCount}
518 - sStatusNew={sStatusNew}  
519 /> 507 />
520 )} 508 )}
521 </div> 509 </div>
@@ -546,8 +534,7 @@ const ProductionExecContentByType = props =&gt; { @@ -546,8 +534,7 @@ const ProductionExecContentByType = props =&gt; {
546 deviceTargetInfoConfig = {}, 534 deviceTargetInfoConfig = {},
547 deviceTargetInfoData = [], 535 deviceTargetInfoData = [],
548 setPagesLoading, 536 setPagesLoading,
549 - refreshCount = 0,  
550 - sStatusNew 537 + refreshCount = 0
551 } = props; 538 } = props;
552 539
553 /** 540 /**
@@ -555,34 +542,36 @@ const ProductionExecContentByType = props =&gt; { @@ -555,34 +542,36 @@ const ProductionExecContentByType = props =&gt; {
555 */ 542 */
556 const sStatusNameProcess = useMemo( 543 const sStatusNameProcess = useMemo(
557 () => { 544 () => {
558 - // if (  
559 - // !Array.isArray(deviceTargetInfoData) ||  
560 - // !deviceTargetInfoData[0] ||  
561 - // !deviceTargetInfoData[0]?.sStatus  
562 - // )  
563 - // return;  
564 - const viewRow = deviceTargetInfoData[0] || {};  
565 - if (sStatusNew) {  
566 - viewRow.sStatus = sStatusNew;  
567 - }  
568 - const sStatusNameValue = viewRow.sStatus?.includes("adjustment") ? 0 : 1; 545 + if (
  546 + !Array.isArray(deviceTargetInfoData) ||
  547 + !deviceTargetInfoData[0] ||
  548 + !deviceTargetInfoData[0]?.sStatus
  549 + )
  550 + return;
  551 + const sStatusNameValue = deviceTargetInfoData[0]?.sStatus?.includes(
  552 + "adjustment"
  553 + )
  554 + ? 0
  555 + : 1;
569 556
570 const showValue = { 557 const showValue = {
571 stop: { 558 stop: {
572 showName: "调机结束", 559 showName: "调机结束",
573 onClick: config => 560 onClick: config =>
574 operationFetch(props, config, undefined, () => { 561 operationFetch(props, config, undefined, () => {
575 - setPagesLoading(false);  
576 - props.onChangeRouter({  
577 - type: "name",  
578 - path: ["生产执行", "质量检验"] 562 + props.onSaveState({
  563 + refreshDeviceTargetInfo: true
579 }); 564 });
  565 + setPagesLoading(false);
580 }) 566 })
581 }, 567 },
582 again: { 568 again: {
583 showName: "调机开始", 569 showName: "调机开始",
584 onClick: config => 570 onClick: config =>
585 operationFetch(props, config, "again", () => { 571 operationFetch(props, config, "again", () => {
  572 + props.onSaveState({
  573 + refreshDeviceTargetInfo: true
  574 + });
586 setPagesLoading(false); 575 setPagesLoading(false);
587 }) 576 })
588 } 577 }
@@ -595,7 +584,7 @@ const ProductionExecContentByType = props =&gt; { @@ -595,7 +584,7 @@ const ProductionExecContentByType = props =&gt; {
595 584
596 return showValue[flag]; 585 return showValue[flag];
597 }, 586 },
598 - [deviceTargetInfoConfig, deviceTargetInfoData, sStatusNew] 587 + [deviceTargetInfoConfig, deviceTargetInfoData]
599 ); 588 );
600 589
601 props = { ...props, sStatusNameProcess }; 590 props = { ...props, sStatusNameProcess };
@@ -605,28 +594,34 @@ const ProductionExecContentByType = props =&gt; { @@ -605,28 +594,34 @@ const ProductionExecContentByType = props =&gt; {
605 message.warning("未获取到iInterface字段!"); 594 message.warning("未获取到iInterface字段!");
606 return ""; 595 return "";
607 } 596 }
608 - const type0 =  
609 - props.workOrderInfoData?.[0]?.bZZ  
610 - ? "type10"  
611 - : "type0";  
612 - // const type0 =  
613 - // window.execTest && productionExecType  
614 - // ? productionExecType  
615 - // : `type${iInterface === 0 ? "" : iInterface - 1}`; 597 +
  598 + const type0 =
  599 + window.execTest && productionExecType
  600 + ? productionExecType
  601 + : `type${iInterface === 0 ? "" : iInterface - 1}`;
616 602
617 const type = `${type0}-${refreshCount}`; 603 const type = `${type0}-${refreshCount}`;
618 604
619 const content = { 605 const content = {
  606 + type: <ProductionExecContent {...props} key={type} />,
620 type0: <ProductionExecContent0 {...props} key={type} />, 607 type0: <ProductionExecContent0 {...props} key={type} />,
621 - type10: <ProductionExecContent10 {...props} key={type} /> 608 + type1: <ProductionExecContent1 {...props} key={type} />,
  609 + type2: <ProductionExecContent2 {...props} key={type} />,
  610 + type3: <ProductionExecContent3 {...props} key={type} />,
  611 + type4: <ProductionExecContent4 {...props} key={type} />,
  612 + type5: <ProductionExecContent5 {...props} key={type} />,
  613 + type6: <ProductionExecContent6 {...props} key={type} />,
  614 + type7: <ProductionExecContent7 {...props} key={type} />,
  615 + type8: <ProductionExecContent8 {...props} key={type} />,
  616 + type9: <ProductionExecContent9 {...props} key={type} />
622 }; 617 };
623 618
624 return content[type0] || ""; 619 return content[type0] || "";
625 }; 620 };
626 621
627 -// 胶印  
628 -const ProductionExecContent0 = props => {  
629 - const tableName = "jytable0"; 622 +// 类型-切纸
  623 +const ProductionExecContent = props => {
  624 + const tableName = "qztable0";
630 const tableTypes = commonBusiness.getTableTypes(tableName, props); 625 const tableTypes = commonBusiness.getTableTypes(tableName, props);
631 const { 626 const {
632 config: configOld = {}, 627 config: configOld = {},
@@ -635,19 +630,16 @@ const ProductionExecContent0 = props =&gt; { @@ -635,19 +630,16 @@ const ProductionExecContent0 = props =&gt; {
635 name 630 name
636 } = tableTypes; 631 } = tableTypes;
637 const config = props.onMergeTableConfig(configOld); 632 const config = props.onMergeTableConfig(configOld);
  633 +
638 const sIdGroupStr = data.map(item => item.sId).toString(); 634 const sIdGroupStr = data.map(item => item.sId).toString();
639 635
640 - const timer = useRef(null);  
641 useEffect( 636 useEffect(
642 () => { 637 () => {
643 if (!data.length) return; 638 if (!data.length) return;
644 // 让第一条选中 639 // 让第一条选中
645 - clearTimeout(timer.current);  
646 - timer.current = setTimeout(() => {  
647 - props.onSaveState({  
648 - [`${tableName}SelectedRowKeys`]: [data[0].sId]  
649 - });  
650 - }, 200); 640 + props.onSaveState({
  641 + [`${tableName}SelectedRowKeys`]: [data[0].sId]
  642 + });
651 }, 643 },
652 [sIdGroupStr] 644 [sIdGroupStr]
653 ); 645 );
@@ -661,32 +653,10 @@ const ProductionExecContent0 = props =&gt; { @@ -661,32 +653,10 @@ const ProductionExecContent0 = props =&gt; {
661 const viewConfigs = config.gdsconfigformslave 653 const viewConfigs = config.gdsconfigformslave
662 .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) 654 .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
663 // .filter((_, index) => index < 8) 655 // .filter((_, index) => index < 8)
664 - .map(item => {  
665 - const addState = {};  
666 - if (item.sName === "dReportQty") {  
667 - if (  
668 - props.workOrderInfoData?.[0]?.sProcessName?.includes("切纸") ||  
669 - props.workOrderInfoData?.[0]?.sProcessName?.includes("胶印") ||  
670 - props.workOrderInfoData?.[0]?.sProcessName === "大切张F"  
671 - ) {  
672 - addState.showName = `${item.showName}(张)`;  
673 - } else if (  
674 - ["大模压F", "UV模压F", "蒸镀F", "大分条F", "贴合F"].includes(  
675 - props.workOrderInfoData?.[0]?.sProcessName  
676 - )  
677 - ) {  
678 - addState.showName = `${item.showName}(米)`;  
679 - } else {  
680 - addState.showName = `${item.showName}(个)`;  
681 - }  
682 - }  
683 -  
684 - return {  
685 - ...item,  
686 - ...addState,  
687 - iColValue: 24  
688 - };  
689 - }); 656 + .map(item => ({
  657 + ...item,
  658 + iColValue: 24
  659 + }));
690 660
691 const viewRow = 661 const viewRow =
692 (selectedRowKeys[0] 662 (selectedRowKeys[0]
@@ -727,7 +697,7 @@ const ProductionExecContent0 = props =&gt; { @@ -727,7 +697,7 @@ const ProductionExecContent0 = props =&gt; {
727 ...props, 697 ...props,
728 btnConfig, 698 btnConfig,
729 tableLineParams: { 699 tableLineParams: {
730 - name: "jytable0", 700 + name: "qztable0",
731 record: viewRow, 701 record: viewRow,
732 index: data.findIndex(item => item.sId === viewRow.sId) 702 index: data.findIndex(item => item.sId === viewRow.sId)
733 } 703 }
@@ -746,12 +716,6 @@ const ProductionExecContent0 = props =&gt; { @@ -746,12 +716,6 @@ const ProductionExecContent0 = props =&gt; {
746 }); 716 });
747 return; 717 return;
748 } 718 }
749 -  
750 - props.onTableBtnClick({  
751 - name: tableName,  
752 - record: viewRow,  
753 - config: btnConfig  
754 - });  
755 } 719 }
756 }; 720 };
757 }; 721 };
@@ -766,7 +730,7 @@ const ProductionExecContent0 = props =&gt; { @@ -766,7 +730,7 @@ const ProductionExecContent0 = props =&gt; {
766 const btnTableList = [ 730 const btnTableList = [
767 "palletBatchMaterial", 731 "palletBatchMaterial",
768 "workerOrderBatchMaterial", 732 "workerOrderBatchMaterial",
769 - "plateInfo", 733 + // "plateInfo",
770 "jpfpbtable0" 734 "jpfpbtable0"
771 ]; 735 ];
772 const formDataNew = props.formData.filter( 736 const formDataNew = props.formData.filter(
@@ -778,6 +742,7 @@ const ProductionExecContent0 = props =&gt; { @@ -778,6 +742,7 @@ const ProductionExecContent0 = props =&gt; {
778 ...props, 742 ...props,
779 costomModal: true, 743 costomModal: true,
780 formData: formDataNew, 744 formData: formDataNew,
  745 + hideTabList: ["plateInfo"],
781 sFilterConditions: { 746 sFilterConditions: {
782 sId: selectedRowKeys[0], 747 sId: selectedRowKeys[0],
783 sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId, 748 sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId,
@@ -816,18 +781,15 @@ const ProductionExecContent0 = props =&gt; { @@ -816,18 +781,15 @@ const ProductionExecContent0 = props =&gt; {
816 <Space> 781 <Space>
817 <Button 782 <Button
818 {...btnProps} 783 {...btnProps}
819 - {...getBtnConfigByControlName("BtnScrapDesc")}  
820 - style={{ width: 112 }} 784 + {...getBtnConfigByControlName("BtnPrint1")}
821 > 785 >
822 - 废品登记 786 + 产量①
823 </Button> 787 </Button>
824 -  
825 <Button 788 <Button
826 {...btnProps} 789 {...btnProps}
827 {...getBtnConfigByControlName("BtnPrint2")} 790 {...getBtnConfigByControlName("BtnPrint2")}
828 - style={{ display: "none" }}  
829 > 791 >
830 - 下料 792 + 产品②
831 </Button> 793 </Button>
832 {/* <Button {...btnProps}>产品②</Button> */} 794 {/* <Button {...btnProps}>产品②</Button> */}
833 </Space> 795 </Space>
@@ -847,7 +809,6 @@ const ProductionExecContent0 = props =&gt; { @@ -847,7 +809,6 @@ const ProductionExecContent0 = props =&gt; {
847 <Button 809 <Button
848 {...btnProps} 810 {...btnProps}
849 {...getBtnConfigByControlName("BtnPrint3")} 811 {...getBtnConfigByControlName("BtnPrint3")}
850 - style={{ display: "none" }}  
851 > 812 >
852 异常③ 813 异常③
853 </Button> 814 </Button>
@@ -877,10 +838,8 @@ const ProductionExecContent0 = props =&gt; { @@ -877,10 +838,8 @@ const ProductionExecContent0 = props =&gt; {
877 {...btnProps} 838 {...btnProps}
878 {...getBtnConfigByControlName(sControlName)} 839 {...getBtnConfigByControlName(sControlName)}
879 className={`${styles.print4} print4`} 840 className={`${styles.print4} print4`}
880 - // style={{display: 'none'}}  
881 > 841 >
882 - 打印标条  
883 - {/* {btnConfig.showName} */} 842 + {btnConfig.showName}
884 </Button> 843 </Button>
885 ); 844 );
886 })} 845 })}
@@ -919,9 +878,9 @@ const ProductionExecContent0 = props =&gt; { @@ -919,9 +878,9 @@ const ProductionExecContent0 = props =&gt; {
919 ); 878 );
920 }; 879 };
921 880
922 -// 成品组装  
923 -const ProductionExecContent10 = props => {  
924 - const tableName = "zztable0"; 881 +// 类型0-胶印
  882 +const ProductionExecContent0 = props => {
  883 + const tableName = "jytable0";
925 const tableTypes = commonBusiness.getTableTypes(tableName, props); 884 const tableTypes = commonBusiness.getTableTypes(tableName, props);
926 const { 885 const {
927 config: configOld = {}, 886 config: configOld = {},
@@ -955,6 +914,7 @@ const ProductionExecContent10 = props =&gt; { @@ -955,6 +914,7 @@ const ProductionExecContent10 = props =&gt; {
955 914
956 const viewConfigs = config.gdsconfigformslave 915 const viewConfigs = config.gdsconfigformslave
957 .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1) 916 .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
  917 + // .filter((_, index) => index < 8)
958 .map(item => ({ 918 .map(item => ({
959 ...item, 919 ...item,
960 iColValue: 24 920 iColValue: 24
@@ -986,6 +946,9 @@ const ProductionExecContent10 = props =&gt; { @@ -986,6 +946,9 @@ const ProductionExecContent10 = props =&gt; {
986 config.gdsconfigformslave.find( 946 config.gdsconfigformslave.find(
987 item => item.sControlName === sControlName 947 item => item.sControlName === sControlName
988 ) || {}; 948 ) || {};
  949 + if (!btnConfig.bVisible) {
  950 + btnConfig.style = { display: "none" };
  951 + }
989 return { 952 return {
990 ...btnConfig, 953 ...btnConfig,
991 disabled: props.onGetBtnStatus(tableName, btnConfig), 954 disabled: props.onGetBtnStatus(tableName, btnConfig),
@@ -999,7 +962,7 @@ const ProductionExecContent10 = props =&gt; { @@ -999,7 +962,7 @@ const ProductionExecContent10 = props =&gt; {
999 ...props, 962 ...props,
1000 btnConfig, 963 btnConfig,
1001 tableLineParams: { 964 tableLineParams: {
1002 - name: tableName, 965 + name: "jytable0",
1003 record: viewRow, 966 record: viewRow,
1004 index: data.findIndex(item => item.sId === viewRow.sId) 967 index: data.findIndex(item => item.sId === viewRow.sId)
1005 } 968 }
@@ -1018,12 +981,6 @@ const ProductionExecContent10 = props =&gt; { @@ -1018,12 +981,6 @@ const ProductionExecContent10 = props =&gt; {
1018 }); 981 });
1019 return; 982 return;
1020 } 983 }
1021 -  
1022 - props.onTableBtnClick({  
1023 - name: tableName,  
1024 - record: viewRow,  
1025 - config: btnConfig  
1026 - });  
1027 } 984 }
1028 }; 985 };
1029 }; 986 };
@@ -1038,7 +995,8 @@ const ProductionExecContent10 = props =&gt; { @@ -1038,7 +995,8 @@ const ProductionExecContent10 = props =&gt; {
1038 const btnTableList = [ 995 const btnTableList = [
1039 "palletBatchMaterial", 996 "palletBatchMaterial",
1040 "workerOrderBatchMaterial", 997 "workerOrderBatchMaterial",
1041 - "assembletray" 998 + "plateInfo",
  999 + "jpfpbtable0"
1042 ]; 1000 ];
1043 const formDataNew = props.formData.filter( 1001 const formDataNew = props.formData.filter(
1044 item => item.sGrd && btnTableList.includes(item.sGrd) 1002 item => item.sGrd && btnTableList.includes(item.sGrd)
@@ -1050,11 +1008,19 @@ const ProductionExecContent10 = props =&gt; { @@ -1050,11 +1008,19 @@ const ProductionExecContent10 = props =&gt; {
1050 costomModal: true, 1008 costomModal: true,
1051 formData: formDataNew, 1009 formData: formDataNew,
1052 sFilterConditions: { 1010 sFilterConditions: {
1053 - // sId: selectedRowKeys[0], 1011 + sId: selectedRowKeys[0],
1054 sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId, 1012 sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId,
1055 sProductId: workOrderInfoData[0]?.sProductId 1013 sProductId: workOrderInfoData[0]?.sProductId
1056 - }  
1057 - // noGetData: !selectedRowKeys.length 1014 + },
  1015 + noGetData: !selectedRowKeys.length
  1016 + };
  1017 +
  1018 + const tabRef = useRef();
  1019 + const changeTab = index => {
  1020 + if (!tabRef.current) return;
  1021 + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list");
  1022 + if (!oNavList) return;
  1023 + oNavList.childNodes[index].click();
1058 }; 1024 };
1059 1025
1060 return ( 1026 return (
@@ -1075,22 +1041,25 @@ const ProductionExecContent10 = props =&gt; { @@ -1075,22 +1041,25 @@ const ProductionExecContent10 = props =&gt; {
1075 > 1041 >
1076 下料 1042 下料
1077 </Button> 1043 </Button>
  1044 + <Button
  1045 + {...btnProps}
  1046 + {...getBtnConfigByControlName("BtnEventJL")}
  1047 + >
  1048 + 叫料
  1049 + </Button>
1078 </Space> 1050 </Space>
1079 <Space> 1051 <Space>
1080 <Button 1052 <Button
1081 {...btnProps} 1053 {...btnProps}
1082 - {...getBtnConfigByControlName("BtnScrapDesc")}  
1083 - style={{ width: 112, display: "block" }} 1054 + {...getBtnConfigByControlName("BtnPrint1")}
1084 > 1055 >
1085 - 废品登记 1056 + 产量①
1086 </Button> 1057 </Button>
1087 -  
1088 <Button 1058 <Button
1089 {...btnProps} 1059 {...btnProps}
1090 {...getBtnConfigByControlName("BtnPrint2")} 1060 {...getBtnConfigByControlName("BtnPrint2")}
1091 - style={{ display: "none" }}  
1092 > 1061 >
1093 - 下料 1062 + 产品②
1094 </Button> 1063 </Button>
1095 {/* <Button {...btnProps}>产品②</Button> */} 1064 {/* <Button {...btnProps}>产品②</Button> */}
1096 </Space> 1065 </Space>
@@ -1110,7 +1079,6 @@ const ProductionExecContent10 = props =&gt; { @@ -1110,7 +1079,6 @@ const ProductionExecContent10 = props =&gt; {
1110 <Button 1079 <Button
1111 {...btnProps} 1080 {...btnProps}
1112 {...getBtnConfigByControlName("BtnPrint3")} 1081 {...getBtnConfigByControlName("BtnPrint3")}
1113 - style={{ display: "none" }}  
1114 > 1082 >
1115 异常③ 1083 异常③
1116 </Button> 1084 </Button>
@@ -1140,10 +1108,8 @@ const ProductionExecContent10 = props =&gt; { @@ -1140,10 +1108,8 @@ const ProductionExecContent10 = props =&gt; {
1140 {...btnProps} 1108 {...btnProps}
1141 {...getBtnConfigByControlName(sControlName)} 1109 {...getBtnConfigByControlName(sControlName)}
1142 className={`${styles.print4} print4`} 1110 className={`${styles.print4} print4`}
1143 - // style={{display: 'none'}}  
1144 > 1111 >
1145 - 打印标条  
1146 - {/* {btnConfig.showName} */} 1112 + {btnConfig.showName}
1147 </Button> 1113 </Button>
1148 ); 1114 );
1149 })} 1115 })}
@@ -1156,12 +1122,1513 @@ const ProductionExecContent10 = props =&gt; { @@ -1156,12 +1122,1513 @@ const ProductionExecContent10 = props =&gt; {
1156 </div> 1122 </div>
1157 </div> 1123 </div>
1158 <div className="bottomPart"> 1124 <div className="bottomPart">
1159 - <div className="commonModel commonModel1"> 1125 + <div className="commonModel" ref={tabRef}>
1160 <CommonModelComponent {...commonModelProps} /> 1126 <CommonModelComponent {...commonModelProps} />
1161 </div> 1127 </div>
  1128 + <div className="btnPart">
  1129 + <Space>
  1130 + <Button
  1131 + type="primary"
  1132 + size="large"
  1133 + onClick={changeTab.bind(this, 0)}
  1134 + >
  1135 + 物料消耗登记
  1136 + </Button>
  1137 + <Button
  1138 + type="primary"
  1139 + size="large"
  1140 + onClick={changeTab.bind(this, 2)}
  1141 + >
  1142 + 版材消耗登记
  1143 + </Button>
  1144 + </Space>
  1145 + </div>
1162 </div> 1146 </div>
1163 </div> 1147 </div>
1164 ); 1148 );
1165 }; 1149 };
1166 1150
  1151 +// 类型1-凹印
  1152 +const ProductionExecContent1 = props => {
  1153 + const tableName = "wytable0";
  1154 + const tableTypes = commonBusiness.getTableTypes(tableName, props);
  1155 + const {
  1156 + config: configOld = {},
  1157 + data = [],
  1158 + selectedRowKeys = [],
  1159 + name
  1160 + } = tableTypes;
  1161 + const config = props.onMergeTableConfig(configOld);
  1162 + const sIdGroupStr = data.map(item => item.sId).toString();
  1163 +
  1164 + const timer = useRef(null);
  1165 + useEffect(
  1166 + () => {
  1167 + if (!data.length) return;
  1168 + // 让第一条选中
  1169 + clearTimeout(timer.current);
  1170 + timer.current = setTimeout(() => {
  1171 + props.onSaveState({
  1172 + [`${tableName}SelectedRowKeys`]: [data[0].sId]
  1173 + });
  1174 + }, 200);
  1175 + },
  1176 + [sIdGroupStr]
  1177 + );
  1178 +
  1179 + const tableProps = {
  1180 + ...tableTypes,
  1181 + footer: "hidden", // 合计栏
  1182 + tableProps: {}
  1183 + };
  1184 +
  1185 + const viewConfigs = config.gdsconfigformslave
  1186 + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
  1187 + // .filter((_, index) => index < 8)
  1188 + .map(item => ({
  1189 + ...item,
  1190 + iColValue: 24
  1191 + }));
  1192 +
  1193 + const viewRow =
  1194 + (selectedRowKeys[0]
  1195 + ? data.find(item => item.sId === selectedRowKeys[0])
  1196 + : data[0]) || {};
  1197 +
  1198 + const viewProps = {
  1199 + ...props,
  1200 + viewConfigs,
  1201 + tableConfig: config,
  1202 + iColValueView: 24,
  1203 + viewRow,
  1204 + tableName: name,
  1205 + enabled: commonUtils.isNotEmptyObject(viewRow)
  1206 + };
  1207 +
  1208 + const btnProps = {
  1209 + type: "primary",
  1210 + size: "large",
  1211 + style: { width: 80 }
  1212 + };
  1213 +
  1214 + const operationBarProps = {
  1215 + ...props,
  1216 + sName: name,
  1217 + bCostom: true,
  1218 + onRefresh: props.onRefresh // 刷新页面
  1219 + };
  1220 +
  1221 + const btnTableList = [
  1222 + "palletBatchMaterial",
  1223 + "workerOrderBatchMaterial",
  1224 + "plateInfo",
  1225 + "jpfpbtable0"
  1226 + ];
  1227 + const formDataNew = props.formData.filter(
  1228 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1229 + );
  1230 +
  1231 + const { workOrderInfoData = [] } = props;
  1232 + const commonModelProps = {
  1233 + ...props,
  1234 + costomModal: true,
  1235 + formData: formDataNew,
  1236 + sFilterConditions: {
  1237 + sId: selectedRowKeys[0],
  1238 + sSrcSlaveId: workOrderInfoData[0]?.sSrcSlaveId,
  1239 + sProductId: workOrderInfoData[0]?.sProductId
  1240 + },
  1241 + noGetData: !selectedRowKeys.length
  1242 + };
  1243 +
  1244 + const getBtnProps = btnConfig => {
  1245 + const { sFontColor } = btnConfig;
  1246 +
  1247 + const style = sFontColor
  1248 + ? { backgroundColor: sFontColor, borderColor: sFontColor }
  1249 + : {};
  1250 + return {
  1251 + type: "primary",
  1252 + size: "large",
  1253 + style: { width: 80, ...style },
  1254 + disabled: props.onGetBtnStatus(tableName, btnConfig),
  1255 + onClick: async () => {
  1256 + if (!props.onGetBtnContinue()) return;
  1257 + const { sActiveId, sButtonParam, sInstruct } = btnConfig;
  1258 + // 调用指令集
  1259 + if (sInstruct) {
  1260 + await props.awaitPromiseReturn();
  1261 + props.onExecInstructSet({
  1262 + ...props,
  1263 + btnConfig,
  1264 + tableLineParams: {
  1265 + name: "wytable0",
  1266 + record: viewRow,
  1267 + index: data.findIndex(item => item.sId === viewRow.sId)
  1268 + }
  1269 + });
  1270 + return;
  1271 + }
  1272 + // 调用存储过程
  1273 + if (sButtonParam) {
  1274 + props.onProcedureCall({
  1275 + btnConfig,
  1276 + onSuccess: () => {
  1277 + props.onRefresh && props.onRefresh();
  1278 + },
  1279 + onConfirm: () => {},
  1280 + onError: () => {}
  1281 + });
  1282 + return;
  1283 + }
  1284 + }
  1285 + };
  1286 + };
  1287 +
  1288 + const rightFormBtn0List = new Array(10).fill(<div />);
  1289 + const btnsLeftList = config.gdsconfigformslave.filter(
  1290 + item =>
  1291 + item.bVisible &&
  1292 + item.sControlName &&
  1293 + item.sControlName.includes("BtnLeft1.")
  1294 + );
  1295 +
  1296 + const leftMap = [0, 5, 1, 6];
  1297 + btnsLeftList.forEach((item, index) => {
  1298 + rightFormBtn0List[leftMap[index]] = (
  1299 + <div>
  1300 + <Button {...getBtnProps(item)}>{item.showName}</Button>
  1301 + </div>
  1302 + );
  1303 + });
  1304 +
  1305 + const rightMap = [4, 9, 3, 8];
  1306 + const btnsRightList = config.gdsconfigformslave.filter(
  1307 + item =>
  1308 + item.bVisible &&
  1309 + item.sControlName &&
  1310 + item.sControlName.includes("BtnRight1.")
  1311 + );
  1312 +
  1313 + btnsRightList.forEach((item, index) => {
  1314 + rightFormBtn0List[rightMap[index]] = (
  1315 + <div>
  1316 + <Button {...getBtnProps(item)}>{item.showName}</Button>
  1317 + </div>
  1318 + );
  1319 + });
  1320 + const tabRef = useRef();
  1321 + const changeTab = index => {
  1322 + if (!tabRef.current) return;
  1323 + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list");
  1324 + if (!oNavList) return;
  1325 + oNavList.childNodes[index].click();
  1326 + };
  1327 +
  1328 + return (
  1329 + <div className={styles.type1}>
  1330 + <div className="topPart">
  1331 + <div className="type1Content">
  1332 + <div className="leftTable">
  1333 + <StaticEditTable {...tableProps} />
  1334 + </div>
  1335 + <div className="rightForm">
  1336 + <CommonViewTable className="rightFormBox" {...viewProps} />
  1337 + <div className="rightFormBtn0">
  1338 + {rightFormBtn0List.map(item => item)}
  1339 + </div>
  1340 + <div className="rightFormBtn">
  1341 + <div className="rightFormBtnFoot pagesNuxt">
  1342 + <Button
  1343 + onClick={() => props.onPagesNuxt(tableName, "up")}
  1344 + icon={<LeftOutlined />}
  1345 + {...btnProps}
  1346 + />
  1347 + <Button
  1348 + onClick={() => props.onPagesNuxt(tableName, "next")}
  1349 + icon={<RightOutlined />}
  1350 + {...btnProps}
  1351 + />
  1352 + {[""].map(() => {
  1353 + const sControlName = "BtnRight1.BtnPrint4";
  1354 + const btnConfig = config.gdsconfigformslave.find(
  1355 + item => item.sControlName === sControlName
  1356 + );
  1357 + if (!btnConfig) return "";
  1358 +
  1359 + return (
  1360 + <Button
  1361 + {...btnProps}
  1362 + {...getBtnProps(btnConfig)}
  1363 + className={`${styles.print4} print4`}
  1364 + >
  1365 + {btnConfig.showName}
  1366 + </Button>
  1367 + );
  1368 + })}
  1369 + </div>
  1370 + </div>
  1371 + </div>
  1372 + </div>
  1373 + <div className="btns">
  1374 + <CommonOperationBarComponent {...operationBarProps} />
  1375 + </div>
  1376 + </div>
  1377 + <div className="bottomPart">
  1378 + <div className="commonModel" ref={tabRef}>
  1379 + <CommonModelComponent {...commonModelProps} />
  1380 + </div>
  1381 + <div className="btnPart">
  1382 + <Space>
  1383 + <Button
  1384 + type="primary"
  1385 + size="large"
  1386 + onClick={changeTab.bind(this, 0)}
  1387 + >
  1388 + 物料消耗登记
  1389 + </Button>
  1390 + <Button
  1391 + type="primary"
  1392 + size="large"
  1393 + onClick={changeTab.bind(this, 2)}
  1394 + >
  1395 + 版材消耗登记
  1396 + </Button>
  1397 + </Space>
  1398 + </div>
  1399 + </div>
  1400 + </div>
  1401 + );
  1402 +};
  1403 +
  1404 +// 类型2-凹印挑规
  1405 +const ProductionExecContent2 = props => {
  1406 + const tableName = "wytgtable0";
  1407 + const tableTypes = commonBusiness.getTableTypes(tableName, props);
  1408 + const {
  1409 + config: configOld = {},
  1410 + data = [],
  1411 + selectedRowKeys = [],
  1412 + name
  1413 + } = tableTypes;
  1414 + const config = props.onMergeTableConfig(configOld);
  1415 + const sIdGroupStr = data.map(item => item.sId).toString();
  1416 +
  1417 + const timer = useRef(null);
  1418 + useEffect(
  1419 + () => {
  1420 + if (!data.length) return;
  1421 + // 让第一条选中
  1422 + clearTimeout(timer.current);
  1423 + timer.current = setTimeout(() => {
  1424 + props.onSaveState({
  1425 + [`${tableName}SelectedRowKeys`]: [data[0].sId]
  1426 + });
  1427 + }, 200);
  1428 + },
  1429 + [sIdGroupStr]
  1430 + );
  1431 +
  1432 + const tableProps = {
  1433 + ...tableTypes,
  1434 + footer: "hidden", // 合计栏
  1435 + tableProps: {}
  1436 + };
  1437 +
  1438 + const viewConfigs = config.gdsconfigformslave
  1439 + .filter(item => item.bControl && item.sControlName.indexOf("Btn") === -1)
  1440 + // .filter((_, index) => index < 8)
  1441 + .map(item => ({
  1442 + ...item,
  1443 + iColValue: 24
  1444 + }));
  1445 +
  1446 + const viewRow =
  1447 + (selectedRowKeys[0]
  1448 + ? data.find(item => item.sId === selectedRowKeys[0])
  1449 + : data[0]) || {};
  1450 +
  1451 + const viewProps = {
  1452 + ...props,
  1453 + viewConfigs,
  1454 + tableConfig: config,
  1455 + iColValueView: 24,
  1456 + viewRow,
  1457 + tableName: name,
  1458 + enabled: commonUtils.isNotEmptyObject(viewRow),
  1459 + onCostomChange: (name, showConfig) => {
  1460 + if (commonUtils.isNotEmptyObject(viewRow)) {
  1461 + const { sControlName = "" } = showConfig;
  1462 + const sName = sControlName.split(".")[1];
  1463 + if (sName === "sPosition") {
  1464 + const value = viewRow[sName];
  1465 + props.onSaveState({
  1466 + positionValue: value,
  1467 + positionModalVisible: true
  1468 + });
  1469 + }
  1470 + }
  1471 + }
  1472 + };
  1473 +
  1474 + const btnProps = {
  1475 + type: "primary",
  1476 + size: "large",
  1477 + style: { width: 80 }
  1478 + };
  1479 +
  1480 + const operationBarProps = {
  1481 + ...props,
  1482 + sName: name,
  1483 + bCostom: true,
  1484 + onRefresh: props.onRefresh // 刷新页面
  1485 + };
  1486 +
  1487 + const btnTableList = [
  1488 + "palletBatchMaterial",
  1489 + "workerOrderBatchMaterial",
  1490 + // "plateInfo",
  1491 + "jpfpbtable0"
  1492 + ];
  1493 + const formDataNew = props.formData.filter(
  1494 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1495 + );
  1496 +
  1497 + const { workOrderInfoData = [] } = props;
  1498 + const commonModelProps = {
  1499 + ...props,
  1500 + costomModal: true,
  1501 + formData: formDataNew,
  1502 + hideTabList: ["plateInfo"],
  1503 + sFilterConditions: {
  1504 + sId: selectedRowKeys[0],
  1505 + sSrcSlaveId: workOrderInfoData[0]?.sWorkOrderId,
  1506 + sProductId: workOrderInfoData[0]?.sProductId
  1507 + },
  1508 + noGetData: !selectedRowKeys.length
  1509 + };
  1510 +
  1511 + const getBtnProps = btnConfig => {
  1512 + const { sFontColor } = btnConfig;
  1513 +
  1514 + const style = sFontColor
  1515 + ? { backgroundColor: sFontColor, borderColor: sFontColor }
  1516 + : {};
  1517 + return {
  1518 + type: "primary",
  1519 + size: "large",
  1520 + style: { width: 80, ...style },
  1521 + disabled: props.onGetBtnStatus(tableName, btnConfig),
  1522 + onClick: () => {
  1523 + if (!props.onGetBtnContinue()) return;
  1524 + const { sActiveId, sButtonParam, sInstruct } = btnConfig;
  1525 + // 调用指令集
  1526 + if (sInstruct) {
  1527 + props.onExecInstructSet({
  1528 + ...props,
  1529 + btnConfig,
  1530 + tableLineParams: {
  1531 + name: "wytgtable0",
  1532 + record: viewRow,
  1533 + index: data.findIndex(item => item.sId === viewRow.sId)
  1534 + }
  1535 + });
  1536 + return;
  1537 + }
  1538 + // 调用存储过程
  1539 + if (sButtonParam) {
  1540 + props.onProcedureCall({
  1541 + btnConfig,
  1542 + onSuccess: () => {
  1543 + props.onRefresh && props.onRefresh();
  1544 + },
  1545 + onConfirm: () => {},
  1546 + onError: () => {}
  1547 + });
  1548 + return;
  1549 + }
  1550 + }
  1551 + };
  1552 + };
  1553 +
  1554 + const rightFormBtn0List = new Array(10).fill(<div />);
  1555 + const btnsLeftList = config.gdsconfigformslave.filter(
  1556 + item =>
  1557 + item.bVisible &&
  1558 + item.sControlName &&
  1559 + item.sControlName.includes("BtnLeft1.")
  1560 + );
  1561 +
  1562 + const leftMap = [0, 5, 1, 6];
  1563 + btnsLeftList.forEach((item, index) => {
  1564 + rightFormBtn0List[leftMap[index]] = (
  1565 + <div>
  1566 + <Button {...getBtnProps(item)}>{item.showName}</Button>
  1567 + </div>
  1568 + );
  1569 + });
  1570 +
  1571 + const rightMap = [4, 9, 3, 8];
  1572 + const btnsRightList = config.gdsconfigformslave.filter(
  1573 + item =>
  1574 + item.bVisible &&
  1575 + item.sControlName &&
  1576 + item.sControlName.includes("BtnRight1.")
  1577 + );
  1578 +
  1579 + btnsRightList.forEach((item, index) => {
  1580 + rightFormBtn0List[rightMap[index]] = (
  1581 + <div>
  1582 + <Button {...getBtnProps(item)}>{item.showName}</Button>
  1583 + </div>
  1584 + );
  1585 + });
  1586 + const tabRef = useRef();
  1587 + const changeTab = index => {
  1588 + if (!tabRef.current) return;
  1589 + const oNavList = tabRef.current.querySelector(".ant-tabs-nav-list");
  1590 + if (!oNavList) return;
  1591 + oNavList.childNodes[index].click();
  1592 + };
  1593 +
  1594 + return (
  1595 + <div className={styles.type1}>
  1596 + <div className="topPart">
  1597 + <div className="type1Content">
  1598 + <div className="leftTable">
  1599 + <StaticEditTable {...tableProps} />
  1600 + </div>
  1601 + <div className="rightForm">
  1602 + <CommonViewTable className="rightFormBox" {...viewProps} />
  1603 + <div className="rightFormBtn0">
  1604 + {rightFormBtn0List.map(item => item)}
  1605 + </div>
  1606 + <div className="rightFormBtn">
  1607 + <div className="rightFormBtnFoot pagesNuxt">
  1608 + <Button
  1609 + onClick={() => props.onPagesNuxt(tableName, "up")}
  1610 + icon={<LeftOutlined />}
  1611 + {...btnProps}
  1612 + />
  1613 + <Button
  1614 + onClick={() => props.onPagesNuxt(tableName, "next")}
  1615 + icon={<RightOutlined />}
  1616 + {...btnProps}
  1617 + />
  1618 + {[""].map(() => {
  1619 + const sControlName = "BtnRight1.BtnPrint4";
  1620 + const btnConfig = config.gdsconfigformslave.find(
  1621 + item => item.sControlName === sControlName
  1622 + );
  1623 + if (!btnConfig) return "";
  1624 +
  1625 + return (
  1626 + <Button
  1627 + {...btnProps}
  1628 + {...getBtnProps(btnConfig)}
  1629 + className={`${styles.print4} print4`}
  1630 + >
  1631 + {btnConfig.showName}
  1632 + </Button>
  1633 + );
  1634 + })}
  1635 + </div>
  1636 + </div>
  1637 + </div>
  1638 + </div>
  1639 + <div className="btns">
  1640 + <CommonOperationBarComponent {...operationBarProps} />
  1641 + </div>
  1642 + </div>
  1643 + <div className="bottomPart">
  1644 + <div className="commonModel" ref={tabRef}>
  1645 + <CommonModelComponent {...commonModelProps} />
  1646 + </div>
  1647 + <div className="btnPart">
  1648 + <Space>
  1649 + <Button
  1650 + type="primary"
  1651 + size="large"
  1652 + onClick={changeTab.bind(this, 0)}
  1653 + >
  1654 + 物料消耗登记
  1655 + </Button>
  1656 + <Button
  1657 + type="primary"
  1658 + size="large"
  1659 + onClick={changeTab.bind(this, 2)}
  1660 + >
  1661 + 版材消耗登记
  1662 + </Button>
  1663 + </Space>
  1664 + </div>
  1665 + </div>
  1666 + <PositionComponent {...props} />
  1667 + </div>
  1668 + );
  1669 +};
  1670 +
  1671 +// 类型3-凹印分切
  1672 +const ProductionExecContent3 = props => {
  1673 + const btnTableList = ["slaveWyfq1", "slaveWyfq2", "jpfpbtable0"];
  1674 + const formDataNew = props.formData.filter(
  1675 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1676 + );
  1677 +
  1678 + const formDataNew1 = cloneDeep(formDataNew);
  1679 + formDataNew1.forEach(item => {
  1680 + if (item.sGrd === "slaveWyfq2") {
  1681 + new Array(5).fill("").map((_, index) => {
  1682 + item.gdsconfigformslave.push({
  1683 + sId: commonUtils.createSid(),
  1684 + sName: `sWt${index + 1}`,
  1685 + sControlName: `sWt${index + 1}`,
  1686 + showName: `描述${index + 1}`
  1687 + });
  1688 + });
  1689 + }
  1690 + });
  1691 +
  1692 + const [currentStep, setCurrentStep] = useState(1);
  1693 + const [currentSelectedStep, setCurrentSelectedStep] = useState(1);
  1694 + const { slaveWyfq2Data = [], slaveWyfq2SelectedRowkeys = [] } = props;
  1695 +
  1696 + // 根据数据判断当前轮数
  1697 + useEffect(
  1698 + () => {
  1699 + if (!slaveWyfq2Data.length) {
  1700 + setCurrentStep(1);
  1701 + return;
  1702 + }
  1703 +
  1704 + const iRoundList = slaveWyfq2Data.map(item => item.iRound);
  1705 + const iRoundMax = Math.max(...iRoundList);
  1706 + setCurrentStep(iRoundMax);
  1707 + },
  1708 + [JSON.stringify(slaveWyfq2Data)]
  1709 + );
  1710 +
  1711 + useEffect(
  1712 + () => {
  1713 + setCurrentSelectedStep(currentStep);
  1714 + },
  1715 + [currentStep]
  1716 + );
  1717 +
  1718 + // 根据sWt1-5组成sWasteType
  1719 + // useEffect(() => {
  1720 + // if (!slaveWyfq2Data.length) return;
  1721 +
  1722 + // }, [JSON.stringify(slaveWyfq2Data)])
  1723 +
  1724 + const costomTitle = (
  1725 + <div className={styles.stepState}>
  1726 + {new Array(8).fill("").map((_, index) => {
  1727 + const filterData = slaveWyfq2Data.filter(
  1728 + item => item.iRound === index + 1
  1729 + );
  1730 + const bXialiao = filterData?.[0]?.iJobStatus === 3;
  1731 + return (
  1732 + <div
  1733 + className={`${
  1734 + index < currentStep - 1
  1735 + ? styles.stepState1
  1736 + : index === currentStep - 1
  1737 + ? bXialiao
  1738 + ? styles.stepState1
  1739 + : styles.stepState2
  1740 + : ""
  1741 + } ${
  1742 + currentSelectedStep === index + 1 ? styles.stepStateUnderline : ""
  1743 + } `}
  1744 + onClick={() => {
  1745 + if (index <= currentStep - 1) {
  1746 + setCurrentSelectedStep(index + 1);
  1747 + }
  1748 + }}
  1749 + >
  1750 + 第{index + 1}轮
  1751 + </div>
  1752 + );
  1753 + })}
  1754 + </div>
  1755 + );
  1756 +
  1757 + const commonModelProps = {
  1758 + ...props,
  1759 + costomModal: true,
  1760 + formData: formDataNew1,
  1761 + costomTitle: costomTitle,
  1762 + onFilterData: (tableName, tableData) => {
  1763 + if (tableName === "slaveWyfq2") {
  1764 + return tableData.filter(item => item.iRound === currentSelectedStep);
  1765 + } else {
  1766 + return tableData;
  1767 + }
  1768 + },
  1769 + currentSelectedStep
  1770 + // onTableEnabled: tableName => {
  1771 + // if (tableName === "slaveWyfq2") {
  1772 + // return currentStep === currentSelectedStep;
  1773 + // } else {
  1774 + // return undefined;
  1775 + // }
  1776 + // }
  1777 + };
  1778 +
  1779 + return <CommonModelComponent {...commonModelProps} />;
  1780 +};
  1781 +
  1782 +// 类型4-剔废
  1783 +const ProductionExecContent4 = props => {
  1784 + const btnTableList = ["slaveWytf1", "slaveWytf2", "jpfpbtable0"];
  1785 + const formDataNew = props.formData.filter(
  1786 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1787 + );
  1788 +
  1789 + const { [`${btnTableList[0]}Data`]: data = [] } = props;
  1790 + const sIdGroupStr = data.map(item => item.sId).toString();
  1791 +
  1792 + const timer = useRef(null);
  1793 + useEffect(
  1794 + () => {
  1795 + if (!data.length) return;
  1796 + // 让第一条选中
  1797 + clearTimeout(timer.current);
  1798 + timer.current = setTimeout(() => {
  1799 + props.onSaveState({
  1800 + [`${btnTableList[0]}SelectedRowKeys`]: [data[0].sId]
  1801 + });
  1802 + }, 200);
  1803 + },
  1804 + [sIdGroupStr]
  1805 + );
  1806 +
  1807 + const commonModelProps = {
  1808 + ...props,
  1809 + costomModal: true,
  1810 + formData: formDataNew
  1811 + };
  1812 +
  1813 + return <CommonModelComponent {...commonModelProps} />;
  1814 +};
  1815 +
  1816 +// 类型5-拼接
  1817 +const ProductionExecContent5 = props => {
  1818 + const btnTableList = [
  1819 + "slaveWypj1",
  1820 + "slaveWypj2",
  1821 + "slaveWypj3",
  1822 + "jpfpbtable0"
  1823 + ];
  1824 + const formDataNew = props.formData.filter(
  1825 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1826 + );
  1827 +
  1828 + const commonModelProps = {
  1829 + ...props,
  1830 + costomModal: true,
  1831 + formData: formDataNew
  1832 + };
  1833 +
  1834 + return <CommonModelComponent {...commonModelProps} />;
  1835 +};
  1836 +
  1837 +// 类型6-倒卷
  1838 +const ProductionExecContent6 = props => {
  1839 + const btnTableList = ["slaveWydj", "jpfpbtable0"];
  1840 + const formDataNew = props.formData.filter(
  1841 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1842 + );
  1843 +
  1844 + const commonModelProps = {
  1845 + ...props,
  1846 + costomModal: true,
  1847 + formData: formDataNew
  1848 + };
  1849 +
  1850 + return <CommonModelComponent {...commonModelProps} />;
  1851 +};
  1852 +
  1853 +// 类型7-读码
  1854 +const ProductionExecContent7 = props => {
  1855 + const btnTableList = [
  1856 + "salveWydm1",
  1857 + "salveWydm2",
  1858 + "salveWydm3",
  1859 + "salveWydm4",
  1860 + "jpfpbtable0"
  1861 + ];
  1862 + const formDataNew = props.formData.filter(
  1863 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1864 + );
  1865 +
  1866 + const [bllbVisible, setBllbVisible] = useState(false);
  1867 +
  1868 + let bllbModalProps = {
  1869 + ...props,
  1870 + bllbVisible,
  1871 + setBllbVisible,
  1872 + record: props.salveWydm2Data?.[0],
  1873 + sFieldName: "dLittleReportQty"
  1874 + };
  1875 +
  1876 + const commonModelProps = {
  1877 + ...props,
  1878 + costomModal: true,
  1879 + formData: formDataNew,
  1880 + onBllbClick: () => {
  1881 + if (props.salveWydm2Data?.length) {
  1882 + props.onGetBllbData(props.salveWydm2Data[0].sId, () => {
  1883 + setBllbVisible(true);
  1884 + });
  1885 + }
  1886 + }
  1887 + };
  1888 +
  1889 + return (
  1890 + <div className={styles.wydmContent}>
  1891 + <CommonModelComponent {...commonModelProps} />
  1892 + <BllbModalComponent {...bllbModalProps} />
  1893 + </div>
  1894 + );
  1895 +};
  1896 +
  1897 +// 类型8-品检
  1898 +const ProductionExecContent8 = props => {
  1899 + const btnTableList = [
  1900 + "slaveWyrj1",
  1901 + "slaveWyrj2",
  1902 + "slaveWyrj3",
  1903 + "jpfpbtable0"
  1904 + ];
  1905 + const formDataNew = props.formData.filter(
  1906 + item => item.sGrd && btnTableList.includes(item.sGrd)
  1907 + );
  1908 +
  1909 + const {
  1910 + slaveWyrj2SelectedRowKeys = [],
  1911 + slaveWyrj2Data = [],
  1912 + slaveWyrj2Config: config = {}
  1913 + } = props;
  1914 + const iIndex = slaveWyrj2Data.findIndex(
  1915 + item => item.sId === slaveWyrj2SelectedRowKeys[0]
  1916 + );
  1917 + const viewRow = iIndex !== -1 ? slaveWyrj2Data[iIndex] : {};
  1918 +
  1919 + const getBtnConfigByControlName = sControlName => {
  1920 + if (!config.gdsconfigformslave) return {};
  1921 + const btnConfig =
  1922 + config.gdsconfigformslave.find(
  1923 + item => item.sControlName === sControlName
  1924 + ) || {};
  1925 + return {
  1926 + ...btnConfig,
  1927 + disabled: props.onGetBtnStatus("slaveWyrj2", btnConfig),
  1928 + onClick: async () => {
  1929 + if (!props.onGetBtnContinue()) return;
  1930 + await props.awaitPromiseReturn();
  1931 + const { sButtonParam, sInstruct } = btnConfig;
  1932 + // 调用指令集
  1933 + if (sInstruct) {
  1934 + props.onExecInstructSet({
  1935 + ...props,
  1936 + btnConfig,
  1937 + tableLineParams: {
  1938 + name: "slaveWyrj2",
  1939 + record: viewRow,
  1940 + index: iIndex
  1941 + }
  1942 + });
  1943 + return;
  1944 + }
  1945 + // 调用存储过程
  1946 + if (sButtonParam) {
  1947 + props.onProcedureCall({
  1948 + btnConfig,
  1949 + onSuccess: () => {
  1950 + props.onRefresh && props.onRefresh();
  1951 + },
  1952 + onConfirm: () => {},
  1953 + onError: () => {}
  1954 + });
  1955 + return;
  1956 + }
  1957 + }
  1958 + };
  1959 + };
  1960 +
  1961 + // const getBtnProps = (sName, color) => {
  1962 + // const style = color
  1963 + // ? {
  1964 + // backgroundColor: color,
  1965 + // borderColor: color
  1966 + // }
  1967 + // : {};
  1968 +
  1969 + // const extraProps = sName ? getBtnConfigByControlName(sName) : {};
  1970 +
  1971 + // return {
  1972 + // type: "primary",
  1973 + // size: "large",
  1974 + // style: {
  1975 + // ...style,
  1976 + // width: 75,
  1977 + // paddingLeft: 0,
  1978 + // paddingRight: 0
  1979 + // },
  1980 + // ...extraProps
  1981 + // };
  1982 + // };
  1983 +
  1984 + const [bllbVisible, setBllbVisible] = useState(false);
  1985 +
  1986 + let bllbModalProps = {
  1987 + ...props,
  1988 + bllbVisible,
  1989 + setBllbVisible,
  1990 + record: props.slaveWyrj2Data?.[0]
  1991 + };
  1992 +
  1993 + const commonModelProps = {
  1994 + ...props,
  1995 + costomModal: true,
  1996 + formData: formDataNew,
  1997 + // costomFormOperationBar: (
  1998 + // <div className="slaveWyrj btnContent">
  1999 + // <div>
  2000 + // <Button
  2001 + // {...getBtnProps()}
  2002 + // icon={<LeftOutlined />}
  2003 + // style={{
  2004 + // borderColor: "#eee",
  2005 + // background: "#eee",
  2006 + // color: "#999",
  2007 + // borderRadius: 5
  2008 + // }}
  2009 + // onClick={() => {
  2010 + // props.onPagesNuxt("slaveWyrj2", "up");
  2011 + // }}
  2012 + // />
  2013 + // </div>
  2014 + // <div />
  2015 + // <div>
  2016 + // <Button {...getBtnProps("BtnLeft1.BtnEventBlanking")}>下料</Button>
  2017 + // </div>
  2018 + // <div>
  2019 + // <Button {...getBtnProps("BtnRight1.BtnPrint1")}>产量①</Button>
  2020 + // </div>
  2021 + // <div>
  2022 + // <Button {...getBtnProps("BtnRight1.BtnPrint2")}>产品②</Button>
  2023 + // </div>
  2024 + // <div>
  2025 + // <Button
  2026 + // {...getBtnProps()}
  2027 + // icon={<RightOutlined />}
  2028 + // style={{
  2029 + // borderColor: "#eee",
  2030 + // background: "#eee",
  2031 + // color: "#999",
  2032 + // borderRadius: 5
  2033 + // }}
  2034 + // onClick={() => {
  2035 + // props.onPagesNuxt("slaveWyrj2", "next");
  2036 + // }}
  2037 + // />
  2038 + // </div>
  2039 + // <div />
  2040 + // <div>
  2041 + // <Button {...getBtnProps("BtnRight1.BtnPrint3")}>产量+产品</Button>
  2042 + // </div>
  2043 + // <div>
  2044 + // <Button {...getBtnProps("BtnRight1.BtnPrint4")}>OQC标签③</Button>
  2045 + // </div>
  2046 + // <div>
  2047 + // {/* <Button {...getBtnProps("BtnRight1.BtnCancel", "#faad14")}>
  2048 + // 撤销
  2049 + // </Button> */}
  2050 + // </div>
  2051 + // </div>
  2052 + // )
  2053 + onBllbClick: () => {
  2054 + if (props.slaveWyrj2Data?.length) {
  2055 + props.onGetBllbData(props.slaveWyrj2Data[0].sId, () => {
  2056 + setBllbVisible(true);
  2057 + });
  2058 + }
  2059 + }
  2060 + };
  2061 +
  2062 + return (
  2063 + <div className={styles.wyrjConent}>
  2064 + <CommonModelComponent {...commonModelProps} />
  2065 + <BllbModalComponent {...bllbModalProps} />
  2066 + </div>
  2067 + );
  2068 +};
  2069 +
  2070 +// 类型9-包装
  2071 +const ProductionExecContent9 = props => {
  2072 + const btnTableList = [
  2073 + "salveWybz1",
  2074 + "salveWybz2",
  2075 + "salveWybz3",
  2076 + "palletBatchMaterial",
  2077 + "workerOrderBatchMaterial",
  2078 + "jpfpbtable0"
  2079 + ];
  2080 + const formDataNew = props.formData.filter(
  2081 + item => item.sGrd && btnTableList.includes(item.sGrd)
  2082 + );
  2083 +
  2084 + const [bllbVisible, setBllbVisible] = useState(false);
  2085 +
  2086 + let bllbModalProps = {
  2087 + ...props,
  2088 + bllbVisible,
  2089 + setBllbVisible,
  2090 + record: props.salveWybz2Data?.[0]
  2091 + };
  2092 +
  2093 + const commonModelProps = {
  2094 + ...props,
  2095 + costomModal: true,
  2096 + formData: formDataNew,
  2097 + onBllbClick: () => {
  2098 + if (props.salveWybz2Data?.length) {
  2099 + props.onGetBllbData(props.salveWybz2Data[0].sId, () => {
  2100 + setBllbVisible(true);
  2101 + });
  2102 + }
  2103 + }
  2104 + };
  2105 +
  2106 + return (
  2107 + <div className={styles.wybzContent}>
  2108 + <CommonModelComponent {...commonModelProps} />
  2109 + <BllbModalComponent {...bllbModalProps} />
  2110 + </div>
  2111 + );
  2112 +};
  2113 +
  2114 +// 成品不良类比弹窗
  2115 +const BllbModalComponent = props => {
  2116 + const { bllbVisible, setBllbVisible } = props;
  2117 + if (!bllbVisible) return "";
  2118 +
  2119 + const {
  2120 + bllbtable0Config = {},
  2121 + bllbtable0Data = [],
  2122 + record,
  2123 + refreshTime,
  2124 + sFieldName = "dReportQty"
  2125 + } = props;
  2126 + const { [sFieldName]: dReportQtyOld = 0, sId: sParentId } = record;
  2127 + const dReportQty = dReportQtyOld; // Number((dReportQtyOld).toFixed(4));
  2128 + const [restQty, setRestQty] = useState(dReportQty);
  2129 + const [bllbConfig, setBllbConfig] = useState([]);
  2130 + const [options, setOptions] = useState([]);
  2131 + const [optionsList, setOptionsList] = useState([]);
  2132 + const [data, setData] = useState(bllbtable0Data);
  2133 + const [delData, setDelData] = useState([]);
  2134 + useEffect(() => {
  2135 + if (!data.length) {
  2136 + setData([
  2137 + {
  2138 + sId: commonUtils.createSid(),
  2139 + sParentId,
  2140 + handleType: "add",
  2141 + bMesNew: true
  2142 + }
  2143 + ]);
  2144 + }
  2145 + }, []);
  2146 + useEffect(
  2147 + async () => {
  2148 + const { gdsconfigformslave = [] } = bllbtable0Config;
  2149 + if (gdsconfigformslave.length) {
  2150 + const bllbConfigTemp = gdsconfigformslave.filter(item => item.bVisible);
  2151 + setBllbConfig(bllbConfigTemp);
  2152 + const bldlOptions = await props.getSqlDropDownData(
  2153 + "",
  2154 + "bldl",
  2155 + bllbConfigTemp.find(item => item.sName === "sType"),
  2156 + {},
  2157 + ""
  2158 + );
  2159 + setOptions(bldlOptions.dropDownData);
  2160 + }
  2161 + },
  2162 + [JSON.stringify(bllbtable0Config)]
  2163 + );
  2164 + useEffect(
  2165 + () => {
  2166 + if (!data.length) return;
  2167 + const MaxDecimal = [dReportQty, ...data.map(item => item.dQty)].reduce(
  2168 + (pre, cur) => {
  2169 + const str = (cur || 0).toString();
  2170 + const num = str.split(".")[1] || "";
  2171 + return Math.max(num.length, pre);
  2172 + },
  2173 + 0
  2174 + );
  2175 +
  2176 + const totalQty = data.reduce((pre, cur) => {
  2177 + return pre + (Number(cur.dQty) || 0);
  2178 + }, 0);
  2179 +
  2180 + let restQtyNew = (dReportQty - totalQty).toFixed(MaxDecimal);
  2181 +
  2182 + const dataTemp = [...data];
  2183 + if (totalQty >= dReportQty) {
  2184 + const iIndex = data.findIndex(item => item.bLastChanged);
  2185 + if (iIndex !== -1) {
  2186 + const dataNew = data.filter((_, index) => index !== iIndex);
  2187 + const totalQtyNew = dataNew.reduce((pre, cur) => {
  2188 + return pre + (Number(cur.dQty) || 0);
  2189 + }, 0);
  2190 +
  2191 + const MaxDecimalNew = [
  2192 + dReportQty,
  2193 + ...dataNew.map(item => item.dQty)
  2194 + ].reduce((pre, cur) => {
  2195 + const str = (cur || 0).toString();
  2196 + const num = str.split(".")[1] || "";
  2197 + return Math.max(num.length, pre);
  2198 + }, 0);
  2199 +
  2200 + dataTemp[iIndex].dQty = (dReportQty - totalQtyNew).toFixed(
  2201 + MaxDecimalNew
  2202 + );
  2203 + restQtyNew = 0;
  2204 + }
  2205 + }
  2206 + dataTemp.forEach(item => {
  2207 + delete item.bLastChanged;
  2208 + });
  2209 +
  2210 + setData(dataTemp);
  2211 + setRestQty(restQtyNew);
  2212 + },
  2213 + [refreshTime]
  2214 + );
  2215 +
  2216 + const onOk = () => {
  2217 + props.onExecInstructSet({
  2218 + btnConfig: {
  2219 + sInstruct: JSON.stringify([
  2220 + {
  2221 + opr: "save",
  2222 + doNotRefresh: true,
  2223 + data: [
  2224 + {
  2225 + tablename: "mftpitBadEntry",
  2226 + srcDataset: "bblb"
  2227 + }
  2228 + ]
  2229 + }
  2230 + ]),
  2231 + showName: "确认˝"
  2232 + },
  2233 + nextProps: {
  2234 + bblbData: data.map(item => ({ ...item, dQty: Number(item.dQty) })),
  2235 + bblbDelData: delData,
  2236 + bblbConfig: bllbtable0Config
  2237 + },
  2238 + callback: () => {
  2239 + setBllbVisible(false);
  2240 + }
  2241 + });
  2242 + };
  2243 +
  2244 + return (
  2245 + <Modal
  2246 + title="成品不良类别"
  2247 + className="mesCommonModal"
  2248 + width={600}
  2249 + height={480}
  2250 + visible={bllbVisible}
  2251 + onCancel={() => setBllbVisible(false)}
  2252 + footer={
  2253 + <Space>
  2254 + <Button size="large" onClick={() => setBllbVisible(false)}>
  2255 + 取消
  2256 + </Button>
  2257 + <Button type="primary" size="large" onClick={onOk}>
  2258 + 确定
  2259 + </Button>
  2260 + </Space>
  2261 + }
  2262 + >
  2263 + <div className={styles.bllb}>
  2264 + <Row className="bllbRow">
  2265 + <Col flex={"40px"}>
  2266 + <div className="redDot" />
  2267 + </Col>
  2268 + <Col flex={"160px"}>OK合格</Col>
  2269 + <Col flex={"160px"}>合格</Col>
  2270 + <Col flex={1}>
  2271 + <Input size="large" value={restQty} disabled />
  2272 + </Col>
  2273 + <Col flex={"50px"}>张</Col>
  2274 + </Row>
  2275 + {data.map((rowData, index) => {
  2276 + const { sId: lineId } = rowData;
  2277 + const oBtnPlus = (
  2278 + <Button
  2279 + className={styles.mesAdd}
  2280 + type="link"
  2281 + size="large"
  2282 + icon={<PlusOutlined />}
  2283 + onClick={() => {
  2284 + setData(pre => [
  2285 + ...pre,
  2286 + {
  2287 + sId: commonUtils.createSid(),
  2288 + bMesNew: true,
  2289 + handleType: "add",
  2290 + sParentId
  2291 + }
  2292 + ]);
  2293 + }}
  2294 + />
  2295 + );
  2296 +
  2297 + const oBtnMinus = (
  2298 + <Button
  2299 + className={styles.mesDel}
  2300 + type="link"
  2301 + size="large"
  2302 + icon={<MinusOutlined />}
  2303 + onClick={() => {
  2304 + const delDataTemp = data
  2305 + .filter(item => item.sId === lineId && !item.bMesNew)
  2306 + .map(item => ({ ...item, handleType: "del" }));
  2307 + setData(pre => pre.filter(item => item.sId !== lineId));
  2308 + setDelData(pre => [...pre, ...delDataTemp]);
  2309 + }}
  2310 + />
  2311 + );
  2312 +
  2313 + return (
  2314 + <Row className="bllbRow" key={`bllbRow_${lineId}`}>
  2315 + <Col flex={"40px"}>{index === 0 ? oBtnPlus : oBtnMinus}</Col>
  2316 + <Col flex={"160px"} style={{ maxWidth: "160px" }}>
  2317 + <Select
  2318 + showSearch
  2319 + placeholder="不良大类"
  2320 + border={false}
  2321 + size="large"
  2322 + style={{ width: "100%" }}
  2323 + fieldNames={{
  2324 + label: "sBadproductName",
  2325 + value: "sBadproductName"
  2326 + }}
  2327 + options={options}
  2328 + value={rowData.sType}
  2329 + onChange={async value => {
  2330 + const blxlOptions = await props.getSqlDropDownData(
  2331 + "",
  2332 + "blxl",
  2333 + bllbConfig.find(item => item.sName === "sSubclass"),
  2334 + {
  2335 + conditonValues: {
  2336 + sClassId: options.find(
  2337 + i => i.sBadproductName === value
  2338 + )?.sId
  2339 + }
  2340 + },
  2341 + ""
  2342 + );
  2343 + setData(pre => {
  2344 + pre[index].sType = value;
  2345 + pre[index].sSubclass = undefined;
  2346 + pre[index].handleType = pre[index].handleType || "update";
  2347 + return pre;
  2348 + });
  2349 + setOptionsList(pre => {
  2350 + const iIndex = pre.findIndex(item => item.sId === lineId);
  2351 + if (iIndex !== -1) {
  2352 + pre[iIndex].options = blxlOptions.dropDownData;
  2353 + pre[iIndex].sType = value;
  2354 + } else {
  2355 + pre.push({
  2356 + sId: lineId,
  2357 + sType: value,
  2358 + options: blxlOptions.dropDownData
  2359 + });
  2360 + }
  2361 + return pre;
  2362 + });
  2363 + props.onSaveState({ refreshTime: new Date().getTime() });
  2364 + }}
  2365 + />
  2366 + </Col>
  2367 + <Col flex={"160px"} style={{ maxWidth: "160px" }}>
  2368 + <Select
  2369 + showSearch
  2370 + placeholder="不良小类"
  2371 + border={false}
  2372 + size="large"
  2373 + style={{ width: "100%" }}
  2374 + fieldNames={{
  2375 + label: "sClassifyName",
  2376 + value: "sClassifyName"
  2377 + }}
  2378 + options={(() => {
  2379 + const temp = optionsList.find(item => item.sId === lineId);
  2380 + if (!temp || !temp.options) return [];
  2381 +
  2382 + const { sType } = temp;
  2383 + const selectedList = data
  2384 + .filter(
  2385 + item => item.sType === sType && item.sId !== rowData.sId
  2386 + )
  2387 + .map(item => item.sSubclass);
  2388 +
  2389 + const result = temp.options.filter(
  2390 + item => !selectedList.includes(item.sClassifyName)
  2391 + );
  2392 + return result;
  2393 + })()}
  2394 + value={rowData.sSubclass}
  2395 + onChange={value => {
  2396 + setData(pre => {
  2397 + pre[index].sSubclass = value;
  2398 + pre[index].handleType = pre[index].handleType || "update";
  2399 + return pre;
  2400 + });
  2401 + props.onSaveState({ refreshTime: new Date().getTime() });
  2402 + }}
  2403 + onFocus={async () => {
  2404 + const temp = optionsList.find(item => item.sId === lineId);
  2405 + if (temp) return;
  2406 + const blxlOptions = await props.getSqlDropDownData(
  2407 + "",
  2408 + "blxl",
  2409 + bllbConfig.find(item => item.sName === "sSubclass"),
  2410 + {
  2411 + conditonValues: {
  2412 + sClassId: options.find(
  2413 + i => i.sBadproductName === rowData.sType
  2414 + )?.sId
  2415 + }
  2416 + },
  2417 + ""
  2418 + );
  2419 + setOptionsList(pre => {
  2420 + pre.push({
  2421 + sId: lineId,
  2422 + sType: rowData.sType,
  2423 + options: blxlOptions.dropDownData
  2424 + });
  2425 + return pre;
  2426 + });
  2427 + props.onSaveState({ refreshTime: new Date().getTime() });
  2428 + }}
  2429 + />
  2430 + </Col>
  2431 + <Col flex={1}>
  2432 + <Input
  2433 + size="large"
  2434 + value={rowData.dQty}
  2435 + onChange={event => {
  2436 + const { value } = event.target;
  2437 + const regex = /^-?\d*\.?\d*$/;
  2438 + if (!regex.test(value) && value !== "") return;
  2439 +
  2440 + setData(pre => {
  2441 + pre[index].dQty = value;
  2442 + pre[index].bLastChanged = true;
  2443 + pre[index].handleType = pre[index].handleType || "update";
  2444 + return pre;
  2445 + });
  2446 + props.onSaveState({ refreshTime: new Date().getTime() });
  2447 + }}
  2448 + />
  2449 + </Col>
  2450 + <Col flex={"50px"}>张</Col>
  2451 + </Row>
  2452 + );
  2453 + })}
  2454 + </div>
  2455 + </Modal>
  2456 + );
  2457 +};
  2458 +
  2459 +// 凹印挑规针位弹窗选择
  2460 +const PositionComponent = props => {
  2461 + const { positionValue, positionModalVisible } = props;
  2462 + if (!positionModalVisible) return "";
  2463 +
  2464 + const [data, setData] = useState([]);
  2465 +
  2466 + useEffect(() => {
  2467 + const arr = positionValue.replace(",", /,/g).split(",");
  2468 + const tempData = [];
  2469 + arr.forEach(item => {
  2470 + const numbers = item.match(/\d+/g); // 提取所有数字
  2471 + const result = numbers?.map(Number); // 转换为数值
  2472 + if (result?.length === 3) {
  2473 + tempData.push(result);
  2474 + }
  2475 + });
  2476 +
  2477 + const dataLength = tempData.length;
  2478 + if (dataLength < 10) {
  2479 + for (let i = 0; i < 10 - dataLength; i++) {
  2480 + tempData.push([undefined, undefined, undefined]);
  2481 + }
  2482 + }
  2483 + setData(tempData);
  2484 + }, []);
  2485 +
  2486 + const onCancel = () => {
  2487 + props.onSaveState({
  2488 + positionValue: undefined,
  2489 + positionModalVisible: false
  2490 + });
  2491 + };
  2492 +
  2493 + const onOk = () => {
  2494 + const tableName = "wytgtable0";
  2495 + const {
  2496 + [`${tableName}Data`]: tableData = [],
  2497 + [`${tableName}SelectedRowKeys`]: selectedRowKeys = []
  2498 + } = props;
  2499 + const iIndex = tableData.findIndex(item => item.sId === selectedRowKeys[0]);
  2500 + const result = data
  2501 + .filter(
  2502 + item =>
  2503 + item[0] !== undefined &&
  2504 + item[1] !== undefined &&
  2505 + item[2] !== undefined &&
  2506 + item[0] !== "" &&
  2507 + item[1] !== "" &&
  2508 + item[2] !== ""
  2509 + )
  2510 + .map(item => `前${item[0]}-${item[1]}侧${item[2]}`)
  2511 + .toString();
  2512 +
  2513 + tableData[iIndex].sPosition = result;
  2514 + tableData[iIndex].handleType = "update";
  2515 +
  2516 + props.onExecInstructSet({
  2517 + nextProps: { ...props, [`${tableName}Data`]: tableData },
  2518 + btnConfig: {
  2519 + showName: "保存",
  2520 + sInstruct: JSON.stringify([
  2521 + {
  2522 + opr: "save",
  2523 + data: [
  2524 + {
  2525 + tablename: "plc_machinedate_tray",
  2526 + srcDataset: tableName
  2527 + }
  2528 + ]
  2529 + }
  2530 + ])
  2531 + },
  2532 + callback: () => {
  2533 + onCancel();
  2534 + }
  2535 + });
  2536 + };
  2537 +
  2538 + const options = new Array(10).fill("").map((_, index) => {
  2539 + return {
  2540 + label: index + 1,
  2541 + value: index + 1
  2542 + };
  2543 + });
  2544 +
  2545 + const getSelectComponent = (index, iIndex) => {
  2546 + const value = data[index]?.[iIndex];
  2547 +
  2548 + return (
  2549 + <Select
  2550 + showSearch
  2551 + allowClear
  2552 + border={false}
  2553 + size="large"
  2554 + style={{ width: "100%" }}
  2555 + options={options}
  2556 + value={value}
  2557 + onChange={value => {
  2558 + const dataNew = cloneDeep(data);
  2559 + dataNew[index][iIndex] = value;
  2560 + setData(dataNew);
  2561 + }}
  2562 + />
  2563 + );
  2564 + };
  2565 +
  2566 + const getNumber = number => {
  2567 + const json = {
  2568 + 1: "①",
  2569 + 2: "②",
  2570 + 3: "③",
  2571 + 4: "④",
  2572 + 5: "⑤",
  2573 + 6: "⑥",
  2574 + 7: "⑦",
  2575 + 8: "⑧",
  2576 + 9: "⑨",
  2577 + 10: "⑩"
  2578 + };
  2579 + if (number) {
  2580 + return json[number];
  2581 + }
  2582 + };
  2583 +
  2584 + return (
  2585 + <Modal
  2586 + title="针位选择"
  2587 + className="mesCommonModal"
  2588 + width={600}
  2589 + visible={positionModalVisible}
  2590 + onCancel={onCancel}
  2591 + footer={
  2592 + <Space>
  2593 + <Button size="large" onClick={() => onCancel()}>
  2594 + 取消
  2595 + </Button>
  2596 + <Button type="primary" size="large" onClick={onOk}>
  2597 + 确定
  2598 + </Button>
  2599 + </Space>
  2600 + }
  2601 + >
  2602 + <div className={styles.wyzwSelect}>
  2603 + {["", "", "", "", "", "", "", "", "", ""].map((_, index) => {
  2604 + return (
  2605 + <div key={index} className="wyzwSelectItem">
  2606 + <div className="rowNum">{getNumber(index + 1)}</div>
  2607 + <div className="numberSplit">前</div>
  2608 + <div className="numberSelect">{getSelectComponent(index, 0)}</div>
  2609 + <div className="numberSplit">-</div>
  2610 + <div className="numberSelect">{getSelectComponent(index, 1)}</div>
  2611 + <div className="numberSplit">侧</div>
  2612 + <div className="numberSelect">{getSelectComponent(index, 2)}</div>
  2613 + <div className="numberSplit">
  2614 + <Button
  2615 + className={styles.mesDel}
  2616 + type="primary"
  2617 + size="large"
  2618 + icon={<MinusOutlined />}
  2619 + onClick={() => {
  2620 + const dataNew = cloneDeep(data);
  2621 + dataNew[index] = [undefined, undefined, undefined];
  2622 + setData(dataNew);
  2623 + }}
  2624 + />
  2625 + </div>
  2626 + </div>
  2627 + );
  2628 + })}
  2629 + </div>
  2630 + </Modal>
  2631 + );
  2632 +};
  2633 +
1167 export default ProductionExecMain; 2634 export default ProductionExecMain;