KKbes
2023-08-11 f66abb6dad1b8caa18aca9d65dceb34a34c022b6
force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
@@ -1,12 +1,10 @@
import { LightningElement ,api, track, wire } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { getRecord } from 'lightning/uiRecordApi';
import USER_ID from '@salesforce/user/Id';
import USERPROFILE_ID from '@salesforce/schema/User.ProfileId';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from'@salesforce/apex/LexNoReportApplicationController.initGetOpdData';
import getProfileIdByName from'@salesforce/apex/LexNoReportApplicationController.getProfileIdByName';
import getProfileId from'@salesforce/apex/LexGetUserInfoUtils.getProfileId';
import { CloseActionScreenEvent } from 'lightning/actions';
 const event = new ShowToastEvent({
@@ -20,21 +18,27 @@
   @api recordId;
    IsLoading=true;
   OPDPlan__c;
    currentUserProfileId;
    error;
    NotSupportProfileId;
    @wire(getRecord, { recordId: USER_ID, fields: [USERPROFILE_ID]})
        userDetails({error, data}) {
            if (data) {
                this.currentUserProfileId = data.fields.ProfileId.value;
               
            } else if (error) {
                this.error = error ;
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
            }
         }
     }
    connectedCallback(){
        init({
            recordId: this.recordId
        }).then(result=>{
@@ -53,24 +57,6 @@
        });
    }
    @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
         if (currentPageReference) {
           const urlValue = currentPageReference.state.recordId;
           if (urlValue) {
             let str = `${urlValue}`;
             this.recordId = str;
           }
         }
     }
    connectedCallback(){
    }
    async NoReportApplication() {
@@ -78,7 +64,7 @@
       var status = this.OPDPlan__c.Status__c;
       this.NotSupportProfileId= await getProfileIdByName({Name : "系统管理员"});
       //当前用户简档id
       var ProfileId = this.currentUserProfileId;
        var ProfileId = await getProfileId();
       //跳过系统管理员
       if(status !='待提交报告'&& ProfileId != this.NotSupportProfileId){
          this.dispatchEvent(event);   
@@ -87,7 +73,6 @@
       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');
       }
    }