buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
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
/*
 * @Description: 
 * @version: 
 * @Author: chen jing wu
 * @Date: 2023-05-16 16:45:16
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-05-18 09:35:45
 */
import { LightningElement,api, track, wire } from 'lwc';
import {CurrentPageReference} from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
 
export default class LexOPDReportFlowLwc extends NavigationMixin(LightningElement) {
    @api recordId;
    @api assetReturnDay2;
    @api demoPurpose2;
    @api followUPOpp;
    @api followUPOppId;
    @api opdPlan;
    @api opdPlanId;
    @api raStatus;
    @api name;
    @api hospitalId;
    @api hospital;
    @api strategicDeptId;
    @api strategicDept;
    @api accountId;
    @api account;
    msg;
    Isloading = true;
    connectedCallback(){
        var status = this.raStatus;
        if(status != "已出库" && status != "申请者已收货" && status != "医院已装机确认" && status != "已回寄" && status != "已回收" && status != "完了" && status != "欠品中"){
            this.msg = "备品借出状态:" + status + ",不能创建报告书!";
            this.Isloading = false;
            return;
        }
 
        //var d = new Date("{!Rental_Apply__c.Asset_return_day2__c}");
        //var d15 = new Date("{!Rental_Apply__c.Asset_return_day2__c}");
        //d15.setDate(d.getDate()+7);
        //if(status == "已回寄" && ( new Date()< d || new Date() > d15)){
        // alert("备品借出状态:" + status + ",但不在回寄日之后7天之内,不能创建报告书!");
        // return;
        //}
        //2021/7/15 fxk Start
        var str;
        var url;
 
        str='&RecordType=01210000000RLTi';
        url = '/a0B/e?retURL=%2Fa0B%2Fo'+str;
 
        //2021/7/15 fxk End
 
        //SWAG-BVW8CW 20201217 让user自己选择recordtype
        //目的2为---试用(有询价) 带询价
        var demo_purpose2 = this.demoPurpose2;
        var strs ;
        if(demo_purpose2=='试用(有询价)'){
            strs='&CF00N10000002DT68=' + this.followUPOpp +
            '&CF00N10000002DT68_lkid=' + this.followUPOppId +
            '&00N10000002DHk5=跟进询价'
        }
        //window.open('/a0B/e?retURL=%2F{!Rental_Apply__c.Id}'+
        //'&RecordType=01210000000Qekj&ent=01I10000000SWfe'+
 
        //Before Update by LiJun 20220321 start
        /*window.open(url +=
        '&CF00N10000004maf3={!Rental_Apply__c.Name}' +
        '&CF00N10000004maf3_lkid={!Rental_Apply__c.Id}' +
        '&CF00N10000002DPUD={!Rental_Apply__c.Hospital__c}'+
        '&CF00N10000002DPUD_lkid={!Rental_Apply__c.HospitalId__c}'+
        '&CF00N10000002Dh0f={!Rental_Apply__c.Strategic_dept__c}' +
        '&CF00N10000002Dh0f_lkid={!Rental_Apply__c.Strategic_deptId__c}'+
        '&CF00N10000008ps6d={!Rental_Apply__c.OPDPlan__c}' +
        '&CF00N10000008ps6d_lkid={!Rental_Apply__c.OPDPlanId__c}'+
        '&CF00N10000002CWW4={!Rental_Apply__c.Account__c}'+
        '&CF00N10000002CWW4_lkid={!Rental_Apply__c.AccountId__c}'+strs)
        }*/
        //Before Update by LiJun 20220321 end
        //After Update by LiJun 20220321 start
        url = url + '&CF00N10000004maf3=' + this.name +
        '&CF00N10000004maf3_lkid=' + this.recordId +
        '&CF00N10000002DPUD=' + this.hospital +
        '&CF00N10000002DPUD_lkid=' + this.hospitalId +
        '&CF00N10000002Dh0f=' + this.strategicDept +
        '&CF00N10000002Dh0f_lkid='+ this.strategicDeptId +
        '&CF00N10000008ps6d=' + this.opdPlan +
        '&CF00N10000008ps6d_lkid=' + this.opdPlanId +
        '&CF00N10000002CWW4=' + this.account +
        '&CF00N10000002CWW4_lkid=' + this.accountId;
        if(strs){
            url= url+strs;
        }
        window.open(url);
        this.closeAction();
        //After Update by LiJun 20220321 end
    }
    closeAction() {
        //返回当前的备品申请
        window.open("/"+this.recordId,'_self');
    }
}