import {
|
LightningElement,
|
wire,
|
api
|
} from 'lwc';
|
import {
|
CurrentPageReference
|
} from "lightning/navigation";
|
import {
|
CloseActionScreenEvent
|
} from 'lightning/actions';
|
import init from '@salesforce/apex/otherButtonRepairController.init';
|
export default class LexPDFMaintenanceCommission extends LightningElement {
|
@api recordId;
|
str;
|
IsLoading = true;
|
Id;;
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
const urlValue = currentPageReference.state.recordId;
|
if (urlValue) {
|
let str = `${urlValue}`;
|
this.recordId = str;
|
}
|
}
|
}
|
|
connectedCallback() {
|
console.log(this.recordId);
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log(result);
|
if (result != null) {
|
this.IsLoading = false;
|
this.Id = result.Id;
|
|
this.PDFMaintenanceCommission();
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}).catch(error => {
|
console.log(error);
|
}).finally(() => {
|
|
});
|
}
|
|
// 打印维修委托书
|
PDFMaintenanceCommission() {
|
window.open('/apex/MaintenanceCommissionPDF?id=' + this.Id, 'MaintenanceCommissionPDF');
|
}
|
}
|