import { LightningElement,api, track, wire } from 'lwc';
|
import {CurrentPageReference} from 'lightning/navigation';
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { NavigationMixin } from 'lightning/navigation';
|
import init from '@salesforce/apex/AgencyContractCloneController.init';
|
|
export default class LexAgencyContractClone extends NavigationMixin(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}`;
|
console.log('str');
|
console.log(str);
|
this.recordId=str;
|
}
|
}
|
}
|
connectedCallback(){
|
init({recordId:this.recordId}).then(res => {
|
if(res != null){
|
if (res.id == '00510000002YSBIAA4'
|
|| res.id == '00510000004PMMcAAO'
|
// || res.Id == '00510000006Vsuo'
|
|| res.profileId == '00e10000000Y3o5AAC'
|
|| res.profileId == '00e10000000tiSlAAI') {
|
window.open("/"+this.recordId+"/e?clone=1&retURL="+this.recordId);
|
} else {
|
this.showToast('没有复制经销商合同的权限','error');
|
}
|
}
|
}).catch(err => {
|
console.log('err=====>',err)
|
})
|
}
|
|
showToast(msg, type) {
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|