/*
|
* @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';
|
|
export default class LexCreateNotesEmail extends LightningElement {
|
@api recordId;
|
objectName;
|
ownerEmail;
|
ownerAlias;
|
keyIssue;
|
feedBack;
|
taskFollow;
|
otherIssue;
|
nextWeekPlan;
|
IsLoading = true;
|
Link;
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
console.log(111);
|
console.log(currentPageReference);
|
|
if (currentPageReference) {
|
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(){
|
console.log(this.recordId);
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log(result);
|
if (result != null) {
|
this.IsLoading = false;
|
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());
|
}
|
}).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" + "连接:" + "%0D%0A"
|
+ window.location.origin + this.Link
|
+"%0D%0A").substring(0,320).split("<br>").join("%0D%0A");
|
}
|
}
|