import {
|
LightningElement,
|
wire,
|
api
|
} from 'lwc';
|
import {
|
CurrentPageReference
|
} from "lightning/navigation";
|
import {
|
CloseActionScreenEvent
|
} from 'lightning/actions';
|
import init from '@salesforce/apex/buttonCampaignCtl.init';
|
|
export default class lexCreateAssessmentReport extends LightningElement {
|
@api recordId;
|
str;
|
IsLoading = true;
|
Id;
|
Status;
|
msg;
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
const urlValue = currentPageReference.state.recordId;
|
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.Status = result.Status;
|
|
this.CreateAssessmentReport();
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}).catch(error => {
|
console.log(error);
|
})
|
}
|
|
// 新建授课/考核报告
|
CreateAssessmentReport() {
|
var status = this.Status;
|
if (status == '公开中') {
|
window.open("/apex/AssessmentReport?camid=" + this.Id, "_top");
|
} else {
|
this.msg = '只有批准后才能创建报告!';
|
this.IsLoading = false;
|
}
|
}
|
|
closeAction() {
|
window.history.go(-1);
|
}
|
}
|