import { LightningElement, track, wire, api} from 'lwc'; import LightningConfirm from 'lightning/confirm'; import rentalApplyEquipmentSetReassign from '@salesforce/apex/RentalApplyEquipmentSetWebService.rentalApplyEquipmentSetReassign'; export default class lexReassign extends LightningElement { @api recordId; //只获取当前list选中的一览Id @api rentalApplySetIds; IsLoading=true; IsDisplay=false; IsSuccess=false; //提示信息 msg; successMsg; connectedCallback(){ this.IsLoading=false; if (this.recordId && this.rentalApplySetIds) { this.IsDisplay = false; LightningConfirm.open({ message: '你确定要重新分配吗?', variant: 'headerless', label: 'this is the aria-label value', }).then(res=>{ if(res){ rentalApplyEquipmentSetReassign({ raesID: this.rentalApplySetIds[0] }).then(result=>{ if(result == '1'){ this.IsSuccess=true; this.successMsg = "已重新分配"; setTimeout(() => { this.closeAction(); }, 2000); }else{ this.IsDisplay = true; this.msg = result; return; } }) }else{ this.closeAction(); return; } }) }else{ this.IsDisplay = true; this.msg = "请选择借出备品一览"; return; } } closeAction() { //返回当前的备品申请 window.open("/"+this.recordId,'_self'); } // 20231008 ljh add start closeActionNew() { //返回当前的备品申请 window.open('/lightning/r/Rental_Apply__c/'+this.recordId+'/related/Rental_Apply_Equipment_Set__r/view','_self'); } // 20231008 ljh add end }