import { LightningElement,api, track, wire } from 'lwc';
|
import {CurrentPageReference} from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import execute from '@salesforce/apex/SoakupHPDeptTeam.execute';
|
import init from '@salesforce/apex/SoakupTeamController.init';
|
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
export default class LexSoakupTeam extends LightningElement {
|
@api recordId;
|
IsLoading=true;
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference){
|
console.log("进入页面");
|
console.log(currentPageReference);
|
if(currentPageReference){
|
const urvalue=currentPageReference.state.recordId;
|
if(urvalue){
|
let str=`${urvalue}`;
|
this.recordId=str;
|
}
|
}
|
}
|
connectedCallback(){
|
init({recordId:this.recordId}).then(res => {
|
if (confirm(res.ConfirmSoakupHPDeptTeam)) {
|
execute({deptClassId: res.id}).then(rep => {
|
if (rep != 'OK') {
|
this.showToast(rep,'error');
|
} else {
|
|
this.showToast('反映完成','success');
|
}
|
}).catch((e) => {
|
if (e.faultcode == 'sf:INSUFFICIENT_ACCESS') {
|
this.showToast('没有执行权限','error');
|
} else {
|
this.showToast(e,'success');
|
}
|
});
|
}
|
}).catch(err => {
|
console.log(err,'<==========err')
|
})
|
|
}
|
showToast(msg,type) {
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.IsLoading = false;
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|