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.html                             |    1 
 force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js                             |   17 ++++++--
 force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html                           |    1 
 force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js                               |   25 +++++++++---
 force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js                             |   20 ++++++++--
 force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js   |   14 ++++++-
 force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html |    1 
 force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html                           |    1 
 8 files changed, 64 insertions(+), 16 deletions(-)

diff --git a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
index 978fa09..9625dc2 100644
--- a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
@@ -1,5 +1,6 @@
 <template>
     <div class="submitHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
index 598b4b9..025a150 100644
--- a/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
+++ b/force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
@@ -5,7 +5,7 @@
 import  otherButtonInSubmitCompetitorReport  from '@salesforce/apex/ReportController.updateForSubmitCompetitorReportButton';
 import { updateRecord } from 'lightning/uiRecordApi';
 import init  from '@salesforce/apex/ReportController.initForSubmitCompetitorReportButton';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 export default class LexSubmitCompetitorReport extends LightningElement {
     @api recordId;
     IsLoading = true;
@@ -19,18 +19,28 @@
             recordId: this.recordId
           }).then(result=>{
             this.submit();
-            this.dispatchEvent(new CloseActionScreenEvent());
             this.IsLoading = false;  
           });
           
     }
+
+    showToast(msg,type) {
+      const event = new ShowToastEvent({
+          title: '',
+          message: msg,
+          variant: type
+      });
+      this.dispatchEvent(event);
+  }
     
 
     submit(){
       otherButtonInSubmitCompetitorReport({
         recordId: this.recordId
     }).then(result=>{
+      this.showToast("鎻愪氦瀵规墜绔炰簤鎶ュ憡鎴愬姛","success")
       this.updateRecordView(this.recordId);
+      this.dispatchEvent(new CloseActionScreenEvent());
     });
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
index 6a9dc18..592cc85 100644
--- a/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
+++ b/force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
@@ -1,5 +1,6 @@
 <template>
     <div class="checkHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
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();
diff --git a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
index 421513e..308b1e2 100644
--- a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
@@ -1,5 +1,6 @@
 <template>
     <div class="vocFinishHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
index f3decda..97c426c 100644
--- a/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
+++ b/force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
@@ -5,7 +5,7 @@
 import update  from '@salesforce/apex/ReportController.updateForVOCFinishButton';
 import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
 import { updateRecord } from 'lightning/uiRecordApi';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 export default class LexVOCFinish extends LightningElement {
     @api recordId;
     status;
@@ -23,7 +23,6 @@
                 this.status = result.status;
                 this.profileId = result.profileId;
                 this.VOCFinish();
-                this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
             console.log("error");
@@ -35,6 +34,15 @@
         //this.updateRecordView(this.recordId);
     }
 
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
 
     updateRecordView(recordId) {
         updateRecord({fields: { Id: recordId }});
@@ -42,17 +50,21 @@
 
     VOCFinish () {
         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;
             }
             update({
                 recordId: this.recordId
             }).then(result =>{
+                this.showToast("鎴愬姛","success");
                 this.updateRecordView(this.recordId);
+                this.dispatchEvent(new CloseActionScreenEvent());
             });
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
index 0e02309..cb84330 100644
--- a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
@@ -1,5 +1,6 @@
 <template>
     <div class="vocSubmitHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
index 58c0877..e95386d 100644
--- a/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
+++ b/force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
@@ -5,7 +5,7 @@
 import VOCSubmit  from '@salesforce/apex/ReportController.updateForVOCSubmitButton';
 import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
 import { updateRecord } from 'lightning/uiRecordApi';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 export default class LexVOCSubmit extends LightningElement {
     @api recordId;
     createdById;
@@ -22,7 +22,6 @@
                 this.status = result.status;
                 this.createdById = result.createdById;
                 this.Submit();
-                this.dispatchEvent(new CloseActionScreenEvent());
                 this.IsLoading = false;
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
             }
@@ -39,18 +38,28 @@
         updateRecord({fields: { Id: recordId }});
     }
 
-
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
 
     Submit () {
         if (this.status != "鑽夋涓�") {
-            alert("涓嶆槸鑽夋涓笉鑳界偣鍑�");
+            this.showToast("涓嶆槸鑽夋涓笉鑳界偣鍑�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
             }
             VOCSubmit({
                 recordId: this.recordId,
                 createdById: this.createdById
             }).then(result =>{
+                this.showToast("鎴愬姛","success");
                 this.updateRecordView(this.recordId);
+                this.dispatchEvent(new CloseActionScreenEvent());
             });
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1