From a099abe8d0ff0699296c9bcc53ca00b98d167c73 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期一, 15 四月 2024 10:42:09 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js |   39 ++++++++++++++++++++++++++++-----------
 1 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
index 1356a5d..5d71c9b 100644
--- a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
@@ -8,6 +8,8 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import getUserIdByName from '@salesforce/apex/ReportController.getUserIdByName';
 import getProfileIdByName from '@salesforce/apex/ReportController.getProfileIdByName';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
 export default class LexVOCCheck extends LightningElement {
     
     @api recordId;
@@ -18,7 +20,7 @@
     userId;
     systemProfileId;
     luShengId;
-    huDiAnId;
+    // huDiAnId;
     Isloading = true;
 
     @wire(CurrentPageReference)
@@ -39,6 +41,9 @@
 
 
     connectedCallback(){
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
         console.log(this.recordId);
         init({
             recordId: this.recordId
@@ -52,7 +57,7 @@
                 this.profileId = result.profileId;
                 this.systemProfileId = result.systemProfileId;
                 this.luShengId = result.luShengId;
-                this.huDiAnId = result.huDiAnId;
+                // this.huDiAnId = result.huDiAnId;
                 console.log(this.status); 
                 this.check();
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
@@ -68,14 +73,24 @@
         updateRecord({fields: { Id: recordId }});
     }
 
-    showToast(msg, type) {
-        const event = new ShowToastEvent({
-          title: "",
-          message: msg,
-          variant: type
-        });
-        this.dispatchEvent(event);
-      }
+    showToast(msg,type) {
+        if(type == 'success'){
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }else{
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+                mode: 'sticky'
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }   
+    }
     getUserId(userName){
         getUserIdByName({
             name : userName
@@ -92,7 +107,8 @@
     }
     check (){
         // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳鍙偣(闇�瑕佽皟鏁�)
-        if (this.userId != this.luShengId && this.userId != this.huDiAnId && this.profileId != this.systemProfileId) {
+        // && this.userId != this.huDiAnId 鑳¤开瀹夊凡绂昏亴
+        if (this.userId != this.luShengId && this.profileId != this.systemProfileId) {
                 this.showToast("浣犳病鏈夊垽瀹歏OC鐨勬潈闄�","error");
                 this.dispatchEvent(new CloseActionScreenEvent());
                 return;
@@ -118,6 +134,7 @@
                     this.showToast(result,"error");
                 }else{
                     this.updateRecordView(this.recordId);
+                    console.log("success");
                 }
                 this.Isloading = false;   
                 this.dispatchEvent(new CloseActionScreenEvent());

--
Gitblit v1.9.1