import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } 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'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import { loadStyle } from 'lightning/platformResourceLoader'; //import { AWSService } from 'c/piUtils'; //deloitte-zhj 20231228 PIPL还原 export default class LexCopyRepair extends NavigationMixin(LightningElement) { @api recordId; str; IsLoading = true; Id; RecordTypeId; Name; DeliveredProductC; AssetName;; //deloitte-zhj 20230914 DeliveredProductIdC; PaperRepairRequestNoC; HospitalC; AccountC; DepartmentClassC; RepairCostTypeC; DealerC; InchargeStaffC; InchargeStaffContactC; SalesOfficeCodeSelectionC; OnSiteRepairC; workLocationSelectC; ReturnsProductWayC; RepairDetailC; RepairApplicantC; RepairApplicantHospitalC; RepairApplicantDepartmentC; DeliveryLogisticsModeC; engineerSendDateC; DeliveryLogisticsNoC; DeliveryLogisticsAnnotationC; DateReceiptQuestionsC; BreakORFallOffC; DelayReportReasonC; UseFailProductFinishC; ifDeadHurtC; SupportingProductsC; ProblemOccurredC; AfterFailureInformationC; InformationFromC; ReportAdverseEventsC; FailureQInHospitalC; WhatProjectC; OperationOrExaminationNameC; MaintenanceContractTypeC; FailureOccurrenceDateC; RepairSourceC; ProblemOccurredSelectC; Delay15MinC; ProductFailureRelatedC; RepairSubOrderC; OnCallIDC; QISIDC; InsReportC; MBCAwareDateC; CFDANoHandC; ProduceCompanyHandC; OfferRentalNewC; ifRentalApplyC; LatestCollectDatePriorityC; RentalApplyEquipmentSetDetailIdC; RentalApplyEquipmentSetDetailC; AwareDateC; OCSMAdministrativeReportNumberC; OCSMAdministrativeReportStatusC; OCSMAdministrativeReportDateC; Status1C; //AWSDataId; //deloitte-zhj 20231228 PIPL还原 //deloitte-zhj 2023-0914 start //AWSService; staticResourceRepair; //deloitte-zhj 2023-0914 end @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { //this.AWSService = new AWSService(); Promise.all([ loadStyle(this, lwcCSS) ]); debugger init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { //this.staticResourceRepair = JSON.parse(result.staticResourceRepair); //deloitte-zhj 2023-0914 //deloitte-zhj 20231228 PIPL还原 this.IsLoading = false; this.Id = result.Id; //this.AWSDataId = result.AWSDataId; //deloitte-zhj 20231228 PIPL还原 this.RecordTypeId = result.RecordTypeId; this.Name = result.Name == undefined ? "" : result.Name; this.DeliveredProductC = result.DeliveredProductC == undefined ? "" : result.DeliveredProductC; this.AssetName = result.AssetName == undefined ? "" : result.AssetName; //deloitte-zhj 2023-09-14 this.PaperRepairRequestNoC = result.PaperRepairRequestNoC == undefined ? "" : result.PaperRepairRequestNoC; this.HospitalC = result.HospitalC == undefined ? "" : result.HospitalC; this.DepartmentClassC = result.DepartmentClassC == undefined ? "" : result.DepartmentClassC; this.RepairCostTypeC = result.RepairCostTypeC == undefined ? "" : result.RepairCostTypeC; this.DealerC = result.DealerC == undefined ? "" : result.DealerC; this.InchargeStaffC = result.InchargeStaffC == undefined ? "" : result.InchargeStaffC; this.InchargeStaffContactC = result.InchargeStaffContactC == undefined ? "" : result.InchargeStaffContactC; this.SalesOfficeCodeSelectionC = result.SalesOfficeCodeSelectionC == undefined ? "" : result.SalesOfficeCodeSelectionC; this.OnSiteRepairC = result.OnSiteRepairC == undefined ? "" : result.OnSiteRepairC; this.workLocationSelectC = result.workLocationSelectC == undefined ? "" : result.workLocationSelectC; this.ReturnsProductWayC = result.ReturnsProductWayC == undefined ? "" : result.ReturnsProductWayC; this.RepairDetailC = result.RepairDetailC == undefined ? "" : result.RepairDetailC; this.RepairApplicantC = result.RepairApplicantC == undefined ? "" : result.RepairApplicantC; this.RepairApplicantHospitalC = result.RepairApplicantHospitalC == undefined ? "" : result.RepairApplicantHospitalC; this.RepairApplicantDepartmentC = result.RepairApplicantDepartmentC == undefined ? "" : result.RepairApplicantDepartmentC; this.DeliveryLogisticsModeC = result.DeliveryLogisticsModeC == undefined ? "" : result.DeliveryLogisticsModeC; this.engineerSendDateC = result.engineerSendDateC == undefined ? "" : result.engineerSendDateC; this.DeliveryLogisticsNoC = result.DeliveryLogisticsNoC == undefined ? "" : result.DeliveryLogisticsNoC; this.DeliveryLogisticsAnnotationC = result.DeliveryLogisticsAnnotationC == undefined ? "" : result.DeliveryLogisticsAnnotationC; this.DateReceiptQuestionsC = result.DateReceiptQuestionsC == undefined ? "" : result.DateReceiptQuestionsC; this.BreakORFallOffC = result.BreakORFallOffC == undefined ? "" : result.BreakORFallOffC; this.DelayReportReasonC = result.DelayReportReasonC == undefined ? "" : result.DelayReportReasonC; this.UseFailProductFinishC = result.UseFailProductFinishC == undefined ? "" : result.UseFailProductFinishC; this.ifDeadHurtC = result.ifDeadHurtC == undefined ? "" : result.ifDeadHurtC; this.SupportingProductsC = result.SupportingProductsC == undefined ? "" : result.SupportingProductsC; this.ProblemOccurredC = result.ProblemOccurredC == undefined ? "" : result.ProblemOccurredC; this.AfterFailureInformationC = result.AfterFailureInformationC == undefined ? "" : result.AfterFailureInformationC; this.InformationFromC = result.InformationFromC == undefined ? "" : result.InformationFromC; this.ReportAdverseEventsC = result.ReportAdverseEventsC == undefined ? "" : result.ReportAdverseEventsC; this.FailureQInHospitalC = result.FailureQInHospitalC == undefined ? "" : result.FailureQInHospitalC; this.WhatProjectC = result.WhatProjectC == undefined ? "" : result.WhatProjectC; this.OperationOrExaminationNameC = result.OperationOrExaminationNameC == undefined ? "" : result.OperationOrExaminationNameC; this.MaintenanceContractTypeC = result.MaintenanceContractTypeC == undefined ? "" : result.MaintenanceContractTypeC; this.FailureOccurrenceDateC = result.FailureOccurrenceDateC == undefined ? "" : result.FailureOccurrenceDateC; this.RepairSourceC = result.RepairSourceC == undefined ? "" : result.RepairSourceC; this.ProblemOccurredSelectC = result.ProblemOccurredSelectC == undefined ? "" : result.ProblemOccurredSelectC; this.Delay15MinC = result.Delay15MinC == undefined ? "" : result.Delay15MinC; this.ProductFailureRelatedC = result.ProductFailureRelatedC == undefined ? "" : result.ProductFailureRelatedC; this.RepairSubOrderC = result.RepairSubOrderC == undefined ? "" : result.RepairSubOrderC; this.OnCallIDC = result.OnCallIDC == undefined ? "" : result.OnCallIDC; this.QISIDC = result.QISIDC == undefined ? "" : result.QISIDC; this.InsReportC = result.InsReportC == undefined ? "" : result.InsReportC; this.MBCAwareDateC = result.MBCAwareDateC == undefined ? "" : result.MBCAwareDateC; this.CFDANoHandC = result.CFDANoHandC == undefined ? "" : result.CFDANoHandC; this.ProduceCompanyHandC = result.ProduceCompanyHandC == undefined ? "" : result.ProduceCompanyHandC; this.OfferRentalNewC = result.OfferRentalNewC == undefined ? "" : result.OfferRentalNewC; this.ifRentalApplyC = result.ifRentalApplyC == undefined ? "" : result.AifRentalApplyCccountC; this.LatestCollectDatePriorityC = result.LatestCollectDatePriorityC == undefined ? "" : result.LatestCollectDatePriorityC; this.RentalApplyEquipmentSetDetailIdC = result.RentalApplyEquipmentSetDetailIdC == undefined ? "" : result.RentalApplyEquipmentSetDetailIdC; this.RentalApplyEquipmentSetDetailC = result.RentalApplyEquipmentSetDetailC == undefined ? "" : result.RentalApplyEquipmentSetDetailC; this.AwareDateC = result.AwareDateC == undefined ? "" : result.AwareDateC; this.OCSMAdministrativeReportNumberC = result.OCSMAdministrativeReportNumberC == undefined ? "" : result.OCSMAdministrativeReportNumberC; this.OCSMAdministrativeReportStatusC = result.OCSMAdministrativeReportStatusC == undefined ? "" : result.OCSMAdministrativeReportStatusC; this.AccountC = result.AccountC == undefined ? "" : result.AccountC; this.OCSMAdministrativeReportDateC = result.OCSMAdministrativeReportDateC == undefined ? "" : result.OCSMAdministrativeReportDateC; this.Status1C = result.Status1C; //deloitte-zhj 20231228 PIPL还原 start this.CopyRepair(); // //deloitte-zhj 2023-0914 start // if (this.AWSDataId != '' || this.AWSDataId != null) { // let that = this; // this.AWSService.query(this.staticResourceRepair.queryUrl, this.AWSDataId, function (data) { // console.log('queryRepairFromAWSIFS data = ' + JSON.stringify(data)); // if (data.object) { // that.RepairApplicantC = data.object['repairApplicant'] == null ? '' : data.object['repairApplicant']; // that.CopyRepair(); // } // }, this.staticResourceRepair.token) // } else { // this.CopyRepair(); // } // //deloitte-zhj 2023-0914 end //deloitte-zhj 20231228 PIPL还原 end } }).catch(error => { console.log(error); }) } // 复制 CopyRepair() { var Status = this.Status1C; if (Status == '0.删除' || Status == '0.取消') { const url = encodeDefaultFieldValues({ //AWSId: this.AWSDataId, //deloitte-zhj 20231228 PIPL还原 Old_Name__c: this.Name, Delivered_Product__c: this.DeliveredProductC, AssetName: this.AssetName, //deloitte-zhj 2023-09-14 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, }); console.log('到了跳转'); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Repair__c', //deloitte-zhj 20231228 PIPL还原 actionName: 'new'// fix by tiger 20240206 //actionName: 'clone' }, 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"); this.dispatchEvent(new CloseActionScreenEvent()); } } ShowToastEvent(msg, type) { const event = new ShowToastEvent({ message: msg, variant: type, mode: 'sticky' }); this.dispatchEvent(event); } }