1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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);
    }
 
}