From dfff58b7cd897b824a129edba6b5cdae20bb1e5c Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期三, 23 八月 2023 17:40:58 +0800
Subject: [PATCH] 发起再注册分析并同步SAP

---
 force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js |   59 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
index 89df914..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;
@@ -18,8 +19,9 @@
     Id;
     StatusC;
     IsRecognitionModelC;
-    RecordTypeId;
     URFContractC;
+    RecordTypeDeveloperNameC;
+    msg;
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -39,13 +41,11 @@
         }).then(result => {
             console.log(result);
             if (result != null) {
-                this.IsLoading = false;
                 this.Id = result.Id;
                 this.StatusC = result.StatusC;
                 this.IsRecognitionModelC = result.IsRecognitionModelC;
-                this.RecordTypeId = result.RecordTypeId;
-                this.RecordTypeId1 = result.RecordTypeId1;
                 this.URFContractC = result.URFContractC;
+                this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
 
                 this.CustomNewMC();
                 this.dispatchEvent(new CloseActionScreenEvent());
@@ -57,28 +57,45 @@
 
     // 鏂板缓鏂版湇鍔″悎鍚屾姤浠�	
     CustomNewMC() {
-        if ( this.StatusC != "寮曞悎涓�") {
-            alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环");
-            window.history.go(-1);
+        if (this.StatusC != "寮曞悎涓�") {
+            this.msg = "缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环";
+            this.IsLoading = false;
         } else {
-            //缁翠慨鍚堝悓鏂板缓鎶ヤ环鏃讹紝濡傛灉鏄厛娆惧璞★紝寮瑰嚭瀵硅瘽妗嗘彁绀� thh 20220304 start
             if (this.IsRecognitionModelC == 1) {
-                if (!confirm("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁柊寤烘姤浠凤紵")) {
-                    window.history.go(-1);
-                    return;
-                }
-            }
-            //缁翠慨鍚堝悓鏂板缓鎶ヤ环鏃讹紝濡傛灉鏄厛娆惧璞★紝寮瑰嚭瀵硅瘽妗嗘彁绀� thh 20220304 end
-            if (this.RecordTypeId == this.RecordTypeId1) {
-                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