KKbes
2023-06-28 d5d810af942c23a1009857477a545a9a2dc134b5
force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
@@ -18,8 +18,7 @@
   @api recordId;
    IsLoading=true;
   OPDPlan__c;
    currentUserProfileId;
    error;
@@ -53,39 +52,42 @@
    
    async connectedCallback(){
       await init({
        await init({
            recordId: this.recordId
        }).then(result=>{
            this.OPDPlan__c=result;
            this.NoReportApplication();
            this.NoReportApplication().then(result=>{
                this.IsLoading=false;
                this.dispatchEvent(new CloseActionScreenEvent());
            });
        }).catch(error=>{
            console.log("error");
            console.log(error);
            const eventError = new ShowToastEvent({
                title: '页面初始化错误',
                message:
                error.message,
            });
            this.dispatchEvent(eventError);
        });
    }
    async NoReportApplication() {
   //OPD计划状态
   var status = this.OPDPlan__c.Status__c;
   this.NotSupportProfileId= await getProfileIdByName({Name : "系统管理员"});
   //当前用户简档id
   var ProfileId = this.currentUserProfileId;
   //跳过系统管理员
   if(status !='待提交报告'&& ProfileId != this.NotSupportProfileId){
      this.dispatchEvent(new CloseActionScreenEvent());
      this.dispatchEvent(event);
      return;
   }
   else{
      this.dispatchEvent(new CloseActionScreenEvent());
      window.open ('/apex/OPDNoReportApplication?id='+this.OPDPlan__c.Id+'&name='+this.OPDPlan__c.Name, '无报告申请',
      'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
   }
   }
       //OPD计划状态
       var status = this.OPDPlan__c.Status__c;
       this.NotSupportProfileId= await getProfileIdByName({Name : "系统管理员"});
       //当前用户简档id
       var ProfileId = this.currentUserProfileId;
       //跳过系统管理员
       if(status !='待提交报告'&& ProfileId != this.NotSupportProfileId){
          this.dispatchEvent(event);
          return;
       }
       else{
          window.open ('/apex/OPDNoReportApplication?id='+this.OPDPlan__c.Id+'&name='+this.OPDPlan__c.Name, '无报告申请',
          'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
       }
    }
}