123
chenjingwu
2024-04-11 df4601a9026b57f78c0b1b6619e366525d13f9fc
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
@@ -4,17 +4,17 @@
 * @Author: chen jing wu
 * @Date: 2023-03-27 13:53:40
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-04-10 14:22:27
 * @LastEditTime: 2023-05-10 10:21:24
 */
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;
    objectName;
    ownerEmail;
    ownerAlias;
    keyIssue;
@@ -22,9 +22,8 @@
    taskFollow;
    otherIssue;
    nextWeekPlan;
    drSumUrl;
    IsLoading = true;
    url;
    Link;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -32,12 +31,19 @@
            console.log(currentPageReference);
        if (currentPageReference) {
          const urlValue = currentPageReference.state.recordId;
          if (urlValue) {
            let str = `${urlValue}`;
          const urlValue1 = currentPageReference.state.recordId;
          if (urlValue1) {
            let str = `${urlValue1}`;
            console.log("str");
            console.log(str);
            this.recordId = str;
          }
          const urlValue2 = currentPageReference.state.backgroundContext;
          if (urlValue2) {
            let str = `${urlValue2}`;
            console.log("str");
            console.log(str);
            this.Link = str;
          }
        }
    }
@@ -52,15 +58,14 @@
            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.ownerEmail = result.ownerEmail == undefined ? '' : result.ownerEmail;
                this.ownerAlias = result.ownerAlias == undefined ? '' : result.ownerAlias;
                this.keyIssue = result.keyIssue == undefined ? '' : result.keyIssue;
                this.feedBack = result.feedBack == undefined ? '' : result.feedBack;
                this.taskFollow = result.taskFollow == undefined ? '' : result.taskFollow;
                this.otherIssue = result.otherIssue == undefined ? '' : result.otherIssue;
                this.nextWeekPlan = result.nextWeekPlan == undefined ? '' : result.nextWeekPlan;
                this.userEmail = result.userEmail == undefined ? '' : result.userEmail;
                this.createEmail();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
@@ -73,11 +78,10 @@
    }
    createEmail() {
        console.log("start");
       window.location.href = ("mailto:"
        + this.ownerEmail
        window.location.href = ("mailto:"
        + this.ownerEmail
        +"?bcc=" 
        +   this.userEmail
        + this.userEmail
        +"&subject=【周报:" 
        + this.ownerAlias 
        + "】" + "&body=先生/女士" + "%0D%0A" + "%0D%0A" + "主要报告事项:"
@@ -90,8 +94,8 @@
        + this.otherIssue 
        +"%0D%0A" + "下周计划:" 
        + this.nextWeekPlan 
        +"%0D%0A" + "连接:"
        + this.drSumUrl
        +"%0D%0A" + "连接:"  + "%0D%0A"
        + window.location.origin + this.Link
        +"%0D%0A").substring(0,320).split("<br>").join("%0D%0A");
    }
}