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); } 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> 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); } } 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> 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> 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"); } } } } 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> 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> 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); } } 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>