import { LightningElement, api , track, wire } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { getRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/LexBTReportController.init'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import {loadStyle} from 'lightning/platformResourceLoader'; export default class lexBTReport extends LightningElement { @api recordId; Status; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ Promise.all([ loadStyle(this, lwcCSS) ]); console.log(this.recordId); init({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ this.Status=result; this.main().then(res=>{ // this.dispatchEvent(new CloseActionScreenEvent()); const passOneEvent = new CustomEvent('closem', {      detail: '111'    });    this.dispatchEvent(passOneEvent); }); } }).catch(err=>{ console.log("error:"); console.log(err); }).finally(()=>{ }); } async main(){ if (this.Status =='会议结束'){ window.open('/apex/CampaignBTPDF?id='+this.recordId, 'CampaignBTPDF'); } else { const event = new ShowToastEvent({ message:'会议结束之后可查看!', variant: 'warning', mode: 'sticky' }); this.dispatchEvent(event); } } }