From 2b6d9d2fe87c2e31cd29da024717ab5b10104787 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 06 七月 2023 11:02:48 +0800
Subject: [PATCH] 排队NO.置顶

---
 force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
index ca3dd20..1bb49d6 100644
--- a/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
+++ b/force-app/main/default/lwc/lexTopInQueue/lexTopInQueue.js
@@ -3,6 +3,7 @@
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
 
 import queueTop from '@salesforce/apex/ApplyJsCtl.queueTop';
 export default class lexTopInQueue extends LightningElement {
@@ -25,25 +26,32 @@
 		queueTop({
 			applyId: this.recordId
 		}).then(res=>{
+			this.IsLoading = false;
 			if(res == 'Success'){
-				const evt = new ShowToastEvent({
-                        title : '缃《鎴愬姛',
-                        message: '',
-                        variant: 'success'
-                    });
-                this.dispatchEvent(evt);
-                this.dispatchEvent(new CloseActionScreenEvent());
+				this.showToast('缃《鎴愬姛','success');
+				return;
 			}else{
-				const evterr = new ShowToastEvent({
-                        title : res,
-                        message: '',
-                        variant: 'error'
-                    });
-                this.dispatchEvent(evterr);
-                this.dispatchEvent(new CloseActionScreenEvent());
+				this.showToast(res,'error');
+				return;
 			}
 		}).catch(err=>{
 			this.dispatchEvent(new CloseActionScreenEvent());
 		})
 	}
+
+	showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        if(type == 'success'){
+            this.updateRecordView(this.recordId);
+        }
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1