| force-app/main/default/classes/LexNoReportApplicationController.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/classes/LexNoReportApplicationController.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
force-app/main/default/classes/LexNoReportApplicationController.cls
New file @@ -0,0 +1,28 @@ // with lwc lexNoReportApplication //author kkbes public class LexNoReportApplicationController { @AuraEnabled public static OPDPlan__c initGetOpdData(String recordId){ OPDPlan__c res = new OPDPlan__c(); try { OPDPlan__c report = [select Id,Name,Status__c from OPDPlan__c where Id = :recordId]; res=report; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String getProfileIdByName(String Name){ Profile profile = null; try { profile = [select Id from Profile where Name =:name]; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return profile.Id; } } force-app/main/default/classes/LexNoReportApplicationController.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>51.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.html
New file @@ -0,0 +1,3 @@ <template> </template> force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
New file @@ -0,0 +1,91 @@ import { LightningElement ,api, track, wire } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { getRecord } from 'lightning/uiRecordApi'; import USER_ID from '@salesforce/user/Id'; import USERPROFILE_ID from '@salesforce/schema/User.ProfileId'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from'@salesforce/apex/LexNoReportApplicationController.initGetOpdData'; import getProfileIdByName from'@salesforce/apex/LexNoReportApplicationController.getProfileIdByName'; import { CloseActionScreenEvent } from 'lightning/actions'; const event = new ShowToastEvent({ title: '检查状态', message: '只有状态为待提交报告的OPD计划才能进行无报告申请', }); export default class lexNoReportApplication extends LightningElement { @api recordId; OPDPlan__c; currentUserProfileId; error; NotSupportProfileId; @wire(getRecord, { recordId: USER_ID, fields: [USERPROFILE_ID]}) userDetails({error, data}) { if (data) { this.currentUserProfileId = data.fields.ProfileId.value; } else if (error) { this.error = error ; } } @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } async connectedCallback(){ await init({ recordId: this.recordId }).then(result=>{ this.OPDPlan__c=result; this.NoReportApplication(); }).catch(error=>{ console.log("error"); console.log(error); }); } async NoReportApplication() { //OPD计划状态 var status = this.OPDPlan__c.Status__c; this.NotSupportProfileId= await getProfileIdByName({Name : "系统管理员"}); //当前用户简档id var ProfileId = this.currentUserProfileId; //跳过系统管理员 if(status !='待提交报告'&& ProfileId != this.NotSupportProfileId){ this.dispatchEvent(new CloseActionScreenEvent()); this.dispatchEvent(event); return; } else{ this.dispatchEvent(new CloseActionScreenEvent()); window.open ('/apex/OPDNoReportApplication?id='+this.OPDPlan__c.Id+'&name='+this.OPDPlan__c.Name, '无报告申请', 'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no'); } } } force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.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" fqn="lexNoReportApplication"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>