buli
2023-07-14 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * @Description: 
 * @version: 
 * @Author: chen jing wu
 * @Date: 2023-03-27 13:53:40
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-04-10 14:22:27
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import { NavigationMixin } from 'lightning/navigation';
import init  from '@salesforce/apex/MonthlyReportController.initForCreateNoteEmailButton';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
 
export default class LexCreateNotesEmail extends LightningElement {
    @api recordId;
    ownerEmail;
    ownerAlias;
    keyIssue;
    feedBack;
    taskFollow;
    otherIssue;
    nextWeekPlan;
    drSumUrl;
    IsLoading = true;
    url;
 
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
            console.log(111);
            console.log(currentPageReference);
 
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
            console.log("str");
            console.log(str);
            this.recordId = str;
          }
        }
    }
 
 
 
    connectedCallback(){
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result => {
            console.log(result);
            if (result != null) {
                this.IsLoading = false;
                this.ownerEmail = result.ownerEmail;
                this.ownerAlias = result.ownerAlias;
                this.keyIssue = result.keyIssue;
                this.feedBack = result.feedBack;
                this.taskFollow = result.taskFollow;
                this.otherIssue = result.otherIssue;
                this.nextWeekPlan = result.nextWeekPlan;
                this.drSumUrl = result.drSumUrl;
                this.userEmail = result.userEmail;
                this.createEmail();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log("error");
            console.log(error);
        }).finally(() => {
            
        });
    }
    createEmail() {
        console.log("start");
    
       window.location.href = ("mailto:" 
        + this.ownerEmail
        +"?bcc=" 
        +   this.userEmail
        +"&subject=【周报:" 
        + this.ownerAlias 
        + "】" + "&body=先生/女士" + "%0D%0A" + "%0D%0A" + "主要报告事项:"
        + this.keyIssue 
        +"%0D%0A" + "下属事项/状态报告:"
        + this.feedBack 
        +"%0D%0A" + "课题及对应结果/提案:" 
        +  this.taskFollow 
        +"%0D%0A" + "其他事项:" 
        + this.otherIssue 
        +"%0D%0A" + "下周计划:" 
        + this.nextWeekPlan 
        +"%0D%0A" + "连接:" 
        + this.drSumUrl
        +"%0D%0A").substring(0,320).split("<br>").join("%0D%0A");
    }
}