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 | 30 ++++++++----------------------
1 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
index 5333b66..d7500af 100644
--- a/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
+++ b/force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js
@@ -1,18 +1,16 @@
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({
- title: '妫�鏌ョ姸鎬�',
message:
'鍙湁鐘舵�佷负寰呮彁浜ゆ姤鍛婄殑OPD璁″垝鎵嶈兘杩涜鏃犳姤鍛婄敵璇�',
+ variant: 'error'
});
export default class lexNoReportApplication extends LightningElement {
@@ -20,22 +18,12 @@
@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) {
@@ -44,15 +32,14 @@
if (urlValue) {
let str = `${urlValue}`;
this.recordId = str;
-
}
}
}
- async connectedCallback(){
- await init({
+ connectedCallback(){
+ init({
recordId: this.recordId
}).then(result=>{
this.OPDPlan__c=result;
@@ -76,8 +63,8 @@
//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);
@@ -85,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