yumenghui
2023-08-11 d533f39b6fa798e238810d17e928dee75d5b1af7
force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
@@ -6,7 +6,8 @@
import VOCCheck  from '@salesforce/apex/ReportController.updateForVOCCheckButton';
import { updateRecord } from 'lightning/uiRecordApi';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import getUserIdByName from '@salesforce/apex/ReportController.getUserIdByName';
import getProfileIdByName from '@salesforce/apex/ReportController.getProfileIdByName';
export default class LexVOCCheck extends LightningElement {
    
    @api recordId;
@@ -14,6 +15,10 @@
    isVOC;
    personId;
    profileId;
    userId;
    systemProfileId;
    luShengId;
    huDiAnId;
    Isloading = true;
    @wire(CurrentPageReference)
@@ -40,11 +45,14 @@
        }).then(result => {
            console.log(result);
            if (result != null) {  
                this.userId = result.userId;
                this.status = result.status;
                this.isVOC = result.isVOC;
                this.personId = result.personId;
                this.profileId = result.profileId;
                this.systemProfileId = result.systemProfileId;
                this.luShengId = result.luShengId;
                this.huDiAnId = result.huDiAnId;
                console.log(this.status); 
                this.check();
                //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
@@ -68,10 +76,23 @@
        });
        this.dispatchEvent(event);
      }
    getUserId(userName){
        getUserIdByName({
            name : userName
        }).then(reuslt=>{
            return reuslt;
        });
    }
    getProfileId(profileName){
        getProfileIdByName({
            name : profileName
        }).then(reuslt=>{
            return reuslt;
        });
    }
    check (){
        // 陆胜,胡迪安,系统管理员可点(需要调整)
        if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
        if (this.userId != this.luShengId && this.userId != this.huDiAnId && this.profileId != this.systemProfileId) {
                this.showToast("你没有判定VOC的权限","error");
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
@@ -96,7 +117,6 @@
                if(result){
                    this.showToast(result,"error");
                }else{
                    this.showToast("成功","success");
                    this.updateRecordView(this.recordId);
                }
                this.Isloading = false;