unknown
2023-08-23 dfff58b7cd897b824a129edba6b5cdae20bb1e5c
force-app/main/default/lwc/lexCopyRepair/lexCopyRepair.js
@@ -11,8 +11,14 @@
} from 'lightning/actions';
import init from '@salesforce/apex/otherButtonRepairController.init';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import {
   NavigationMixin
} from 'lightning/navigation';
import {
   encodeDefaultFieldValues
} from 'lightning/pageReferenceUtils';
export default class LexCopyRepair extends LightningElement {
export default class LexCopyRepair extends NavigationMixin(LightningElement)  {
    @api recordId;
    str;
    IsLoading = true;
@@ -157,53 +163,122 @@
                this.Status1C = result.Status1C;
                this.CopyRepair();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log(error);
        }).finally(() => {
        });
        })
    }
    //   复制
    CopyRepair() {
        var Status = this.Status1C;
        if (Status == '0.删除' || Status == '0.取消') {
            var url = "/a0J/e?00N10000009H2fa=" + this.Name + "&CF00N10000002Dx1X=" + this.DeliveredProductC +
                "&CF00N10000002Dx1X_lkid=" + this.DeliveredProductC + "&00N10000006P1dw=" + this.PaperRepairRequestNoC +
                "&CF00N10000002Dx66=" + this.HospitalC + "&CF00N10000002Dx5t=" + this.DepartmentClassC +
                "&CF00N10000002Dx5n=" + this.AccountC + "&00N10000008rG4p=" + this.RepairCostTypeC +
                "&CF00N10000006P1eV=" + this.DealerC + "&CF00N10000002EMHw=" + this.InchargeStaffC +
                "&CF00N10000005HDvq=" + this.InchargeStaffContactC + "&00N10000006P6SM=" + this.SalesOfficeCodeSelectionC +
                "&00N10000002F6dW=" + this.OnSiteRepairC + "&00N10000006P6Rn=" + this.workLocationSelectC +
                "&00N10000009i1Z2=" + this.ReturnsProductWayC + "&00N10000002Dx6I=" + this.RepairDetailC +
                "&00N10000009H1rQ=" + this.RepairApplicantC + "&00N10000009H1rP=" + this.RepairApplicantHospitalC +
                "&00N10000009H1rO=" + this.RepairApplicantDepartmentC + "&00N10000009H1rB=" + this.DeliveryLogisticsModeC +
                "&00N10000009H1rk=" + this.engineerSendDateC + "&00N10000009H1rC=" + this.DeliveryLogisticsNoC +
                "&00N10000009H1rA=" + this.DeliveryLogisticsAnnotationC + "&00N10000008rsVQ=" + this.DateReceiptQuestionsC +
                "&00N10000008rsVN=" + this.BreakORFallOffC + "&00N10000008rsVS=" + this.DelayReportReasonC +
                "&00N10000008rsW5=" + this.UseFailProductFinishC + "&00N10000008rsW7=" + this.ifDeadHurtC +
                "&00N10000008rsW4=" + this.SupportingProductsC + "&00N10000008rsVv=" + this.ProblemOccurredC +
                "&00N10000008rsVL=" + this.AfterFailureInformationC + "&00N10000009hsvI=" + this.ProblemOccurredSelectC +
                "&00N10000008rsVR=" + this.Delay15MinC + "&00N10000008rsVw=" + this.ProductFailureRelatedC +
                "&00N10000008rsVZ=" + this.InformationFromC + "&00N10000008rsW2=" + this.ReportAdverseEventsC +
                "&00N10000008rsVT=" + this.FailureQInHospitalC + "&00N10000008rsW6=" + this.WhatProjectC +
                "&00N10000008rsVk=" + this.OperationOrExaminationNameC + "&00N10000008rWce=" + this.MaintenanceContractTypeC +
                "&00N10000002Dx5y=" + this.FailureOccurrenceDateC + "&00N10000002FH86=" + this.RepairSourceC +
                "&CF00N10000009H1rR=" + this.RepairSubOrderC + "&CF00N10000002FIJU=" + this.OnCallIDC +
                "&CF00N10000002FIJZ=" + this.QISIDC + "&CF00N10000006PRCp=" + this.InsReportC +
                "&00N10000008rsVM=" + this.AwareDateC + "&00N10000009GmI6=" + this.OCSMAdministrativeReportNumberC +
                "&00N10000009GmI4=" + this.MBCAwareDateC + "&00N10000009GmI5=" + this.OCSMAdministrativeReportDateC +
                "&00N10000009GmI7=" + this.OCSMAdministrativeReportStatusC + "&00N100000095siE=" + this.CFDANoHandC +
                "&00N100000095shz=" + this.ProduceCompanyHandC + "&00N100000098PV9=" + this.OfferRentalNewC +
                "&00N100000098PVA=" + this.ifRentalApplyC + "&00N10000006gZ4g=" + this.LatestCollectDatePriorityC +
                "&00N10000007MNFW=" + this.RentalApplyEquipmentSetDetailIdC +
                "&CF00N10000007MNFX=" + this.RentalApplyEquipmentSetDetailC + "&retURL=%2F" + this.Id;
            window.open(url);
            const url = encodeDefaultFieldValues({
                Old_Name__c: this.Name,
                Delivered_Product__c: this.DeliveredProductC,
                PaperRepairRequestNo__c: this.PaperRepairRequestNoC,
                Hospital__c: this.HospitalC,
                Department_Class__c: this.DepartmentClassC,
                Account__c: this.AccountC,
                RepairCostType__c: this.RepairCostTypeC,
                Dealer__c: this.DealerC,
                Incharge_Staff__c: this.InchargeStaffC,
                Incharge_Staff_Contact__c: this.InchargeStaffContactC,
                SalesOfficeCode_selection__c: this.SalesOfficeCodeSelectionC,
                On_site_repair__c: this.OnSiteRepairC,
                work_location_select__c : this.workLocationSelectC,
                Returns_Product_way__c : this.ReturnsProductWayC,
                Repair_Detail__c : this.RepairDetailC,
                RepairApplicant__c : this.RepairApplicantC,
                RepairApplicantHospital__c : this.RepairApplicantHospitalC,
                RepairApplicantDepartment__c : this.RepairApplicantDepartmentC,
                DeliveryLogisticsMode__c : this.DeliveryLogisticsModeC,
                engineerSendDate__c : this.engineerSendDateC,
                DeliveryLogisticsNo__c : this.DeliveryLogisticsNoC,
                DeliveryLogisticsAnnotation__c : this.DeliveryLogisticsAnnotationC,
                DateReceiptQuestions__c : this.DateReceiptQuestionsC,
                BreakORFallOff__c : this.BreakORFallOffC,
                DelayReportReason__c : this.DelayReportReasonC,
                UseFailProductFinish__c : this.UseFailProductFinishC,
                ifDeadHurt__c  : this.ifDeadHurtC,
                SupportingProducts__c  : this.SupportingProductsC,
                ProblemOccurred__c : this.ProblemOccurredC,
                AfterFailureInformation__c : this.AfterFailureInformationC,
                ProblemOccurredSelect__c : this.ProblemOccurredSelectC,
                Delay15Min__c: this.Delay15MinC,
                ProductFailureRelated__c : this.ProductFailureRelatedC,
                InformationFrom__c : this.InformationFromC,
                ReportAdverseEvents__c : this.ReportAdverseEventsC,
                FailureQInHospital__c : this.FailureQInHospitalC,
                WhatProject__c : this.WhatProjectC,
                OperationOrExaminationName__c : this.OperationOrExaminationNameC,
                MaintenanceContractType__c : this.MaintenanceContractTypeC,
                Failure_Occurrence_Date__c : this.FailureOccurrenceDateC,
                Repair_Source__c : this.RepairSourceC,
                RepairSubOrder__c : this.RepairSubOrderC,
                On_Call_ID__c : this.OnCallIDC,
                QIS_ID__c : this.QISIDC,
                InsReport__c : this.InsReportC,
                Aware_date__c : this.AwareDateC,
                OCSMAdministrativeReportNumber__c : this.OCSMAdministrativeReportNumberC,
                MBC_AwareDate__c : this.MBCAwareDateC,
                OCSMAdministrativeReportDate__c : this.OCSMAdministrativeReportDateC,
                OCSMAdministrativeReportStatus__c : this.OCSMAdministrativeReportStatusC,
                CFDA_No_Hand__c : this.CFDANoHandC,
                ProduceCompany_hand__c : this.ProduceCompanyHandC,
                Offer_Rental_New__c : this.OfferRentalNewC,
                if_Rental_Apply__c : this.ifRentalApplyC,
                Latest_Collect_Date_Priority__c : this.LatestCollectDatePriorityC,
                Rental_Apply_Equipment_Set_Detail_Id__c : this.RentalApplyEquipmentSetDetailIdC,
                Rental_Apply_Equipment_Set_Detail__c : this.RentalApplyEquipmentSetDetailC,
            });
            this[NavigationMixin.Navigate]({
                type: 'standard__objectPage',
                attributes: {
                    objectApiName: 'Repair__c',
                    actionName: 'new'
                },
                state: {
                    nooverride: '1',
                    defaultFieldValues: url
                }
            });
            this.dispatchEvent(new CloseActionScreenEvent());
            // var url = "/a0J/e?00N10000009H2fa=" + this.Name + "&CF00N10000002Dx1X=" + this.DeliveredProductC +
            //     "&CF00N10000002Dx1X_lkid=" + this.DeliveredProductC + "&00N10000006P1dw=" + this.PaperRepairRequestNoC +
            //     "&CF00N10000002Dx66=" + this.HospitalC + "&CF00N10000002Dx5t=" + this.DepartmentClassC +
            //     "&CF00N10000002Dx5n=" + this.AccountC + "&00N10000008rG4p=" + this.RepairCostTypeC +
            //     "&CF00N10000006P1eV=" + this.DealerC + "&CF00N10000002EMHw=" + this.InchargeStaffC +
            //     "&CF00N10000005HDvq=" + this.InchargeStaffContactC + "&00N10000006P6SM=" + this.SalesOfficeCodeSelectionC +
            //     "&00N10000002F6dW=" + this.OnSiteRepairC + "&00N10000006P6Rn=" + this.workLocationSelectC +
            //     "&00N10000009i1Z2=" + this.ReturnsProductWayC + "&00N10000002Dx6I=" + this.RepairDetailC +
            //     "&00N10000009H1rQ=" + this.RepairApplicantC + "&00N10000009H1rP=" + this.RepairApplicantHospitalC +
            //     "&00N10000009H1rO=" + this.RepairApplicantDepartmentC + "&00N10000009H1rB=" + this.DeliveryLogisticsModeC +
            //     "&00N10000009H1rk=" + this.engineerSendDateC + "&00N10000009H1rC=" + this.DeliveryLogisticsNoC +
            //     "&00N10000009H1rA=" + this.DeliveryLogisticsAnnotationC + "&00N10000008rsVQ=" + this.DateReceiptQuestionsC +
            //     "&00N10000008rsVN=" + this.BreakORFallOffC + "&00N10000008rsVS=" + this.DelayReportReasonC +
            //     "&00N10000008rsW5=" + this.UseFailProductFinishC + "&00N10000008rsW7=" + this.ifDeadHurtC +
            //     "&00N10000008rsW4=" + this.SupportingProductsC + "&00N10000008rsVv=" + this.ProblemOccurredC +
            //     "&00N10000008rsVL=" + this.AfterFailureInformationC + "&00N10000009hsvI=" + this.ProblemOccurredSelectC +
            //     "&00N10000008rsVR=" + this.Delay15MinC + "&00N10000008rsVw=" + this.ProductFailureRelatedC +
            //     "&00N10000008rsVZ=" + this.InformationFromC + "&00N10000008rsW2=" + this.ReportAdverseEventsC +
            //     "&00N10000008rsVT=" + this.FailureQInHospitalC + "&00N10000008rsW6=" + this.WhatProjectC +
            //     "&00N10000008rsVk=" + this.OperationOrExaminationNameC + "&00N10000008rWce=" + this.MaintenanceContractTypeC +
            //     "&00N10000002Dx5y=" + this.FailureOccurrenceDateC + "&00N10000002FH86=" + this.RepairSourceC +
            //     "&CF00N10000009H1rR=" + this.RepairSubOrderC + "&CF00N10000002FIJU=" + this.OnCallIDC +
            //     "&CF00N10000002FIJZ=" + this.QISIDC + "&CF00N10000006PRCp=" + this.InsReportC +
            //     "&00N10000008rsVM=" + this.AwareDateC + "&00N10000009GmI6=" + this.OCSMAdministrativeReportNumberC +
            //     "&00N10000009GmI4=" + this.MBCAwareDateC + "&00N10000009GmI5=" + this.OCSMAdministrativeReportDateC +
            //     "&00N10000009GmI7=" + this.OCSMAdministrativeReportStatusC + "&00N100000095siE=" + this.CFDANoHandC +
            //     "&00N100000095shz=" + this.ProduceCompanyHandC + "&00N100000098PV9=" + this.OfferRentalNewC +
            //     "&00N100000098PVA=" + this.ifRentalApplyC + "&00N10000006gZ4g=" + this.LatestCollectDatePriorityC +
            //     "&00N10000007MNFW=" + this.RentalApplyEquipmentSetDetailIdC +
            //     "&CF00N10000007MNFX=" + this.RentalApplyEquipmentSetDetailC + "&retURL=%2F" + this.Id;
            // window.open(url);
        } else {
            this.ShowToastEvent("该状态下不能复制", "error")
            // alert("该状态下不能复制");
            this.ShowToastEvent("该状态下不能复制", "error");
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }