From 8d006ac357a60d77f086c37f2ae7338530a607f2 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 15:30:55 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/lexRequestDB/lexRequestDB.js |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
index ac5c4e2..605b790 100644
--- a/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
+++ b/force-app/main/default/lwc/lexRequestDB/lexRequestDB.js
@@ -6,6 +6,8 @@
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { NavigationMixin } from 'lightning/navigation';
 import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
 export default class LexRequestDB extends NavigationMixin(LightningElement) {
     @api recordId;
     stageName;
@@ -39,6 +41,9 @@
         }
     }
     connectedCallback(){
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
         init({
             recordId: this.recordId
         }).then(result=>{
@@ -123,12 +128,22 @@
         this.dispatchEvent(new CloseActionScreenEvent());
     }
     showToast(msg,type) {
-      const event = new ShowToastEvent({
-          title: '',
-          message: msg,
-          variant: type
-      });
-      this.dispatchEvent(event);
+        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());
+        }   
     }
     updateRecordView(recordId) {
       updateRecord({fields: { Id: recordId }});

--
Gitblit v1.9.1