import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForVOCSubmitButton'; import VOCSubmit from '@salesforce/apex/ReportController.updateForVOCSubmitButton'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class LexVOCSubmit extends LightningElement { @api recordId; createdById; status; IsLoading = true; connectedCallback () { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.status = result.status; this.createdById = result.createdById; this.Submit(); this.dispatchEvent(new CloseActionScreenEvent()); this.IsLoading = false; //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 }}); } Submit () { if (this.status != "草案中") { alert("不是草案中不能点击"); return; } VOCSubmit({ recordId: this.recordId, createdById: this.createdById }).then(result =>{ this.updateRecordView(this.recordId); }); } }