From 4c5b740567d5664a2b4133e8f6b3a6ee86886beb Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 04 四月 2023 16:23:42 +0800
Subject: [PATCH] 处理review 4.4.2

---
 force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
index 4d006a8..2c7b20c 100644
--- a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
@@ -5,7 +5,7 @@
 import init  from '@salesforce/apex/ReportController.initForVOCCheckButton';
 import VOCCheck  from '@salesforce/apex/ReportController.updateForVOCCheckButton';
 import { updateRecord } from 'lightning/uiRecordApi';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 
 export default class LexVOCCheck extends LightningElement {
     
@@ -31,7 +31,6 @@
                 this.profileId = result.profileId;
                 console.log(this.status); 
                 this.check();
-                this.dispatchEvent(new CloseActionScreenEvent());
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
             }
         }).catch(error => {
@@ -40,7 +39,6 @@
         }).finally(() => {
             
         });
-        this.updateRecordView(this.recordId);
     }
 
 
@@ -48,18 +46,32 @@
         updateRecord({fields: { Id: recordId }});
     }
 
+    showToast(msg, type) {
+        const event = new ShowToastEvent({
+          title: "",
+          message: msg,
+          variant: type
+        });
+        this.dispatchEvent(event);
+      }
+
     check (){
         // 闄嗚儨锛岃儭杩畨锛岀郴缁熺鐞嗗憳鍙偣(闇�瑕佽皟鏁�)
         if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") {
-                alert("浣犳病鏈夊垽瀹歏OC鐨勬潈闄�");
+                this.showToast("浣犳病鏈夊垽瀹歏OC鐨勬潈闄�","error");
+                this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             }
             if (this.status != "璺熻繘涓�") {
                 alert("涓嶆槸璺熻繘涓笉鑳界偣鍑�");
+                this.showToast("涓嶆槸璺熻繘涓笉鑳界偣鍑�","error");
+                this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             }
             if (this.isVOC == undefined) {
                 alert("蹇呴』閫夋嫨鏄惁VOC");
+                this.showToast("蹇呴』閫夋嫨鏄惁VOC","error");
+                this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             } 
             VOCCheck(
@@ -70,11 +82,12 @@
                 }
             ).then(result =>{
                 if(result == null){
+                    this.showToast("鎴愬姛","success");
                     this.updateRecordView(this.recordId);
                 }else {
-                    alert(result);
+                    this.showToast(result,"error");
                 }
-                
+                this.dispatchEvent(new CloseActionScreenEvent());
             });
 
             //location.reload();

--
Gitblit v1.9.1