import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import { getRecord } from 'lightning/uiRecordApi'; import init from '@salesforce/apex/lexCopyToBaseController.init'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import {loadStyle} from 'lightning/platformResourceLoader'; export default class lexCopyToBase extends NavigationMixin(LightningElement) { @api recordId; dateF; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ Promise.all([ loadStyle(this, lwcCSS) ]); init({ recordId: this.recordId }).then(result=>{ this.dateF = result; this.createOPDFromRentalApply().then(res=>{ this.dispatchEvent(new CloseActionScreenEvent()); }); }); } async createOPDFromRentalApply(){ let tt='dd'; const data = encodeDefaultFieldValues({ Lead_CreateBy__c:'', Lead_CreateDate__c:'', Estimation_No__c:'', Estimation_Name__c:'', Estimation_List_Price__c:'', Agency1__c:'', Sales_Contract_No__c:'', Agency2__c:'', Bid_Publish_Date__c:'', Bidding_Company__c:'', Bidding_No__c:'', Bidding_Project_Name__c:'', Bidding_Content__c:'', Bid_Planned_Date__c:'', Closing_Bid_Company__c:'', Closing_Bid_Price__c:'', Opp_Confirmation_Day__c:'', Last_Follow_Up_Date__c:'', Estimation_Proposal_Date__c:'', Authorized_Date__c:'', Autholization_Activated_Date__c:'', Bid_Date__c:'', Closing_Bid_Date__c:'', Assistant_Applied_Date__c:'', Contract_DB_SalesDept_complite_day__c:'', Contract_DB_complite_day__c:'', Agency_Contract_Date1__c:'', SAP_Send_OK_Date__c:'', Sales_Shop_Hospital_Contract__c:'', Forecast_Collect_Money__c:'', Contract_Invalid_Date__c:'', Next_action__c:'', Follow_up_comment__c:'', Xin_Gross_Follow_Num__c:'', OPD1__c:'', Num_Of_OPD__c:'', OPD_SIS_collect_evaluation_sight__c:'', Detail_Suggestion__c:'', Num_Of_NTC__c:'', Deleted_Reason__c:'', Lost_Opportunity_Date__c:'', opp14:'', Request_quotation_update__c:'', old_Oppo_No__c:'', Oppor_Number_Report__c:'', Manager_name_text__c:'', Sales_assistant_name_text__c:'', Sales_window_text__c:'', If_Authorizing__c:'', Opportunity_No__c:'', Collect_Customer_sign__c:'', Estimation_Decision__c:'', SAP_Send_OK__c:'', Authorized_DB_No__c:'', NotesApprovedNo__c:'', is_CheckTarget_TF__c:'', Whether_FALSE_order__c:'', Stock_apply_status__c:'', Stock_apply_time__c:'', Stock_apply_passtime__c:'', Stock_cancel_reason__c:'', Stock_cancel_reason_text__c:'', Stock_Confrim_Date__c:'', Last_opportunity_file__c:'', Application_Amount_Submit__c:'', Agency_Opportunity__c:'', Budget_Amount_Approval__c:'', Hospital_Budget__c:'', Key_tipics_last_update_day__c:'', Lead_Num__c:'', opp6:'', opp17:'', Other_Society__c:'', Contract_DB_Finalcomplite_day__c:'', Contract_Authorize_Lock__c:'', Old_Opportunity_ID__c:'', LeadSource:'', Authorized_Finish_Sales__c:'', IsAuthorized__c:'', }); console.log(this.dateF+","+data); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Opportunity', // 要新建的对象API actionName: 'new', }, state:{ nooverride: '1', defaultFieldValues:this.dateF+","+data } }); } }