19626
2023-04-04 5d155accb594089737a0b4edd753152a1ea66bc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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());
                });
    }
}