liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
}