From f66abb6dad1b8caa18aca9d65dceb34a34c022b6 Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期五, 11 八月 2023 11:42:16 +0800
Subject: [PATCH] review
---
force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js | 55 ++++++++++++++++++++-----------------------------------
1 files changed, 20 insertions(+), 35 deletions(-)
diff --git a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
index fb2e2d7..d7500af 100644
--- a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
+++ b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
@@ -1,12 +1,10 @@
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 getProfileId from'@salesforce/apex/LexGetUserInfoUtils.getProfileId';
import { CloseActionScreenEvent } from 'lightning/actions';
const event = new ShowToastEvent({
@@ -20,21 +18,27 @@
@api recordId;
IsLoading=true;
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;
+ }
+ }
+ }
+
+
+
+ connectedCallback(){
init({
recordId: this.recordId
}).then(result=>{
@@ -53,32 +57,14 @@
});
}
- @wire(CurrentPageReference)
- getStateParameters(currentPageReference) {
- if (currentPageReference) {
- const urlValue = currentPageReference.state.recordId;
- if (urlValue) {
- let str = `${urlValue}`;
- this.recordId = str;
-
- }
- }
- }
-
-
-
- connectedCallback(){
-
- }
-
async NoReportApplication() {
//OPD璁″垝鐘舵��
var status = this.OPDPlan__c.Status__c;
this.NotSupportProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"});
- //褰撳墠鐢ㄦ埛绠�妗d
- var ProfileId = this.currentUserProfileId;
+ //褰撳墠鐢ㄦ埛绠�妗d
+ var ProfileId = await getProfileId();
//璺宠繃绯荤粺绠$悊鍛�
if(status !='寰呮彁浜ゆ姤鍛�'&& ProfileId != this.NotSupportProfileId){
this.dispatchEvent(event);
@@ -86,8 +72,7 @@
}
else{
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');
-
+ 'height=400, width=700, top=200, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no');
}
}
--
Gitblit v1.9.1