force-app/main/default/classes/MonthlyReportController.cls
New file @@ -0,0 +1,94 @@ public with sharing class MonthlyReportController { @AuraEnabled public static InitData initForCancelSubmitButton (String recordId){ InitData res = new initData(); try{ Monthly_Report__c report = [SELECT OwnerId,Id,Next_week_plan__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; res.OwnerId = report.OwnerId; res.Id = report.Id; res.nextWeekPlan = report.Next_week_plan__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static InitData initForCreateNoteEmailButton (String recordId) { InitData res = new initData(); try{ Monthly_Report__c report = [SELECT Owner_email__c, Owner_alias__c, Key_issue__c, Feedback__c, Task_follow__c, Other_issue__c, Next_week_plan__c, Dr_Sum_URL__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; String userName = UserInfo.getUserName(); User activeUser = [Select Email From User where Username = : userName limit 1]; String userEmail = activeUser.Email; res.ownerEmail = report.Owner_email__c; res.ownerAlias = report.Owner_alias__c; res.keyIssue = report.Key_issue__c; res.feedBack = report.Feedback__c; res.taskFollow = report.Task_follow__c; res.otherIssue = report.Other_issue__c; res.nextWeekPlan = report.Next_week_plan__c; res.drSumUrl = report.Dr_Sum_URL__c; res.userEmail = activeUser.Email; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static void cancel(String recordId) { try { Monthly_Report__c report = [SELECT Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; report.Status__c = '草案中'; report.RecordTypeId = '01210000000Qggf'; report.Submit_check_flag__c = false; report.Submit_time__c = null; update report; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } finally { } } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String OwnerId; @AuraEnabled public String ownerEmail; @AuraEnabled public String ownerAlias; @AuraEnabled public String keyIssue; @AuraEnabled public String feedBack; @AuraEnabled public String taskFollow; @AuraEnabled public String otherIssue; @AuraEnabled public String nextWeekPlan; @AuraEnabled public String drSumUrl; @AuraEnabled public String userEmail; } } force-app/main/default/classes/MonthlyReportController.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.css
New file @@ -0,0 +1,10 @@ .cancelSubmitHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="cancelSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
New file @@ -0,0 +1,70 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/MonthlyReportController.initForCancelSubmitButton'; import cancel from '@salesforce/apex/MonthlyReportController.cancel'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class LexCancelSubmit extends LightningElement { @api recordId;//OwnerId ownerId; monthlyReportId; IsLoading = true; @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.ownerId = result.ownerId; this.monthlyReportId = result.Id; this.cancelSubmit(); console.log("end"); this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Monthly_Report__c/" + this.monthlyReportId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } cancelSubmit () { //需要完善 if(this.ownerId == UserInfo_Owner.Id) { cancel({ recordId: this.recordId }); console.log("321"); } else { alert("只周报的所有人可以取消"); } } } force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.css
New file @@ -0,0 +1,10 @@ .createEmailHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.html
New file @@ -0,0 +1,5 @@ <template> <div class="createEmailHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
New file @@ -0,0 +1,89 @@ 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"); } } force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>