From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523

---
 force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js |   40 +++++++++++++---------------------------
 1 files changed, 13 insertions(+), 27 deletions(-)

diff --git a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js
index 45665b5..c5bd082 100644
--- a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js
+++ b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js
@@ -11,9 +11,6 @@
 } from 'lightning/actions';
 import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
 import selectMaintenanceContractEstimate from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectMaintenanceContractEstimate';
-import {
-    ShowToastEvent
-} from 'lightning/platformShowToastEvent';
 
 export default class LexCustomAnewMaintenance extends LightningElement {
     @api recordId;
@@ -21,7 +18,7 @@
     IsLoading = true;
     Id;
     StatusC;
-    RecordTypeId;
+    RecordTypeDeveloperNameC;
     URFContractC;
 
     @wire(CurrentPageReference)
@@ -44,7 +41,7 @@
             if (result != null) {
                 this.IsLoading = false;
                 this.Id = result.Id;
-                this.RecordTypeId = result.RecordTypeId;
+                this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
                 this.StatusC = result.StatusC;
                 this.URFContractC = result.URFContractC;
 
@@ -59,38 +56,27 @@
     //涓
     CustomAnew() {
         if (this.StatusC != "寮曞悎涓�") {
-            this.ShowToastEvent("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鍐嶆姤浠�", "error")
-            // alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鍐嶆姤浠�");
+            alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鍐嶆姤浠�")
         } else {
-            init().then(result => {
-                if (result.length == 1) {
-                    if (this.RecordTypeId == "01210000000gTYq") {
-                        //URF闄愭鍚堝悓2鏈� LY 20220902 start
+            selectMaintenanceContractEstimate({
+                recordId: this.Id
+            }).then(ids => {
+                console.log(ids);
+                if (ids.length == 1) {
+                    if (this.RecordTypeDeveloperNameC == "NewMaintenance_Contract") {
                         if (this.URFContractC == true) {
-                            window.open("/apex/SelectAssetEstimateURF?copyid=" + ids[0], "_top");
+                            window.open("/apex/SelectAssetEstimateURF?copyid=" + ids[0].Id, "_top");
                         } else {
-                            window.open("/apex/SelectAssetEstimateVM?copyid=" + ids[0], "_top");
+                            window.open("/apex/SelectAssetEstimateVM?copyid=" + ids[0].Id, "_top");
                         }
-                        //URF闄愭鍚堝悓2鏈� LY 20220902 end
                     } else {
-                        window.open("/apex/SelectAssetEstimate?copyid=" + ids[0], "_top");
+                        window.open("/apex/SelectAssetEstimate?copyid=" + ids[0].Id, "_top");
                     }
 
                 } else {
-                    this.ShowToastEvent('璇烽�夋嫨涓�涓姤浠�', "error")
-                    // alert('璇烽�夋嫨涓�涓姤浠�');
+                    alert('璇烽�夋嫨涓�涓姤浠�')
                 }
             })
         }
-    }
-
-    // 寮圭獥
-    ShowToastEvent(msg, type) {
-        const event = new ShowToastEvent({
-            title: '',
-            message: msg,
-            variant: type
-        });
-        this.dispatchEvent(event);
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1