import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; export default class LexCustomAnewMaintenance extends LightningElement { @api recordId; //相关列表选中id @api selectIds; str; IsLoading = true; Id; StatusC; RecordTypeDeveloperNameC; URFContractC; msg; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; console.log('urlValue',urlValue); if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.Id = result.Id; this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC; this.StatusC = result.StatusC; this.URFContractC = result.URFContractC; this.CustomAnew(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }) } //合同再报价 CustomAnew() { if (this.StatusC != "引合中") { this.msg = "维修合同不是询价中的状态,不能再报价"; this.IsLoading = false; return; } else { if (this.selectIds && this.selectIds.length == 1) { if (this.RecordTypeDeveloperNameC == "NewMaintenance_Contract") { if (this.URFContractC == true) { // window.open("/lightning/n/lexSelectAssetEstimateURF#copyid=" + this.selectIds[0], "_top"); window.location.href = '/lightning/n/lexSelectAssetEstimateURF#copyid=' + this.selectIds[0]; } else { // window.open("/lightning/n/lexSelectAssetEstimateVM#copyid=" + this.selectIds[0], "_top"); window.location.href = '/lightning/n/lexSelectAssetEstimateVM#copyid=' + this.selectIds[0]; } } else { window.location.href = '/apex/SelectAssetEstimate?copyid=' + this.selectIds[0]; // window.open("/apex/SelectAssetEstimate?copyid=" + this.selectIds[0], "_top"); } } else { this.msg = '请选择一个报价'; this.IsLoading = false; return; } } } closeAction() { window.open('/'+this.recordId,'_self'); } }