/* * @Date: 2023-05-16 13:32:13 * @Author: @zyh * @LastEditTime: 2023-05-17 14:02:00 * @Descripttion: */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/lexRentalApply_FromRepCtl.rentalApp'; import rentalApp from '@salesforce/apex/lexRentalApply_FromRepCtl.init'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import changeTrade from '@salesforce/apex/OpportunityWebService.changeTrade'; import selectAgencyHospital from '@salesforce/apex/OtherButtonOppCtl.selectAgencyHospital'; import selectRecordType from '@salesforce/apex/OtherButtonOppCtl.selectRecordType'; import selectFieldDefinition from '@salesforce/apex/OtherButtonOppCtl.selectFieldDefinition'; export default class LexEquipmentRentalApply_FromRepair2 extends LightningElement { @api recordId;//OpportunityId stauts1; inspectionDate; shippedDate; assetModelNo; qisRepairId; qisRepairName; repairSource; maintenanceContract; purpose2; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ console.log(this.recordId); rentalApp({ recordId: this.recordId }).then(result => { console.log('rentalApp============' + result); if(result.lenth > 0){ const evt = new ShowToastEvent({ title : 'Error', message : '同一个型号的修理记录不能重复申请备品', variant : 'error' }); this.dispatchEvent(evt); return; } init({ recordId: this.recordId }).then(result => { // console.log(result); // const evt = new ShowToastEvent({ // title : 'Error', // message : '同一个型号的修理记录不能重复申请备品1111111', // variant : 'error' // }); // this.dispatchEvent(evt); // return; if (result != null) { this.IsLoading = false; this.currencyIsoCode = result.currencyIsoCode; this.status = result.stageName; this.quostatus = result.estimationDecision; this.win = result.SAPSendOK; this.Auth = result.IfAuthorizingLock; this.agency1Id = result.agency1Id; this.agencyOpportunity = result.agencyOpportunity; this.trade = result.trade; this.oppName = result.oppName; this.opp = result.opp; // this.changeContractType(); this.dispatchEvent(new CloseActionScreenEvent()); // window.location.reload(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } insertApplyRepair(){ } }