unknown
2023-08-23 dfff58b7cd897b824a129edba6b5cdae20bb1e5c
force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
@@ -3,6 +3,7 @@
import { CloseActionScreenEvent } from 'lightning/actions';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { updateRecord } from 'lightning/uiRecordApi';
import queueTop from '@salesforce/apex/ApplyJsCtl.queueTop';
export default class lexTopInQueue extends LightningElement {
@@ -25,25 +26,32 @@
      queueTop({
         applyId: this.recordId
      }).then(res=>{
         this.IsLoading = false;
         if(res == 'Success'){
            const evt = new ShowToastEvent({
                        title : '置顶成功',
                        message: '',
                        variant: 'success'
                    });
                this.dispatchEvent(evt);
                this.dispatchEvent(new CloseActionScreenEvent());
            this.showToast('置顶成功','success');
            return;
         }else{
            const evterr = new ShowToastEvent({
                        title : res,
                        message: '',
                        variant: 'error'
                    });
                this.dispatchEvent(evterr);
                this.dispatchEvent(new CloseActionScreenEvent());
            this.showToast(res,'error');
            return;
         }
      }).catch(err=>{
         this.dispatchEvent(new CloseActionScreenEvent());
      })
   }
   showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        if(type == 'success'){
            this.updateRecordView(this.recordId);
        }
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
}