1
chenjingwu
2024-05-24 5d1cb2d71659c3d6ab85378f6f7b4346b50a8554
force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
@@ -1,12 +1,20 @@
/*
 * @Description:
 * @version:
 * @Author: chen jing wu
 * @Date: 2023-03-27 13:53:40
 * @LastEditors: chen jing wu
 * @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;
@@ -14,9 +22,8 @@
    taskFollow;
    otherIssue;
    nextWeekPlan;
    drSumUrl;
    IsLoading = true;
    url;
    Link;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -24,15 +31,23 @@
            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;
          }
        }
    }
    connectedCallback(){
@@ -43,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());
            }
@@ -64,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" + "主要报告事项:"
@@ -81,9 +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");
    }
}