import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference, NavigationMixin} from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import splitApplyButton from '@salesforce/apex/LexCancelConsumDetailsCtl.splitApplyButton';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
|
// 耗材备品配套一览 自定义按钮或链接:分单
|
export default class LexSplit_Apply extends NavigationMixin(LightningElement) {
|
@api recordId;
|
//只获取当前list选中的一览Id
|
@api rentalApplyIds;
|
IsLoading=true;
|
//提示信息
|
msg;
|
|
connectedCallback(){
|
console.log(this.recordId);
|
console.log(JSON.stringify(this.rentalApplyIds));
|
if (this.recordId && JSON.stringify(this.rentalApplyIds)) {
|
console.log("-------分单--------",this.rentalApplyIds,JSON.stringify(this.rentalApplyIds))
|
splitApplyButton({
|
recordId: this.recordId
|
}).then(res=>{
|
this.IsLoading = false;
|
console.log("-------分单----1111----",res,res.length);
|
if(res && res.length == 1){
|
this.msg = '这个申请单只有一条耗材备品一览,不能分单';
|
}else if(res.length == this.rentalApplyIds.length){
|
this.msg = '不能全选耗材备品一览分单';
|
}else{
|
window.open("/apex/ConsumApplySplit?objId="+this.recordId+"&raesIds="+this.rentalApplyIds, 'ConsumApplySplit', 'width=800,height=300');
|
this.closeAction();
|
}
|
})
|
|
//
|
}else{
|
this.msg = '请选择耗材备品一览记录';
|
this.IsLoading = false;
|
}
|
}
|
closeAction() {
|
//返回当前的备品申请
|
window.open("/"+this.recordId,'_self');
|
}
|
}
|