黄千龙
2023-08-09 626f3c3bb25e204568019e8d568e2d7547d1037a
force-app/main/default/lwc/lexBidAnnouncementConsentButton/lexBidAnnouncementConsentButton.js
@@ -5,7 +5,7 @@
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexBidAnnouncementRejectButton extends LightningElement {
    @api recordId;
    @api recordId;//OwnerId
    IsLoading = true;
    @wire(CurrentPageReference)
@@ -18,6 +18,7 @@
           }
         }
     }
    connectedCallback(){
        this.IsLoading = false;
        this.Consent();
@@ -26,14 +27,22 @@
    Consent(){  
        ConSent({recordId:this.recordId}).then(res=>{
            if(res == '1'){
                this.showToast("同意请求成功","success");
                this.updateRecordView();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
            if(res != "1"){
                var messageage = "";
                messageage = res.split(',')[1];
                if(res.split(',')[1].slice(-2) == '[]'){
                    messageage = res.split(',')[1].slice(0,-4);
                }else{
                    messageage = res;
                }
                this.showToast(messageage,"error");
            }
        })
    }
    updateRecordView() {
        updateRecord({fields: { Id: this.recordId }});
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
@@ -41,13 +50,6 @@
            variant: type
        });
        this.dispatchEvent(event);
        if(type == 'success'){
            this.updateRecordView();
        }
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    updateRecordView() {
        updateRecord({fields: { Id: this.recordId }});
    }
}
}