From 21b0eacc4f61c753fcdd2d6fd60ec1c5a837cebd Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 06 七月 2023 11:03:46 +0800
Subject: [PATCH] 现场统一收货

---
 force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js b/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
index f97ad18..1e29534 100644
--- a/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
+++ b/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
@@ -2,6 +2,7 @@
 import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
 import { CloseActionScreenEvent } from 'lightning/actions';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { updateRecord } from 'lightning/uiRecordApi';
 
 import init from '@salesforce/apex/AllReceivedFseController.init';
 import getRaeSet from '@salesforce/apex/AllReceivedFseController.getRaeSet';
@@ -39,23 +40,11 @@
 					recordId: this.recordId
 				}).then(res=>{
 					if(res == 'SUCCESS'){
-						const evt = new ShowToastEvent({
-	                        title : '鐜板満宸插叏閮ㄦ敹璐�',
-	                        message: '',
-	                        variant: 'success'
-                    	});
-                    	this.dispatchEvent(new CloseActionScreenEvent());
-                		this.dispatchEvent(evt);
+                		this.showToast('鐜板満宸插叏閮ㄦ敹璐�','success');
+                		return;
 					}else{
-						const errToast = new ShowToastEvent({
-	                        title : res,
-	                        message: '',
-	                        variant: 'error'
-                    	});
-                    	this.dispatchEvent(new CloseActionScreenEvent());
-                		this.dispatchEvent(errToast);
-
-                		console.log(res);
+                		this.showToast(res,'warning');
+                		return;
 					}
 					
 				})
@@ -67,4 +56,20 @@
 			console.log('init==='+err);
 		})
 	}
+
+	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