import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/LexGuaranteeStatuAchievements.init'; export default class lexGuaranteePeriodAlterationApplication extends LightningElement { @api recordId; @api rentalApplyIds; IsLoading=true; //提示信息 msg; hasError; rentalApplyIds; Statu_Achievements__c; connectedCallback(){ init({recordId:this.recordId}).then(res=>{ this.Statu_Achievements__c=res; this.guaranteePeriodAlterationApplication().then(res=>{ this.IsLoading=false; if(this.msg==""){ this.dispatchEvent(new CloseActionScreenEvent()); this.closeAction(); } }) }) } async guaranteePeriodAlterationApplication(){ let hasError ='0'; if (this.Statu_Achievements__c.InstallDate__c != '' && this.Statu_Achievements__c.InstallDate__c !=undefined) { window.history.go(-1); window.open('/apex/AssetGuaranteePeriodAlteration?Statu_AchievementsId='+this.recordId) } else { this.msg='该注残"安装日期"为空,不能进行保修期变更'; hasError='1'; } } closeAction() { window.history.go(-1); } }