unknown
2023-08-24 ddb0231ef7c5cf2bad9d3f1afc2f733674ad38a5
force-app/main/default/lwc/lexNewSparePartsLoanApplication/lexNewSparePartsLoanApplication.js
@@ -18,7 +18,7 @@
            console.log(currentPageReference);
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          let urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            console.log("str");
@@ -47,11 +47,11 @@
                    return;
                }
                // 决裁状态  Approved_Status__c  
                if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!= -1 && result.opdApprovedStatus != '草稿' ){
                if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!== -1 && result.opdApprovedStatus != '草稿' ){
                    this.showToast('已申请决裁但决裁状态不符合条件','warning');
                    return;
                }
                var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}";
                // var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}";
                //    备品借出申请1   Rental_Apply2__c ;  OPD计划来源  OPDType__c
                if (result.opdRentalApply2 != '' && result.opdType != '学会') {
                    this.showToast('一个OPD计划只可关联创建一个备品申请单','warning');
@@ -85,10 +85,10 @@
                        let getCampaignRecodeType = result.opdCampaignTypeId.slice(0,15)
                        console.log("-------opdCampaignRecodeTypeId---2222---------",getCampaignRecodeType,campaignRecodeType);
                        // 职种 Job_Category__c
                        if (campaignRecodeType !== getCampaignRecodeType && res.userJobCategory == '销售服务' ) {
                        if (campaignRecodeType != getCampaignRecodeType && res.userJobCategory == '销售服务' ) {
                            this.showToast('FSE不能申请该学会类型备品','warning');
                            return;
                        } else if ((res.userJobCategory == '销售服务' || res.userJobCategory == '支援') && campaignRecodeType !== getCampaignRecodeType && result.opdInternalinchargeprovince.indexOf(ups) == -1) {
                        } else if ((res.userJobCategory == '销售服务' || res.userJobCategory == '支援') && campaignRecodeType != getCampaignRecodeType && result.opdInternalinchargeprovince.indexOf(ups) == -1) {
                            this.showToast("与FSE所在省一致,才可使用备品",'warning');
                            return;
                        } else if (result.opdCampaignStatus == '已结束') {
@@ -110,16 +110,18 @@
                    // 原OPD计划(再申请)   OriginalOpdPlan__c  原OPD计划(补充申请) OriginalOpdPlanApplication__c
                    if (result.opdOriginalOpdPlan == '') {
                        if (result.opdOriginalOpdPlanApplication == '') {
                            console.log("---------学会-5555--------",result.opdCampaignId);
                            if (result.opdType == '学会' && result.opdCampaignId != '') {
                                console.log("---------学会---------",result.opdCampaignId);
                                // var purposeStr = '&00N10000003Msk0=产品试用' +
                                // '&00N10000003Msk5=学会展会' +
                                // '&CF00N10000003Mp2q_lkid={!URLENCODE(OPDPlan__c.CampaignId__c)}' +
                                // '&CF00N10000003Mp2q={!URLENCODE(OPDPlan__c.CampaignName__c)}';
                                const defaultValues = encodeDefaultFieldValues({
                                let defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'学会展会',
                                    Campaign__c:result.opdCampaign,
                                    Campaign__c:result.opdCampaignId,
                                    Account__c:result.opdAccountLaboratory,
                                    Strategic_dept__c:result.opdOCMcategoryId,
                                    Hospital__c:result.opdHospitalId,
@@ -133,6 +135,7 @@
                                    Approved_State_Create__c:result.ApprovedStatus,
                                    ApprovedNo_Create__c:result.opdApprovedNo
                                });
                                console.log("---------学会---defaultValues------",defaultValues);
                                this.navigateEvents(defaultValues);
                            } else if (result.opdOpportunityId != '') {
                                // 跟进询价ID1
@@ -141,7 +144,7 @@
                                // '&CF00N10000003O3VB_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}' +
                                // '&CF00N10000003O3VB={!HTMLENCODE(OPDPlan__c.Related_Opportunity1_Name__c)}';
                                console.log("--------defaultValues------")
                                const defaultValues = encodeDefaultFieldValues({
                                let defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'试用(有询价)',
@@ -168,7 +171,7 @@
                                // var purposeStr = '&00N10000003Msk0=产品试用' +
                                // '&00N10000003Msk5=试用(无询价)' +
                                // '&00N100000098amW={!OPDPlan__c.NoOpp_Reason__c}';
                                const defaultValues = encodeDefaultFieldValues({
                                let defaultValues = encodeDefaultFieldValues({
                                    // OPDPlan__c:this.recordId,
                                    Demo_purpose1__c:'产品试用',
                                    demo_purpose2__c:'试用(有询价)',
@@ -206,7 +209,7 @@
                            // window.open('/a0t/e?retURL=%2F{!OPDPlan__c.Id}' + purposeStr + urlStr );
                            
                        } else {
                            const defaultValues = encodeDefaultFieldValues({
                            let defaultValues = encodeDefaultFieldValues({
                                // OPDPlan__c:this.recordId,
                                Cancel_Reason__c:'',
                                Loaner_cancel_reason__c:'',
@@ -230,7 +233,7 @@
                        }
                    }else {
                        console.log("-------UserInfo_Owner---00000--else-------");
                        const defaultValues = encodeDefaultFieldValues({
                        let defaultValues = encodeDefaultFieldValues({
                            // OPDPlan__c:this.recordId,
                            Cancel_Reason__c:'',
                            Loaner_cancel_reason__c:'',
@@ -265,7 +268,7 @@
    }
    showToast(message, type) {
        const evt = new ShowToastEvent({
        let evt = new ShowToastEvent({
            // title: 'Error',
            message: message,
            variant: type
@@ -285,6 +288,6 @@
            state:{
                defaultFieldValues: defaultValues
            }
        })
        });
    }
}