import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import updateForDispatchOCSMQARAButton from '@salesforce/apex/ReportController.updateForDispatchOCSMQARAButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexDispatchOCSMQARA extends LightningElement { @api recordId; IsLoading = true; connectedCallback(){ console.log(this.recordId); this.IsLoading = false; this.DispatchOCSMQARA(); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } DispatchOCSMQARA () { updateForDispatchOCSMQARAButton({ recordId: this.recordId }).then(result =>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent()); }); } }