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/DealerVisitDetailsController.init';
|
import ReportId from '@salesforce/apex/HosipitalToDeptController.ReportId';
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import {loadStyle} from 'lightning/platformResourceLoader'
|
export default class LexDealerVisitDetails 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(){
|
Promise.all([
|
loadStyle(this, lwcCSS)
|
]);
|
init({recordId:this.recordId}).then(res => {
|
console.log(res,'<======res')
|
let whiteList = [
|
'2S4_销售管理者',
|
'2S4_销售管理者(总监)',
|
'2S6-1_销售本部窗口',
|
'2S6-2_营业助理',
|
// '00e10000000NbCE',
|
'系统管理员',
|
'2J2_特约店担当'
|
]
|
if(res != null){
|
if(whiteList.indexOf(res.profileId) == -1){
|
this.showToast("你没有操作权限",'error');
|
return;
|
}
|
var accountType = res.departmentClassLabel;
|
var sectionMap = new Map();
|
sectionMap['消化科'] = 'GI';sectionMap['ET'] = 'ET';
|
sectionMap['呼吸科'] = 'BF';sectionMap['普外科'] = 'GS';
|
sectionMap['泌尿科'] = 'URO';sectionMap['妇科'] = 'GYN';
|
sectionMap['耳鼻喉科'] = 'ENT';sectionMap['其他'] = 'OTH';
|
var sectionApi= sectionMap[accountType];
|
//医院的传参
|
if(res.recordTypeId == 'ok'){
|
ReportId({TypeName:'DealerVisitDetailsHospital'}).then(request => {
|
// window.open('/'+ request +'?fv0='+res.name)
|
window.location.href = '/lightning/r/Report/'+ request +'/view'+'?fv0='+res.name
|
})
|
} else {
|
//战略科室的传参
|
ReportId({TypeName:'Agency_Activity'}).then(request => {
|
// window.open('/'+ request +'?fv0='+ res.name +'&fv1='+sectionApi)
|
window.location.href = '/lightning/r/Report/'+ request +'/view'+'?fv0='+ res.name +'&fv1='+sectionApi
|
})
|
}
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
})
|
|
}
|
|
showToast(msg, type) {
|
if(type == 'success'){
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.dispatchEvent(event);
|
}else{
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type,
|
mode:'Sticky'
|
});
|
this.dispatchEvent(event);
|
}
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|