From 8749760be3e1ba64edd4ada506bdf628e5bee852 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 14:54:38 +0800
Subject: [PATCH] 再修理返品分析-修理 按钮

---
 force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
index 2f0f4de..f66f5ce 100644
--- a/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
+++ b/force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
@@ -14,6 +14,7 @@
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
 
 export default class LexSCSubmit extends LightningElement {
     @api recordId;
@@ -39,12 +40,10 @@
         }).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);
@@ -54,26 +53,12 @@
     // 鎻愪氦寰呭鎵�
     SCSubmit() {
         if (this.StatusC != '鑽夋涓�') {
-            this.ShowToastEvent("宸茬粡鎻愪氦瀹℃壒", "error")
+            this.ShowToastEvent("宸茬粡鎻愪氦瀹℃壒", "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
 
-        if (!confirm("涓�鏃CM鎻愪氦姝よ褰曚互寰呮壒鍑嗭紝鏍规嵁鎮ㄧ殑璁剧疆鎮ㄥ彲鑳戒笉鍐嶈兘澶熺紪杈戞璁板綍鎴栧皢浠栦粠鎵瑰噯杩囩▼涓皟鍥炪�傛槸鍚︾户缁紵")) {
-            return;
-        }
-
-        updateQISSCReport({
-            QId: this.Id
-        }).then(result => {
-            console.log(result);
-            if (result.length > 0) {
-                var split = result.split(", ");
-                alert(split[1]);
-            } else {
-                this.ShowToastEvent("宸叉彁浜�", "success")
-                window.location.reload();
-            }
-        })
+        this.handleConfirmClick("涓�鏃CM鎻愪氦姝よ褰曚互寰呮壒鍑嗭紝鏍规嵁鎮ㄧ殑璁剧疆鎮ㄥ彲鑳戒笉鍐嶈兘澶熺紪杈戞璁板綍鎴栧皢浠栦粠鎵瑰噯杩囩▼涓皟鍥炪�傛槸鍚︾户缁紵");
     }
 
     ShowToastEvent(msg, type) {
@@ -84,4 +69,30 @@
         });
         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());
+                } else {
+                    this.ShowToastEvent("宸叉彁浜�", "success")
+                    window.location.reload();
+                }
+            })
+        }else{
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1