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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * @Description: 分配画面(办事处)
 * @Author: [lijinhuan]
 * @Date: 2023-08-14 22:10:50
 * @LastEditors: [lijinhuan]
 * @LastEditTime: 2023-10-07 10:41:48
 */
import { LightningElement, track, wire, api } from 'lwc';
import init from '@salesforce/apex/lexRentalFixtureSetAssignController.init';
import assignBtn from '@salesforce/apex/RentalApplyWebService.AssignBtn';
 
import TradeComplianceStatusFlagBP from '@salesforce/label/c.TradeComplianceStatusFlagBP';
import IFTradeComplianceAlertBP from '@salesforce/label/c.IFTradeComplianceAlertBP';
import IFTradeComplianceAlert2 from '@salesforce/label/c.IFTradeComplianceAlert2';        //20240121 sx 贸易合规二期冻结名单和黑名单拆开 add
import IFTradeComplianceAlert from '@salesforce/label/c.IFTradeComplianceAlert';
import tradeTempleSend from '@salesforce/apex/SendEmailUtil.tradeTempleSend';        //贸易合规二期 发邮件20240201
 
export default class lexRentalFixtureSetAssignAgency extends LightningElement {
    @api recordId
    msg;
    IsLoading = true;
    isShow = false;
    ifShow = false;        //20240121 sx  贸易合规二期提示 add
 
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result=>{
            this.IsLoading = false;
            if(result){
                let res = result.ra;
                console.log(res);
 
                if(TradeComplianceStatusFlagBP){
                    // if(res.AccDealerBlacklist__c == '1'){
                    //     this.IsShow = true;
                    //     this.msg = IFTradeComplianceAlertBP;
                    //     return;
                    // }
                    //20240121  sx 贸易合规二期冻结名单和黑名单拆开 add start
                    //冻结
                    if(res.AccDealerBlacklist2__c == '1'){
                        tradeTempleSend({rentalId: this.recordId, stepName:'办事处分配'});    //贸易合规二期 发邮件20240201
                        this.ifShow = true;
                        this.msg = '医院在冻结清单中,可能存在贸易合规风险,目前正在评估中(一般需5-10个工作日),暂时无法分配,' + IFTradeComplianceAlert;
                        return;
                    }
                    //黑名单
                    if(res.AccDealerBlacklist2__c == '3'){
                        tradeTempleSend({rentalId: this.recordId, stepName:'办事处分配'});    //贸易合规二期 发邮件20240201
                        this.ifShow = true;
                        this.msg = '医院在黑名单中,存在贸易合规风险,无法分配,' + IFTradeComplianceAlert;
                        return;
                    }
                    //20240121  sx 贸易合规二期冻结名单和黑名单拆开 add end
                }
                // 20231007 ljh 注释 start
                // if(res.Campaign__c != '' || res.Campaign__c != undefined){
                //     if(res.CampaignStatus == '取消'){
                //         this.isShow = true;
                //         this.msg = '学会取消,不可分配';
                //         return;
                //     }
                // }
 
                // if(res.Repair__c != '' || res.Repair__c != undefined){
                //     if(res.Repair_Final_Inspection_Date_F__c != null && res.Repair_Final_Inspection_Date_F__c !='' 
                //             || (res.RC_return_to_office__c!=null && res.RC_return_to_office__c != '')){
                //         this.isShow = true;
                //         this.msg = '修理有最终检测日或修理品返送日,不可分配';
                //         return;
                //     }
                // }
                // 20231007 ljh 注释 end
                assignBtn({
                    Rid: this.recordId
                }).then(resultMsg => {
                    if(res.Status__c == '取消' && res.Rental_Apply_Equipment_Set_Cnt__c != 0){
                        window.open("/apex/RentalFixtureSetAssignAgency?pt_recid=" + this.recordId); 
                        this.closeAction();
                    }else if((res.demo_purpose2__c == '学会展会' || res.demo_purpose2__c == '课题研究' || res.demo_purpose2__c == '培训中心')&& res.Status__c == '草案中'){
                        this.isShow = true;
                        this.msg = "不能分配,请确认申请的状态";
                        return
                    }else if((res.demo_purpose2__c =='试用(无询价)' || res.demo_purpose2__c == '试用(有询价)' || res.demo_purpose2__c =='动物实验' || 
                        res.demo_purpose2__c == '一般维修代用' || res.demo_purpose2__c== '保修合同用户维修代用' || res.demo_purpose2__c == '已购待货') 
                    && res.Status__c != '已批准' && res.Status__c != '已出库指示'){
                        this.isShow = true;
                        this.msg = "不能分配,请确认申请的状态";
                        return;
                    }else if(resultMsg == 'Fin'){
                        window.open("/apex/RentalFixtureSetAssignAgency?pt_recid=" + this.recordId); 
                        this.closeAction();
                        return;
                    }else{
                        this.isShow = true;
                        this.msg = resultMsg;
                        return;
                    }
                })
            }
        })
        .catch(err=>{
            console.log('initErr==='+err);
        })
    }
 
    closeAction() {
        //返回当前的备品申请
        window.open("/"+this.recordId,'_self');
    }
}