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/lexMeetingCosts/lexMeetingCosts.js                           |   37 ++----------
 force-app/main/default/lwc/lexRepairQuoteForProduct/lexRepairQuoteForProduct.js         |    2 
 force-app/main/default/lwc/lexUpdateTimeReply/lexUpdateTimeReply.js                     |   27 ++------
 force-app/main/default/classes/LexGetUserInfoUtils.cls-meta.xml                         |    5 +
 force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js |    2 
 force-app/main/default/lwc/lexCampaignMemberService/lexCampaignMemberService.js         |   25 +------
 force-app/main/default/classes/LexGetUserInfoUtils.cls                                  |    6 ++
 force-app/main/default/lwc/lexProductRepairQuoteAsset/lexProductRepairQuoteAsset.js     |    2 
 force-app/main/default/lwc/lexNoReportApplication/lexNoReportApplication.js             |   55 ++++++-----------
 9 files changed, 53 insertions(+), 108 deletions(-)

diff --git a/force-app/main/default/classes/LexGetUserInfoUtils.cls b/force-app/main/default/classes/LexGetUserInfoUtils.cls
new file mode 100644
index 0000000..5876f98
--- /dev/null
+++ b/force-app/main/default/classes/LexGetUserInfoUtils.cls
@@ -0,0 +1,6 @@
+public with sharing class LexGetUserInfoUtils {
+    @AuraEnabled
+    public static String getProfileId(){
+        return UserInfo.getProfileId();
+    }   
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexGetUserInfoUtils.cls-meta.xml b/force-app/main/default/classes/LexGetUserInfoUtils.cls-meta.xml
new file mode 100644
index 0000000..70f89f4
--- /dev/null
+++ b/force-app/main/default/classes/LexGetUserInfoUtils.cls-meta.xml
@@ -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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCampaignMemberService/lexCampaignMemberService.js b/force-app/main/default/lwc/lexCampaignMemberService/lexCampaignMemberService.js
index 0b4c097..d03569b 100644
--- a/force-app/main/default/lwc/lexCampaignMemberService/lexCampaignMemberService.js
+++ b/force-app/main/default/lwc/lexCampaignMemberService/lexCampaignMemberService.js
@@ -1,7 +1,4 @@
 import { LightningElement, track, wire,api } from 'lwc';
-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 { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -10,13 +7,13 @@
 	                "鎵瑰噯鍚庝笉鑳芥坊鍔犲弬浼氫汉鍛橈紝濡傞渶娣诲姞璇疯仈绯绘湇鍔′紒鍒掗儴!",
 	                variant : 'error'
 });
+import getProfileId from'@salesforce/apex/LexGetUserInfoUtils.getProfileId';
 import init  from '@salesforce/apex/LexSubmitCampaignController.initMember';
 import getProfileIdByName  from '@salesforce/apex/LexMeetingCostsController.getProfileIdByName';
 export default class lexCampaignMemberService extends LightningElement {
 	@api recordId;
 	IsLoading=true;
 	Campaign;
-	currentUserProfileId;
 
 
 
@@ -31,13 +28,7 @@
         }
     }
 
-	@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 ;
-        }
+    connectedCallback(){
         init({
             recordId: this.recordId
         }).then(result => {
@@ -55,22 +46,16 @@
 	            variant : 'error'
         	});
         	this.dispatchEvent(eventInItError);
-        });        
-    }
-
-
-
-    connectedCallback(){
-
+        });   
 
     }
 
 	async campaignMemberService(){
 		var ProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"}); 
-		console.log(ProfileId);
 		var cstatus = this.Campaign.Status;
+		var  userProfileId = await getProfileId();
 		if (cstatus =='鑽夋涓�' || this.Campaign.ServiceDesignDepId__c == USER_ID
-		|| this.currentUserProfileId == ProfileId ){
+		|| userProfileId == ProfileId ){
 			window.open("/apex/CampaignMemberService?id=" + this.Campaign.Id,'CampaignMember','height=400,width=890,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
 
 		} else {
diff --git a/force-app/main/default/lwc/lexMeetingCosts/lexMeetingCosts.js b/force-app/main/default/lwc/lexMeetingCosts/lexMeetingCosts.js
index 84f94e2..0a0ae37 100644
--- a/force-app/main/default/lwc/lexMeetingCosts/lexMeetingCosts.js
+++ b/force-app/main/default/lwc/lexMeetingCosts/lexMeetingCosts.js
@@ -1,11 +1,7 @@
 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/LexMeetingCostsController.init';
 import judgeMember  from '@salesforce/apex/LexMeetingCostsController.judgeMumber';
 import getProfileIdByName  from '@salesforce/apex/LexMeetingCostsController.getProfileIdByName';
@@ -23,7 +19,6 @@
     Campaign;
     IsLoading = true;
     userId = USER_ID;
-    currentUserProfileId;
     NotSupportProfileId;
 
     @wire(CurrentPageReference)
@@ -37,14 +32,9 @@
         }
     }
 
-     @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 ;
-            }
+
+
+    connectedCallback(){
         init({
             recordId: this.recordId
         }).then(result => {
@@ -55,31 +45,16 @@
                 console.log(this.userId);
                 this.MeetingCosts();
             }
-        }).catch(error => {
-            console.log("error");
-            console.log(error);
-        });            
-    }
-
-
-
-    connectedCallback(){
-
-
+        });
     }
 
 
 
     async MeetingCosts(){
-
     	var logUser = this.userId;
-
     	var records = await judgeMember({ UserId : this.userId});
-
     	var ProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"}); 
-
-
-
+        var userProfileId = await getProfileId();
     	if(records.length>0 && this.Campaign.Sponsor_Ones_Post__c == '1.鍗庡寳'){
 		window.open("/apex/CampaignMeetingcost?id=" + this.Campaign.Id ,'CampaignMember','height=500,width=950');
 		}
@@ -87,7 +62,7 @@
 			|| logUser == this.Campaign.JingliApprovalManager__c 
 			|| logUser == this.Campaign.BuchangApprovalManager__c 
 			|| logUser == this.Campaign.ZongjianApprovalManager__c  
-			|| this.currentUserProfileId == ProfileId){
+			|| userProfileId == ProfileId){
 		window.open("/apex/CampaignMeetingcost?id=" + this.Campaign.Id ,'CampaignMember','height=500,width=950');
 		}
 		else {
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');    	
     	}
     }
 
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteAsset/lexProductRepairQuoteAsset.js b/force-app/main/default/lwc/lexProductRepairQuoteAsset/lexProductRepairQuoteAsset.js
index 01c253b..31e3de4 100644
--- a/force-app/main/default/lwc/lexProductRepairQuoteAsset/lexProductRepairQuoteAsset.js
+++ b/force-app/main/default/lwc/lexProductRepairQuoteAsset/lexProductRepairQuoteAsset.js
@@ -36,7 +36,7 @@
 
     
 	async ProductRepairQuoteAsset(){
-	  window.open ('/apex/ProductRepairQuote?productid='+this.recordId+'&flag=asset', '', 'height=250, width=500, top=300, left=350,location=no')
+	  window.open ('/apex/ProductRepairQuote?productid='+this.recordId+'&flag=asset', '', 'height=380, width=680, top=300, left=350,location=no')
 	}
 
 	closeScreen(){
diff --git a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
index 3f6644a..afb81c3 100644
--- a/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
+++ b/force-app/main/default/lwc/lexProductRepairQuoteProduct/lexProductRepairQuoteProduct.js
@@ -34,7 +34,7 @@
 
     async productRepairQuoteProduct(){  	
     	window.open ('/apex/ProductRepairQuote?productid=' + this.recordId +
-    		'&flag=productsearch', '', 'height=500, width=1200, top=300, left=350,location=no');   
+    		'&flag=productsearch', '', 'height=380, width=680, top=300, left=350,location=no');   
     }
 
 
diff --git a/force-app/main/default/lwc/lexRepairQuoteForProduct/lexRepairQuoteForProduct.js b/force-app/main/default/lwc/lexRepairQuoteForProduct/lexRepairQuoteForProduct.js
index 068c05c..489ea03 100644
--- a/force-app/main/default/lwc/lexRepairQuoteForProduct/lexRepairQuoteForProduct.js
+++ b/force-app/main/default/lwc/lexRepairQuoteForProduct/lexRepairQuoteForProduct.js
@@ -34,7 +34,7 @@
 
     
 	async ProductRepairQuote(){
-	window.open ('/apex/ProductRepairQuote?productid='+this.recordId+'&flag=product', '', 'height=250, width=500, top=300, left=350,location=no')
+	window.open ('/apex/ProductRepairQuote?productid='+this.recordId+'&flag=product', '', 'height=380, width=680, top=300, left=350,location=no')
 	}
 
 	closeScreen(){
diff --git a/force-app/main/default/lwc/lexUpdateTimeReply/lexUpdateTimeReply.js b/force-app/main/default/lwc/lexUpdateTimeReply/lexUpdateTimeReply.js
index 7dba725..6bc992a 100644
--- a/force-app/main/default/lwc/lexUpdateTimeReply/lexUpdateTimeReply.js
+++ b/force-app/main/default/lwc/lexUpdateTimeReply/lexUpdateTimeReply.js
@@ -1,7 +1,4 @@
 import { LightningElement, track, wire,api } from 'lwc';
-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 { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
@@ -22,7 +19,6 @@
 	@api recordId;
 	IsLoading=true;
 	Campaign;
-	currentUserProfileId;
 
 	@wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -35,13 +31,11 @@
         }
     }
 
-	@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 ;
-        }
+
+
+
+
+    connectedCallback(){
         init({
             recordId: this.recordId
         }).then(result => {
@@ -59,13 +53,7 @@
 	            variant : 'error'
         	});
         	this.dispatchEvent(eventInItError);
-        });        
-    }
-
-
-
-    connectedCallback(){
-
+        });   
 
     }
 
@@ -73,8 +61,9 @@
     	var ProfileId= await getProfileIdByName({Name : "绯荤粺绠$悊鍛�"}); 
 		var cstatus = this.Campaign.Status_Service__c;
 		var Service = this.Campaign.ServiceDesignDep__c;
+		var  userProfileId = await getProfileId();
 		if (cstatus =='寮�鐝澶囦腑' || cstatus =='寮�鐝腑' || Service == USER_ID ||
-		this.currentUserProfileId == ProfileId
+		userProfileId == ProfileId
 		){
 			window.open("/apex/DateModify?id=" + this.Campaign.Id,'鏃堕棿淇敼鐢宠椤甸潰','height=500, width=900, top=0, left=0');
 		} else if(cstatus =='鍟嗚皥涓�') {

--
Gitblit v1.9.1