import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/buttonCaseCtl.init'; export default class LexSelectProduct2CIC extends LightningElement { @api recordId; str; IsLoading = true; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.SelectProduct2CIC(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }) } // 新建CIC/产品 SelectProduct2CIC() { var pathnames = window.location.pathname.split("/"); if (pathnames[1] == "emptyHtmlDoc.html") { window.open("/apex/SelectProduct2CIC?cicid=" + this.Id, "_parent"); } else { window.open("/apex/SelectProduct2CIC?cicid=" + this.Id, "_self"); } } }