import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForVOCCheckButton'; import VOCCheck from '@salesforce/apex/ReportController.updateForVOCCheckButton'; import { updateRecord } from 'lightning/uiRecordApi'; export default class LexVOCCheck extends LightningElement { @api recordId; status; isVOC; personId; profileId; Isloading = true; connectedCallback(){ console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.Isloading = false; this.status = result.status; this.isVOC = result.isVOC; this.personId = result.personId; this.profileId = result.profileId; console.log(this.status); this.check(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); this.updateRecordView(this.recordId); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } check (){ // 陆胜,胡迪安,系统管理员可点(需要调整) if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") { alert("你没有判定VOC的权限"); return; } if (this.status != "跟进中") { alert("不是跟进中不能点击"); return; } if (this.isVOC == undefined) { alert("必须选择是否VOC"); return; } VOCCheck( { recordId:this.recordId, isVOC:this.isVOC, personId:this.personId } ).then(result =>{ if(result == null){ this.updateRecordView(this.recordId); }else { alert(result); } }); //location.reload(); } }