import {
|
LightningElement,
|
wire,
|
api
|
} from 'lwc';
|
import {
|
CurrentPageReference
|
} from "lightning/navigation";
|
import {
|
CloseActionScreenEvent
|
} from 'lightning/actions';
|
import init from '@salesforce/apex/otherButtonRepairController.init';
|
import selecctOnCallC from '@salesforce/apex/otherButtonRepairController.selecctOnCallC';
|
import selecctAccountById from '@salesforce/apex/otherButtonRepairController.selecctAccountById';
|
import selecctUser from '@salesforce/apex/otherButtonRepairController.selecctUser';
|
import selecctAccountBySegmentId from '@salesforce/apex/otherButtonRepairController.selecctAccountBySegmentId';
|
|
export default class LexCreateRepairFromOnCall extends LightningElement {
|
@api recordId;
|
str;
|
IsLoading = true;
|
Id;
|
RepairSalesPointProvinceChinaC;
|
OnCallId;
|
OnCallName;
|
OnCallSegmentC;
|
OnCallHPC;
|
OnCallHospitalIdC;
|
OnCallSalesdepartmentHPIDC;
|
OnCallSalesdepartmentHPC;
|
OnCallOncallEquipmentC;
|
OnCallTrableOccurdaYCollectC;
|
|
@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.IsLoading = false;
|
this.Id = result.Id;
|
|
this.CreateRepairFromOnCall();
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}).catch(error => {
|
console.log(error);
|
})
|
}
|
|
//新建修理
|
CreateRepairFromOnCall() {
|
selecctOnCallC().then(result => {
|
console.log(result);
|
if (result != null) {
|
this.OnCallId = result.Id;
|
this.OnCallName = result.Name;
|
this.OnCallSegmentC = result.segment__c;
|
this.OnCallHPC = result.HP__c;
|
this.OnCallHospitalIdC = result.HospitalId__c;
|
this.OnCallSalesdepartmentHPIDC = result.Salesdepartment_HP_ID__c;
|
this.OnCallSalesdepartmentHPC = result.Salesdepartment_HP__c;
|
this.OnCallOncallEquipmentC = result.Oncall_Equipment__c;
|
this.OnCallTrableOccurdaYCollectC = result.Trable_occur_daY_collect_c__c;
|
}
|
})
|
|
selecctUser().then(result => {
|
console.log(result);
|
if (result != null) {
|
this.RepairSalesPointProvinceChinaC = result.RepairSalesPoint_Province_China__c
|
}
|
})
|
|
//LJPH-BYZ4JT 【委托】修理画面“修理品返送地”问题调查-后续 精琢技术 wql 20210311 start
|
var List;
|
selecctAccountById({
|
id: this.AccountId
|
}).then(result => {
|
console.log(result);
|
if (result != null) {
|
List = result;
|
}
|
})
|
var RecordTypeId;
|
if (List['records']['ParentId']) {
|
RecordTypeId = List['records']['Parent']['RecordTypeId'].substring(0, 15);
|
}
|
|
//LJPH-BSLCA4 <委托>修理画面“修理品返送地”问题调查 精琢技术 wql 20200819 start
|
//LJPH-BYZ4JT 【委托】修理画面“修理品返送地”问题调查-后续 精琢技术 wql 20210311 start
|
//检索客户
|
var account;
|
selecctAccountBySegmentId({
|
segmentId: this.OnCallSegmentC
|
}).then(result => {
|
console.log(result);
|
if (result != null) {
|
account = result;
|
}
|
})
|
|
var Work_Location = '';
|
var Incharge_Staff = '';
|
var Incharge_Staff_id = '';
|
if (account[0].ParentId != null) {
|
|
|
if (account[0].Parent.RecordTypeId != null || account[0].Parent.RecordTypeId != '') {
|
var recordId = account[0].Parent.RecordTypeId.substring(0, 15);
|
//战略科室取消化科、呼吸科、ET 取GI主担当
|
if (recordId == '01210000000QemL' || recordId == '01210000000QezZ' || recordId == '01210000000QemQ') {
|
if (account[0].Parent.Parent.FSE_GI_Main_Leader__c != null) {
|
Work_Location = account[0].Parent.Parent.FSE_GI_Main_Leader__r.Work_Location__c;
|
}
|
|
}
|
//战略科室取普外科、泌尿科、耳鼻喉科、妇科、其它 取SP主担当
|
else if (recordId == '01210000000Qeze' || recordId == '01210000000Qezj' || recordId == '01210000000Qezt' || recordId == '01210000000Qezo' || recordId == '01210000000Qezy') {
|
if (account[0].Parent.Parent.FSE_SP_Main_Leader__c != null) {
|
Work_Location = account[0].Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;
|
}
|
}
|
}
|
//LJPH-BYZ4JT 【委托】修理画面“修理品返送地”问题调查-后续 精琢技术 wql 20210311 end
|
//LJPH-BSLCA4 <委托>修理画面“修理品返送地”问题调查 精琢技术 wql 20200819 end
|
var FSE_GI_Main_Leader__id = '';
|
var FSE_GI_Main_Leader__name = '';
|
var FSE_SP_Main_Leader__id = '';
|
var FSE_SP_Main_Leader__name = '';
|
if (List['records']['Parent']['Parent']['FSE_GI_Main_Leader__c'] != null) {
|
FSE_GI_Main_Leader__id = List['records']['Parent']['Parent']['FSE_GI_Main_Leader__c'].substring(0, 15);
|
FSE_GI_Main_Leader__name = List['records']['Parent']['Parent']['FSE_GI_Main_Leader__r']['Name'];
|
}
|
if (List['records']['Parent']['Parent']['FSE_SP_Main_Leader__c'] != null) {
|
FSE_SP_Main_Leader__id = List['records']['Parent']['Parent']['FSE_SP_Main_Leader__c'].substring(0, 15);
|
FSE_SP_Main_Leader__name = List['records']['Parent']['Parent']['FSE_SP_Main_Leader__r']['Name'];
|
}
|
|
if (RecordTypeId == '01210000000QemL') {
|
Incharge_Staff = FSE_GI_Main_Leader__name;
|
Incharge_Staff_id = FSE_GI_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000QezZ') {
|
Incharge_Staff = FSE_GI_Main_Leader__name;
|
Incharge_Staff_id = FSE_GI_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000QemQ') {
|
Incharge_Staff = FSE_GI_Main_Leader__name;
|
Incharge_Staff_id = FSE_GI_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000Qeze') {
|
Incharge_Staff = FSE_SP_Main_Leader__name;
|
Incharge_Staff_id = FSE_SP_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000Qezj') {
|
Incharge_Staff = FSE_SP_Main_Leader__name;
|
Incharge_Staff_id = FSE_SP_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000Qezt') {
|
Incharge_Staff = FSE_SP_Main_Leader__name;
|
Incharge_Staff_id = FSE_SP_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000Qezo') {
|
Incharge_Staff = FSE_SP_Main_Leader__name;
|
Incharge_Staff_id = FSE_SP_Main_Leader__id;
|
}
|
if (RecordTypeId == '01210000000Qezy') {
|
Incharge_Staff = FSE_SP_Main_Leader__name;
|
Incharge_Staff_id = FSE_SP_Main_Leader__id;
|
}
|
}
|
var url = "/a0J/e?CF00N10000002FIJU_lkid=" + this.OnCallId + "&CF00N10000002FIJU=" + this.OnCallName + "&CF00N10000002Dx66_lkid=" + this.OnCallHospitalIdC + "&CF00N10000002Dx66=" + this.OnCallHPC + "&CF00N10000002Dx5t_lkid=" + this.OnCallSalesdepartmentHPIDC + "&CF00N10000002Dx5t=" + this.OnCallSalesdepartmentHPC + "&CF00N10000002Dx5n_lkid=" + this.OnCallSegmentC + "&CF00N10000002Dx5n=" + this.OnCallSegmentC + "&CF00N10000002Dx1X_lkid=" + this.OnCallOncallEquipmentC + "&CF00N10000002Dx1X=" + this.OnCallOncallEquipmentC + "&CF00N10000002EMHw_lkid=" + Incharge_Staff_id + "&CF00N10000002EMHw=" + Incharge_Staff + "&00N10000002Dx5y=" + this.OnCallTrableOccurdaYCollectC + "&00N10000002FH86=%e4%bb%8eOn-Call&00N10000006P6Rn=" + this.RepairSalesPointProvinceChinaC + "&00N10000006P6SM=" + encodeURI(Work_Location) + "&retURL=%2F" + this.OnCallId;
|
window.open(url);
|
}
|
}
|