liangxiaozhen
2023-08-06 1d17c4022a928eacff7309016cde76f29ad257fb
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import init from '@salesforce/apex/HosipitalToDeptController.init';
import submitApproval from '@salesforce/apex/AddSubmitApprovalProcessController.submitApproval';
 
export default class LexSubmitAndRefreshAccount extends LightningElement {
    @api recordId;
    IsLoading=true;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference){
        console.log("进入页面");
        console.log(currentPageReference);
        if(currentPageReference){
            const urvalue=currentPageReference.state.recordId;
            if(urvalue){
                let str=`${urvalue}`;
                console.log('str');
                console.log(str);
                this.recordId=str;
            }
        }
    }
 
    connectedCallback(){
        init({recordId:this.recordId}).then(res => {
            console.log(res,'<========res')
            if(res.GiMain == ''){
                this.showToast('请填写GI主担当','error');
            }else if(res.BFowner == ''){
                this.showToast('请填写BF主担当','error');
            }else if(res.ETowner == ''){
                this.showToast('请填写ET主担当','error');
            }else if(res.SPMain == ''){
                this.showToast('请填写GS主担当','error');
            }else if(res.UROownerID == ''){
                this.showToast('请填写URO主担当','error');
            }else if(res.GYNowner == ''){
                this.showToast('请填写GYN主担当','error');
            }else if(res.ENTownerID == ''){
                this.showToast('请填写ENT主担当','error');
            }
            if('{!Account.Tender_information__c}' !=''){
 
            }else if (res.Isuploadfile == '0' || res.Isuploadfile == false) {
                this.showToast('请上传医院信息附件','error');
                return;
            }
            var accname=res.Name.substr(-2,2);
            if((accname =='公司' || accname =='集团') && res.AttributeType !='企业集团'){
                this.showToast('客户为公司或集团,医院性质不是企业集团,请核实医院性质,确认是否提交?','success');
            }
            if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
                return;
            }
            submitApproval({recordId:this.recordId}).then(rep => {
                console.log(rep,'<========result')
            }).catch(err => {
                this.showToast(err,'error')
            })
            this.dispatchEvent(new CloseActionScreenEvent());
        })
    
    }
    showToast(msg, type) {
        const event = new ShowToastEvent({
          message: msg,
          variant: type
        });
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
}