From 28719a24d8312ac35f373a27c5ba3f50f1a89eb4 Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期五, 19 五月 2023 16:04:38 +0800
Subject: [PATCH] 维修合同报价

---
 force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.html            |    1 
 force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js            |   40 ++++++-------------
 force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.html        |    2 
 force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js              |   22 ++---------
 force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.html          |    1 
 force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js-meta.xml   |    7 +++
 force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js          |   15 +++----
 force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js-meta.xml     |    7 +++
 force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls                       |    3 -
 force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js-meta.xml |    2 
 10 files changed, 40 insertions(+), 60 deletions(-)

diff --git a/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls
index 67ab652..9cb79a3 100644
--- a/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls
+++ b/force-app/main/default/classes/otherButtonMaintenanceContractCtl.cls
@@ -31,7 +31,6 @@
             res.Name = report.Name;
             res.ContractQuotationOrNotC = report.Contract_quotation_or_not__c;
             res.PaymentPlanSumFirstC = report.Payment_Plan_Sum_First__c;
-            res.RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('鏈嶅姟鍚堝悓').getRecordTypeId();
             System.debug(LoggingLevel.INFO, '*** res: ' + res);
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
@@ -56,7 +55,7 @@
     public static List<Maintenance_Contract_Estimate__c> selectMaintenanceContractEstimate(String recordId){
         List<Maintenance_Contract_Estimate__c> res = new List<Maintenance_Contract_Estimate__c>();
         try{
-            res = [SELECT RecordTypeId from Maintenance_Contract_Estimate__c ];
+            res = [SELECT Id  from Maintenance_Contract_Estimate__c where Maintenance_Contract__c=:recordId];
         }catch(Exception e){
             System.debug(LoggingLevel.INFO, '*** e: ' + e);
         }
diff --git a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.html b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.html
index 87f391a..d044dbb 100644
--- a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.html
+++ b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.html
@@ -1,6 +1,5 @@
 <template>
     <div class="exampleHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
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
diff --git a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js-meta.xml b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js-meta.xml
index 3392981..3da8f7a 100644
--- a/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js-meta.xml
+++ b/force-app/main/default/lwc/lexCustomAnewMaintenance/lexCustomAnewMaintenance.js-meta.xml
@@ -7,5 +7,12 @@
 		<target>lightning__AppPage</target>
 		<target>lightning__HomePage</target>
 		<target>lightning__RecordAction</target>
+		<target>lightning__FlowScreen</target> 
 	</targets>
+	 <!-- 瀹氫箟鍙橀噺 --> 
+    <targetConfigs> 
+        <targetConfig targets="lightning__FlowScreen"> 
+            <property name="recordId" type="String" label="recordId"/>
+        </targetConfig> 
+    </targetConfigs> 
 </LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.html b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.html
index d044dbb..bc883e6 100644
--- a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.html
+++ b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.html
@@ -1,5 +1,5 @@
 <template>
-    <div class="exampleHolder" if:true={IsLoading}>
+    <div class="toReportHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
index 7fe37a2..9b81859 100644
--- a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
+++ b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js
@@ -18,8 +18,8 @@
     Id;
     StatusC;
     IsRecognitionModelC;
-    RecordTypeId;
     URFContractC;
+    RecordTypeDeveloperNameC;
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -43,9 +43,9 @@
                 this.Id = result.Id;
                 this.StatusC = result.StatusC;
                 this.IsRecognitionModelC = result.IsRecognitionModelC;
-                this.RecordTypeId = result.RecordTypeId;
                 this.URFContractC = result.URFContractC;
-                this.RecordTypeId1 = result.RecordTypeId1;
+                this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
+
                 this.CustomNewMC();
                 this.dispatchEvent(new CloseActionScreenEvent());
             }
@@ -56,18 +56,16 @@
 
     // 鏂板缓鏂版湇鍔″悎鍚屾姤浠�	
     CustomNewMC() {
-        if ( this.StatusC != "寮曞悎涓�") {
+        if (this.StatusC != "寮曞悎涓�") {
             alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环");
         } else {
-            //缁翠慨鍚堝悓鏂板缓鎶ヤ环鏃讹紝濡傛灉鏄厛娆惧璞★紝寮瑰嚭瀵硅瘽妗嗘彁绀� thh 20220304 start
             if (this.IsRecognitionModelC == 1) {
                 if (!confirm("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁柊寤烘姤浠凤紵")) {
                     return;
                 }
             }
-            //缁翠慨鍚堝悓鏂板缓鎶ヤ环鏃讹紝濡傛灉鏄厛娆惧璞★紝寮瑰嚭瀵硅瘽妗嗘彁绀� thh 20220304 end
-            if (this.RecordTypeId == this.RecordTypeId1) {
-                if (this.URFContractC == "0") {
+            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");
@@ -75,7 +73,6 @@
             } else {
                 window.open("/apex/SelectAssetEstimate?mcid=" + this.Id, "_top");
             }
-
         }
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js-meta.xml b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js-meta.xml
index d1d71cc..3da8f7a 100644
--- a/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js-meta.xml
+++ b/force-app/main/default/lwc/lexCustomNewMCMaintenance/lexCustomNewMCMaintenance.js-meta.xml
@@ -12,7 +12,7 @@
 	 <!-- 瀹氫箟鍙橀噺 --> 
     <targetConfigs> 
         <targetConfig targets="lightning__FlowScreen"> 
-            <property name="recordId" type="String" label="recordId"/> 
+            <property name="recordId" type="String" label="recordId"/>
         </targetConfig> 
     </targetConfigs> 
 </LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.html b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.html
index 87f391a..d044dbb 100644
--- a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.html
+++ b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.html
@@ -1,6 +1,5 @@
 <template>
     <div class="exampleHolder" if:true={IsLoading}>
         <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
-        <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button>
     </div>
 </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js
index 5fd4900..ac46aa5 100644
--- a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js
+++ b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js
@@ -10,9 +10,6 @@
     CloseActionScreenEvent
 } from 'lightning/actions';
 import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
-import {
-    ShowToastEvent
-} from 'lightning/platformShowToastEvent';
 
 export default class LexCustomNewMaintenance extends LightningElement {
     @api recordId;
@@ -20,7 +17,7 @@
     IsLoading = true;
     Id;
     StatusC;
-    RecordTypeId;
+    RecordTypeDeveloperNameC;
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -43,7 +40,7 @@
                 this.IsLoading = false;
                 this.Id = result.Id;
                 this.StatusC = result.StatusC;
-                this.RecordTypeId = result.RecordTypeId;
+                this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC;
 
                 this.CustomNew();
                 this.dispatchEvent(new CloseActionScreenEvent());
@@ -56,24 +53,13 @@
     // 鏂板缓缁翠慨鍚堝悓鎶ヤ环
     CustomNew() {
         if (this.StatusC != "寮曞悎涓�") {
-            this.ShowToastEvent("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环", "error");
-            // alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环");
+            alert("缁翠慨鍚堝悓涓嶆槸璇环涓殑鐘舵�侊紝涓嶈兘鏂板缓鎶ヤ环");
         } else {
-            if (this.RecordTypeId == "01210000000gTYq") {
+            if (this.RecordTypeDeveloperNameC == "NewMaintenance_Contract") {
                 window.open("/apex/SelectAssetEstimateVM?mcid=" + this.Id, "_top");
             } else {
                 window.open("/apex/SelectAssetEstimate?mcid=" + this.Id, "_top");
             }
         }
-    }
-
-    // 寮圭獥
-    ShowToastEvent(msg, type) {
-        const event = new ShowToastEvent({
-            title: '',
-            message: msg,
-            variant: type
-        });
-        this.dispatchEvent(event);
     }
 }
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js-meta.xml b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js-meta.xml
index 3392981..3da8f7a 100644
--- a/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js-meta.xml
+++ b/force-app/main/default/lwc/lexCustomNewMaintenance/lexCustomNewMaintenance.js-meta.xml
@@ -7,5 +7,12 @@
 		<target>lightning__AppPage</target>
 		<target>lightning__HomePage</target>
 		<target>lightning__RecordAction</target>
+		<target>lightning__FlowScreen</target> 
 	</targets>
+	 <!-- 瀹氫箟鍙橀噺 --> 
+    <targetConfigs> 
+        <targetConfig targets="lightning__FlowScreen"> 
+            <property name="recordId" type="String" label="recordId"/>
+        </targetConfig> 
+    </targetConfigs> 
 </LightningComponentBundle>
\ No newline at end of file

--
Gitblit v1.9.1