From a8628cfe2640797ba9265e9be46c42430d9e7eba Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期一, 26 六月 2023 10:01:44 +0800
Subject: [PATCH] 服务按钮样式调整

---
 force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js |   49 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
index 9b81859..86a5138 100644
--- a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
+++ b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
@@ -10,6 +10,7 @@
     CloseActionScreenEvent
 } from 'lightning/actions';
 import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import LightningConfirm from 'lightning/confirm';
 
 export default class LexCustomNewMCMaintenance extends LightningElement {
     @api recordId;
@@ -20,6 +21,7 @@
     IsRecognitionModelC;
     URFContractC;
     RecordTypeDeveloperNameC;
+    msg;
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -39,7 +41,6 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.Id = result.Id;
                 this.StatusC = result.StatusC;
                 this.IsRecognitionModelC = result.IsRecognitionModelC;
@@ -57,22 +58,44 @@
     // 鏂板缓鏂版湇鍔″悎鍚屾姤浠�	
     CustomNewMC() {
         if (this.StatusC != "寮曞悎涓�") {
-            alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环");
+            this.msg = "缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环";
+            this.IsLoading = false;
         } else {
             if (this.IsRecognitionModelC == 1) {
-                if (!confirm("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁柊寤烘姤浠凤紵")) {
-                    return;
-                }
-            }
-            if (this.RecordTypeDeveloperNameC == "NewMaintenance_Contract") {
-                if (this.URFContractC == 0) {
-                    window.open("/apex/SelectAssetEstimateVM?mcid=" + this.Id, "_top");
-                } else {
-                    window.open("/apex/SelectAssetEstimateURF?mcid=" + this.Id, "_top");
-                }
+                this.handleConfirmClick("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁柊寤烘姤浠凤紵")
             } else {
-                window.open("/apex/SelectAssetEstimate?mcid=" + this.Id, "_top");
+                this.ll();
             }
+
         }
     }
+
+    ll() {
+        if (this.RecordTypeDeveloperNameC == "NewMaintenance_Contract") {
+            if (this.URFContractC == 0) {
+                window.open("/apex/SelectAssetEstimateVM?mcid=" + this.Id, "_top");
+            } else {
+                window.open("/apex/SelectAssetEstimateURF?mcid=" + this.Id, "_top");
+            }
+        } else {
+            window.open("/apex/SelectAssetEstimate?mcid=" + this.Id, "_top");
+        }
+    }
+
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value'
+        });
+        if (result) {
+            this.ll();
+        } else {
+            window.history.go(-1);
+        }
+    }
+
+    closeAction() {
+        window.history.go(-1);
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1