From 50ce6a5e5ae7ac6ce3e6281acca9a0db568306e6 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 14:54:59 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js |   52 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
index 9cb57e1..c441754 100644
--- a/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
+++ b/force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
@@ -14,6 +14,8 @@
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
+import LightningConfirm from 'lightning/confirm';
+
 
 export default class LexPreContractSubmit extends LightningElement {
     @api recordId;
@@ -44,7 +46,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
                 this.uploadToRMTimeC = result.uploadToRMTimeC;
                 this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
@@ -53,7 +54,6 @@
                 this.Id = result.Id;
 
                 this.preContractSubmit();
-                this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
             console.log(error);
@@ -64,37 +64,30 @@
     preContractSubmit() {
         if (this.oldIsRecognitionModelC) {
             if (this.uploadToRMTimeC == null) {
-                this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�', "error")
+                this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓鐨勭粡閿�鍟嗘槸鍏堟瀵硅薄锛岄渶瑕佸厛銆愪笂浼犺娆惧悎鍚屻�戯紝鐒跺悗瀹屾垚璁ゆ浠ュ悗鎵嶈兘澶嶆牳銆�', "error");
+                this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             } else {
                 if (!this.IsRecognitionModelTrueC) {
-                    this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��', "error")
+                    this.ShowToastEvent('褰撳墠缁翠慨鍚堝悓娌℃湁瀹屾垚璁ゆ锛屼笉鑳借繘琛屽鏍搞��', "error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
                     return;
                 }
             }
         }
         var status = this.MCApprovalStatusC;
         if (status != 'Draft' && status != 'Reject' && status != undefined) {
-            this.ShowToastEvent('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��', "error")
+            this.ShowToastEvent('澶嶆牳宸茬粡鎻愪氦锛岃纭鐘舵�併��', "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
         var con_no = this.ContractprintCompletedC;
         if (con_no == undefined) {
-            this.ShowToastEvent('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��', "error")
+            this.ShowToastEvent('鍚堝悓鐩栫珷瀹屾瘯涓虹┖锛屼笉鑳芥彁浜ゅ悎鍚屽鏍哥敵璇枫��', "error");
+            this.dispatchEvent(new CloseActionScreenEvent());
             return;
         }
-        if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
-            return;
-        }
-        processResults({
-            recordId: this.recordId
-        }).catch(error => {
-            if (error.body.pageErrors[0] != null) {
-                var errmsg = error.body.pageErrors[0].message.toString();
-                this.ShowToastEvent(errmsg + '_sys', "error")
-                return;
-            }
-        })
+        this.handleConfirmClick("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵");
     }
 
     // 寮圭獥
@@ -106,4 +99,27 @@
         });
         this.dispatchEvent(event);
     }
+
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value'
+        });
+
+        if (result) {
+            processResults({
+                recordId: this.Id
+            }).catch(error => {
+                if (error.body.pageErrors[0] != null) {
+                    var errmsg = error.body.pageErrors[0].message.toString();
+                    this.ShowToastEvent(errmsg, "error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                    return;
+                }
+            })
+        } else {
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1