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/AccountUrlRecordTypeIdController.ReportId';
|
|
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(){
|
init({recordId:this.recordId}).then(res => {
|
console.log(res,'<======res')
|
let whiteList = [
|
'00e10000000xnpHAAQ',
|
'00e10000000hkasAAA',
|
'00e10000000xyK6AAI',
|
'00e10000000xnpRAAQ',
|
// '00e10000000NbCE',
|
'00e10000000Y3o5AAC'
|
]
|
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 == '01210000000QemGAAS'){
|
ReportId({TypeName:'DealerVisitDetailsHospital'}).then(request => {
|
window.open('/'+ request +'?pv='+res.Name)
|
})
|
} else {
|
ReportId({TypeName:'Agency_Activity'}).then(request => {
|
window.open('/'+ request +'?pv='+ res.HospitalDepartmentClass +'&pv='+sectionApi)
|
})
|
}
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
})
|
|
}
|
|
showToast(msg, type) {
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|