From 626f3c3bb25e204568019e8d568e2d7547d1037a Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 09 八月 2023 10:54:08 +0800
Subject: [PATCH] 20230809修改伟意按钮同步

---
 force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js |   57 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
index 2ff072b..2b53fb1 100644
--- a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
+++ b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
@@ -14,8 +14,9 @@
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
 
-export default class LexSCSubmit extends LightningElement {
+export default class lexSCSubmit extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
@@ -39,43 +40,25 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.Id = result.Id;
                 this.StatusC = result.StatusC;
 
                 this.SCSubmit();
-                this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
             console.log(error);
-        }).finally(() => {
-
-        });
+        })
     }
 
     // 鎻愪氦寰呭鎵�
     SCSubmit() {
         if (this.StatusC != '鑽夋涓�') {
-            this.ShowToastEvent("宸茬粡鎻愪氦瀹℃壒", "error")
-            // alert('宸茬粡鎻愪氦瀹℃壒');
+            this.ShowToastEvent("宸茬粡鎻愪氦瀹℃壒", "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
 
-        if (!confirm("涓�鏃CM鎻愪氦姝よ褰曚互寰呮壒鍑嗭紝鏍规嵁鎮ㄧ殑璁剧疆鎮ㄥ彲鑳戒笉鍐嶈兘澶熺紪杈戞璁板綍鎴栧皢浠栦粠鎵瑰噯杩囩▼涓皟鍥炪�傛槸鍚︾户缁紵")) {
-            return;
-        }
-
-        updateQISSCReport({
-            Id: this.Id
-        }).then(result => {
-            if (result.length > 0) {
-                var split = result.split(", ");
-                alert(split[1]);
-            }
-            this.ShowToastEvent("宸叉彁浜�", "success")
-            // alert('宸叉彁浜�!')
-            window.location.reload();
-        })
+        this.handleConfirmClick("涓�鏃CM鎻愪氦姝よ褰曚互寰呮壒鍑嗭紝鏍规嵁鎮ㄧ殑璁剧疆鎮ㄥ彲鑳戒笉鍐嶈兘澶熺紪杈戞璁板綍鎴栧皢浠栦粠鎵瑰噯杩囩▼涓皟鍥炪�傛槸鍚︾户缁紵");
     }
 
     ShowToastEvent(msg, type) {
@@ -86,4 +69,32 @@
         });
         this.dispatchEvent(event);
     }
+
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value'
+        });
+
+        if(result){
+            updateQISSCReport({
+                QId: this.Id
+            }).then(result => {
+                console.log(result);
+                if (result.length > 0) {
+                    var split = result.split(", ");
+                    this.ShowToastEvent(split[1], "error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    // alert(split[1]);
+                } else {
+                    this.ShowToastEvent("宸叉彁浜�", "success");
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    window.location.reload();
+                }
+            })
+        }else{
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1