| | |
| | | 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 { |
| | |
| | | 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 }}); |
| | | } |
| | | } |