liangxiaozhen
2023-08-08 c69e36a64e4954b0b7e818843e8a833b3201ec29
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
import { LightningElement,wire,track,api} from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import { updateRecord } from 'lightning/uiRecordApi';
import { refreshPage } from 'lightning/navigation';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 
export default class lexNewOnCall extends LightningElement {
    @api recordId;
    resultId;
    @track messages = [];
    isLoading = false;
    activeSections = ['special', 'newmod', 'assinfo', 'descr', 'createinfo', 'info'];
    btntable;
 
 
 
    // EditButton(isDisabled){
 //            if (isDisabled) {
 //                this.btntable = true;
 //            }else {
 //                this.btntable = false;
 //            }
 //    }
 
    get hasMessages() {
        return this.messages.length > 0;
      }
      handleSuccess(event){
          console.log('成功啦');
          this.resultId = event.detail.id;
          console.log('this.resultId='+this.resultId);
          if (this.resultId !=null) {
                this.isLoading = false;
          }
      }
      handleSubmit(event) {
          console.log('提交啦');
          this.isLoading = true;
        event.preventDefault();
        const fields = event.detail.fields;
        this.template.querySelector('lightning-record-edit-form').submit(fields);
      }
 
      handleError(event) {
          console.log('出错啦');
        const error = event.detail;
        const toastEvent = new ShowToastEvent({
          title: 'Error',
          message: error.body.message,
          variant: 'error',
        });
        this.dispatchEvent(toastEvent);
        // this.isLoading = false;
      }
    // saveOnCallProcess(saveMode) {
    //         EditButton(true);
    //         redirectMode = saveMode;
    //         console.log('redirectMode' + redirectMode);
    //         this.messages = [];
    //         //1. Get onCall Information from Form
    //         let onCallJson = getOnCallInformation();
           
    //         //3. Prepare the payload for New PI API To AWS - To Do
    //         let payloadForNewPI = getPIPayload(onCallJson);
 
    //         //4. onCall to AWS 
    //         ProcessPI(onCallJson, payloadForNewPI);
    //     }
}