| | |
| | | this.IsLoading = false; |
| | | if (result != null) { |
| | | console.log("-------result--------------",JSON.stringify(result)) |
| | | // StayOrNot__c 所有人在离职状态 |
| | | if (result.opdStayOrNot == '已离职') { |
| | | this.showToast('所有人已经离职,请联系系统管理员修改所有人。','error'); |
| | | this.showToast('所有人已经离职,请联系系统管理员修改所有人。','warning'); |
| | | return; |
| | | } |
| | | // IF_Approved__c 是否需要申请决裁 ; Approved_No__c 决裁编码 |
| | | if (result.opdIFApproved == true && result.opdApprovedNo == ''){ |
| | | this.showToast('需要决裁时,决裁编码不能为空','error'); |
| | | return; |
| | | this.showToast('需要决裁时,决裁编码不能为空','warning'); |
| | | return; |
| | | } |
| | | // 决裁状态 Approved_Status__c |
| | | if (result.opdIFApproved == true && result.opdApprovedNo != '' && result.opdStatusProcessState.indexOf(result.opdApprovedStatus)!= -1 && result.opdApprovedStatus != '草稿' ){ |
| | | this.showToast('已申请决裁但决裁状态不符合条件','error'); |
| | | return; |
| | | this.showToast('已申请决裁但决裁状态不符合条件','warning'); |
| | | return; |
| | | } |
| | | var HaveValue = "{!OPDPlan__c.Rental_Apply2__c}"; |
| | | // 备品借出申请1 Rental_Apply2__c ; OPD计划来源 OPDType__c |
| | | if (result.opdRentalApply2 != '' && result.opdType != '学会') { |
| | | this.showToast('一个OPD计划只可关联创建一个备品申请单','error'); |
| | | this.showToast('一个OPD计划只可关联创建一个备品申请单','warning'); |
| | | return; |
| | | } |
| | | // 状态 Status__c |
| | | if (result.opdStatus != '计划中') { |
| | | this.showToast('OPD计划的状态不是计划中,不能新建备品借出申请','error'); |
| | | return; |
| | | this.showToast('OPD计划的状态不是计划中,不能新建备品借出申请','warning'); |
| | | return; |
| | | } |
| | | |
| | | UserInfo_Owner({}).then(res=>{ |
| | | console.log("-------UserInfo_Owner------------",res); |
| | | if(res.isFormalStuff == 'true'){ |
| | | this.showToast('试用期内,不能申请','error'); |
| | | console.log("-------UserInfo_Owner---1111---------",res); |
| | | // 是否在试用期 isFormal_Stuff__c |
| | | if(res.isFormalStuff){ |
| | | this.showToast('试用期内,不能申请','warning'); |
| | | return; |
| | | } |
| | | console.log("-------UserInfo_Owner---1111---------",result); |
| | | |
| | | // 学会 Campaign__c |
| | | if (result.opdType == '学会' && result.opdCampaignId != '') { |
| | | console.log("-------UserInfo_Owner---2222---------"); |
| | | // 提交申请FLG Rental_Apply_Flag__c |
| | | if (result.opdRentalApplyFlag < 7) { |
| | | this.showToast("申请提交必须在7天(含)以上才可以",'error'); |
| | | return; |
| | | this.showToast("申请提交必须在7天(含)以上才可以",'warning'); |
| | | return; |
| | | } |
| | | // userProvince 省 Province__c |
| | | var ups = res.userProvince.slice(0, 2); |
| | | if (result.opdCampaignTypeId != '01210000000R26P' && res.userJobCategory == '销售服务' ) { |
| | | this.showToast('FSE不能申请该学会类型备品','error'); |
| | | return; |
| | | } else if ((res.userJobCategory == '销售服务' || res.userJobCategory == '支援') && result.opdCampaignTypeId == '01210000000R26P' && result.opdInternalinchargeprovince.indexOf(ups) == -1) { |
| | | this.showToast("与FSE所在省一致,才可使用备品",'error'); |
| | | return; |
| | | let campaignRecodeType = result.opdCampaignRecodeTypeId.slice(0,15) |
| | | let getCampaignRecodeType = result.opdCampaignTypeId.slice(0,15) |
| | | console.log("-------opdCampaignRecodeTypeId---2222---------",getCampaignRecodeType,campaignRecodeType); |
| | | // 职种 Job_Category__c |
| | | if (campaignRecodeType !== getCampaignRecodeType && res.userJobCategory == '销售服务' ) { |
| | | this.showToast('FSE不能申请该学会类型备品','warning'); |
| | | return; |
| | | } else if ((res.userJobCategory == '销售服务' || res.userJobCategory == '支援') && campaignRecodeType !== getCampaignRecodeType && result.opdInternalinchargeprovince.indexOf(ups) == -1) { |
| | | this.showToast("与FSE所在省一致,才可使用备品",'warning'); |
| | | return; |
| | | } else if (result.opdCampaignStatus == '已结束') { |
| | | this.showToast("已结束,不能申请",'error'); |
| | | return; |
| | | // 学会状态 CampaignStatus__c |
| | | this.showToast("已结束,不能申请",'warning'); |
| | | return; |
| | | } else if (result.opdCampaignStatus == '已提交报告') { |
| | | this.showToast("已提交报告,不能申请",'error'); |
| | | return; |
| | | this.showToast("已提交报告,不能申请",'warning'); |
| | | return; |
| | | } else if (result.opdCampaignStatus == '取消申请中') { |
| | | this.showToast("取消申请中,不能申请",'error'); |
| | | return; |
| | | this.showToast("取消申请中,不能申请",'warning'); |
| | | return; |
| | | } else if (result.opdCampaignStatus == '取消') { |
| | | this.showToast("已经取消,不能申请",'error'); |
| | | return; |
| | | this.showToast("已经取消,不能申请",'warning'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 原OPD计划(再申请) OriginalOpdPlan__c 原OPD计划(补充申请) OriginalOpdPlanApplication__c |
| | | if (result.opdOriginalOpdPlan == '') { |
| | | if (result.opdOriginalOpdPlanApplication == '') { |
| | | if (result.opdType == '学会' && result.opdCampaignId != '') { |
| | |
| | | demo_purpose2__c:'学会展会', |
| | | Campaign__c:result.opdCampaign, |
| | | Account__c:result.opdAccountLaboratory, |
| | | Strategic_dept__c:result.opdOCMcategoryName, |
| | | Hospital__c:result.opdHospitalName, |
| | | OPDPlan__c:opdName, |
| | | Person_In_Charge__c:res.lastName + res.firstName, |
| | | applyUser__c:res.lastName + res.firstName, |
| | | Strategic_dept__c:result.opdOCMcategoryId, |
| | | Hospital__c:result.opdHospitalId, |
| | | OPDPlan__c:result.opdPlanId, |
| | | Person_In_Charge__c:res.id, |
| | | applyUser__c:res.id, |
| | | Loaner_received_staff__c:res.lastName + res.firstName, |
| | | IsJump__c:result.opdIsJump, |
| | | JumpCause__c:result.opdJumpCause, |
| | |
| | | }); |
| | | this.navigateEvents(defaultValues); |
| | | } else if (result.opdOpportunityId != '') { |
| | | // 跟进询价ID1 |
| | | // var purposeStr = '&00N10000003Msk0=产品试用' + |
| | | // '&00N10000003Msk5=试用(有询价)' + |
| | | // '&CF00N10000003O3VB_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}' + |
| | |
| | | // OPDPlan__c:this.recordId, |
| | | Demo_purpose1__c:'产品试用', |
| | | demo_purpose2__c:'试用(有询价)', |
| | | Follow_UP_Opp__c:result.opdRelatedOpportunity1Name, |
| | | Follow_UP_Opp__c:result.opdRelatedOpportunity1ID, |
| | | |
| | | Account__c:result.opdAccountLaboratory, |
| | | // Strategic_dept__c:result.opdOCMcategoryName, |
| | | // Hospital__c:result.opdHospitalName, |
| | | // OPDPlan__c:opdName, |
| | | // Person_In_Charge__c:res.lastName + res.firstName, |
| | | // applyUser__c:res.lastName + res.firstName, |
| | | // Loaner_received_staff__c:res.lastName + res.firstName, |
| | | // IsJump__c:result.opdIsJump, |
| | | // JumpCause__c:result.opdJumpCause, |
| | | // Name:'*', |
| | | // Approved_State_Create__c:result.ApprovedStatus, |
| | | // ApprovedNo_Create__c:result.opdApprovedNo |
| | | Strategic_dept__c:result.opdOCMcategoryId, |
| | | Hospital__c:result.opdHospitalId, |
| | | OPDPlan__c:result.opdPlanId, |
| | | Person_In_Charge__c:res.id, |
| | | applyUser__c:res.id, |
| | | Loaner_received_staff__c:res.lastName + res.firstName, |
| | | IsJump__c:result.opdIsJump, |
| | | JumpCause__c:result.opdJumpCause, |
| | | Name:'*', |
| | | Approved_State_Create__c:result.ApprovedStatus, |
| | | ApprovedNo_Create__c:result.opdApprovedNo |
| | | }); |
| | | console.log("--------defaultValues---1111---",defaultValues); |
| | | |
| | |
| | | NoOpp_Reason__c:result.opdNoOppReason, |
| | | |
| | | Account__c:result.opdAccountLaboratory, |
| | | Strategic_dept__c:result.opdOCMcategoryName, |
| | | Hospital__c:result.opdHospitalName, |
| | | OPDPlan__c:opdName, |
| | | Person_In_Charge__c:res.lastName + res.firstName, |
| | | applyUser__c:res.lastName + res.firstName, |
| | | Strategic_dept__c:result.opdOCMcategoryId, |
| | | Hospital__c:result.opdHospitalId, |
| | | OPDPlan__c:result.opdPlanId, |
| | | Person_In_Charge__c:res.id, |
| | | applyUser__c:res.id, |
| | | Loaner_received_staff__c:res.lastName + res.firstName, |
| | | IsJump__c:result.opdIsJump, |
| | | JumpCause__c:result.opdJumpCause, |
| | |
| | | |
| | | showToast(message, type) { |
| | | const evt = new ShowToastEvent({ |
| | | title: 'Error', |
| | | // title: 'Error', |
| | | message: message, |
| | | variant: type |
| | | }); |
| | |
| | | }, |
| | | state:{ |
| | | defaultFieldValues: defaultValues |
| | | |
| | | } |
| | | }) |
| | | } |