1
chenjingwu
2024-05-24 35910c355f74e736e2068a0ffb7f39ae9615d8e1
force-app/main/default/lwc/lexSubmitReport/lexSubmitReport.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-09-11 09:20:29
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-11 10:00:40
 * @LastEditTime: 2023-10-10 17:47:00
 */
import { api, wire,LightningElement, track } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -16,14 +16,15 @@
import { refreshApex } from '@salesforce/apex';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexSubmitReport extends LightningElement {
    @wire(getRecord, { recordId: '$recordId', fields: [STATUS_FIELD] })
    record;
    @api recordId;
    cntLostCancelReport;
    cntLostCancelDraft;
    IsLoading = true;
    IsLoading;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(111);
@@ -40,13 +41,22 @@
        }
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            title: ' ',
            message: msg,
            variant: type,
            mode: 'sticky'
        });
        this.dispatchEvent(event);
        if(type == 'success'){
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode: 'sticky'
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
@@ -55,6 +65,9 @@
    }
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
           ]);
        init({
            recordId: this.recordId
        }).then(result=>{
@@ -80,6 +93,7 @@
            label: 'this is the aria-label value'
        });
        console.log(result);
        this.IsLoading = true;
        if(result){
            updateSubmitReportButton({
                recordId: this.recordId
@@ -89,9 +103,9 @@
                }else{
                    setTimeout(() => {
                        this.IsLoading = false;
                        refreshApex(this.record);
                        window.location = '/' + this.recordId;
                        this.dispatchEvent(new CloseActionScreenEvent());
                    }, 2000);
                    }, 1000);
                }
            });
        }else{