import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
|
import init from '@salesforce/apex/QISReportController.initForlexCreateRepairButton';
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import {loadStyle} from 'lightning/platformResourceLoader';
|
import LightningConfirm from 'lightning/confirm'; // WYL 贸易合规2期
|
import accSendEmailFW from '@salesforce/apex/buttonAssetCtl.accSendEmailFW'; // WYL 贸易合规2期 add
|
import IFTradeComplianceAlertName from '@salesforce/label/c.IFTradeComplianceAlertName';// WYL 贸易合规2期 add
|
/*
|
* @Description: 新建修理
|
* @Author: hql
|
* @Date: 2023-07-12 09:45:19
|
* @LastEditTime: 2023-07-12 15:44:33
|
* @LastEditors:
|
*/
|
export default class lexCreateRepair extends NavigationMixin(LightningElement) {
|
@api recordId;
|
IsLoading = true;
|
typeflag = false;
|
newflag = false;
|
qisReportId='';
|
name='';
|
qisRecordTypeId='';
|
err='';
|
accParentId='';
|
accParentRecordTypeId='';
|
accParentParentFSEGIMainLeader='';
|
accParentParentFSEGIMainLeaderWorkLocation='';
|
accParentParentFSESPMainLeader='';
|
accParentParentFSESPMainLeaderWorkLocation='';
|
WorkLocation='';
|
accrecordId='';
|
oCMjudgement='';
|
nextaction='';
|
specialfollow='';
|
comment='';
|
isUsedForTheOpera='';
|
UseFailProductFinish='';
|
failuerSituation='';
|
sourceOnCall='';
|
hospitalId1;
|
departmentClassId;
|
hospitalDepartment='';
|
nonyushohinId;
|
ownerId;
|
faliourdate='';
|
sourceforrepair='';
|
repairSalesPointProvinceChina='';
|
trableoccurdaYcollect='';
|
damageForDocOrPat='';
|
relationWithTheProblem='';
|
reportForGoz='';
|
whichProject='';
|
operaName='';
|
breakORFallOff='';
|
setusageproduct='';
|
afterFailureInformation='';
|
delay15Min='';
|
informationFrom='';
|
failureQInHospital='';
|
ownername='';
|
hospitalname = '';
|
departmentClassname = '';
|
hospitalDepartmentname = '';
|
nonyushohinIdname = '';
|
sourceOnCallname = '';
|
oneFSE = '';
|
twoOCSM = '';
|
huxi = '';
|
xiaohua = '';
|
eT = '';
|
puwai = '';
|
miniao = '';
|
fuke = '';
|
erbihou = '';
|
qita = '';
|
// WYL 贸易合规2 start
|
hosTradeComplianceStatus;
|
ProductCompliance;
|
HospitalN;
|
Asset_Model_No;
|
state;
|
OwnerEmail;
|
userEmail;
|
// WYL 贸易合规2 end
|
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
console.log(111);
|
console.log(currentPageReference);
|
|
if (currentPageReference) {
|
const urlValue = currentPageReference.state.recordId;
|
if (urlValue) {
|
let str = `${urlValue}`;
|
console.log("str");
|
console.log(str);
|
this.recordId = str;
|
}
|
}
|
}
|
|
connectedCallback () {
|
Promise.all([
|
loadStyle(this, lwcCSS)
|
]);
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log('init方法返回');
|
this.IsLoading = false;
|
this.oneFSE = result.oneFSE;
|
this.twoOCSM = result.twoOCSM;
|
this.qisReportId = result.Id;
|
this.huxi = result.huxi;
|
this.xiaohua = result.xiaohua;
|
this.eT = result.eT;
|
this.puwai = result.puwai;
|
this.erbihou = result.erbihou;
|
this.miniao = result.miniao;
|
this.fuke = result.fuke;
|
this.qita = result.qita;
|
this.oCMjudgement = result.oCMjudgement;
|
this.nextaction = result.nextaction;
|
this.ownername = result.ownername;
|
this.specialfollow = result.specialfollow;
|
this.qisRecordTypeId = result.qisRecordTypeId;
|
this.accParentId = result.accParentId;
|
this.comment = result.comment;
|
if (result.sourceOnCall!=null) {
|
this.sourceOnCall = result.sourceOnCall;
|
this.sourceOnCallname = result.sourceOnCallname;
|
}
|
this.name = result.name;
|
this.hospitalId1 = result.hospitalId;
|
this.hospitalname = result.hospitalname;
|
this.departmentClassname = result.departmentClassname;
|
this.departmentClassId = result.departmentClassId;
|
this.hospitalDepartment = result.hospitalDepartment;
|
this.nonyushohinId = result.nonyushohinId;
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
this.nonyushohinIdname = result.nonyushohinIdname;
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
this.ownerId = result.ownerId;
|
this.faliourdate = result.faliourdate;
|
this.sourceforrepair = result.sourceforrepair;
|
this.repairSalesPointProvinceChina = result.repairSalesPointProvinceChina;
|
this.trableoccurdaYcollect = result.trableoccurdaYcollect;
|
this.damageForDocOrPat = result.damageForDocOrPat;
|
this.relationWithTheProblem = result.relationWithTheProblem;
|
this.reportForGoz = result.reportForGoz;
|
this.whichProject = result.whichProject;
|
this.operaName = result.operaName;
|
this.breakORFallOff = result.breakORFallOff;
|
this.setusageproduct = result.setusageproduct;
|
this.afterFailureInformation = result.afterFailureInformation;
|
this.delay15Min = result.delay15Min;
|
this.informationFrom = result.informationFrom;
|
this.failureQInHospital = result.failureQInHospital;
|
this.failuerSituation = result.failuerSituation;
|
this.isUsedForTheOpera = result.isUsedForTheOpera;
|
this.accParentRecordTypeId = result.accParentRecordTypeId;
|
this.accParentParentFSEGIMainLeader = result.accParentParentFSEGIMainLeader;
|
this.accParentParentFSEGIMainLeaderWorkLocation = result.accParentParentFSEGIMainLeaderWorkLocation;
|
this.accParentParentFSESPMainLeader = result.accParentParentFSESPMainLeader;
|
this.accParentParentFSESPMainLeaderWorkLocation = result.accParentParentFSESPMainLeaderWorkLocation;
|
this.hosTradeComplianceStatus = result.hosTradeComplianceStatus; // WYL 贸易合规2
|
this.ProductCompliance = result.ProductCompliance; // WYL 贸易合规2
|
this.state = result.state;// WYL 贸易合规2
|
this.Asset_Model_No = result.Asset_Model_No;// WYL 贸易合规2
|
this.HospitalN = result.HospitalN;// WYL 贸易合规2
|
this.OwnerEmail = result.OwnerEmail;// WYL 贸易合规2
|
this.userEmail = result.userEmail;// WYL 贸易合规2期 add
|
console.info('state='+this.state+'===>Asset_Model_No='+this.Asset_Model_No);
|
if (this.qisRecordTypeId != this.oneFSE && this.qisRecordTypeId != this.twoOCSM) {
|
this.typeflag = true;
|
}
|
if (this.accParentId != null) {
|
if (this.accParentRecordTypeId != null) {
|
this.accrecordId = this.accParentRecordTypeId.substring(0,15);
|
if (this.accrecordId == this.huxi || this.accrecordId == this.xiaohua || this.accrecordId == this.eT) {
|
if (this.accParentParentFSEGIMainLeader != null) {
|
this.WorkLocation = this.accParentParentFSEGIMainLeaderWorkLocation;
|
}
|
}else if(this.accrecordId == this.erbihou || this.accrecordId == this.qita || this.accrecordId == this.fuke|| this.accrecordId == this.puwai || this.accrecordId == this.miniao){
|
if (this.accParentParentFSESPMainLeader != null) {
|
this.WorkLocation = this.accParentParentFSESPMainLeaderWorkLocation;
|
}
|
}
|
}
|
}
|
if ((this.oCMjudgement == '质量问题' && this.nextaction == '无偿维修') ||
|
(this.oCMjudgement == '质量问题' && this.nextaction == '有偿维修' && this.specialfollow == false) ||
|
(this.oCMjudgement == '非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == true) ||
|
(this.oCMjudgement == '非质量问题' && this.nextaction == '有偿维修' && this.specialfollow == false) ||
|
(this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == true) ||
|
(this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '有偿维修+无偿维修' && this.specialfollow == false) ||
|
(this.oCMjudgement == '现象未发现' && this.nextaction == '无偿维修' && this.specialfollow == true) ||
|
(this.oCMjudgement == '现象未发现' && this.nextaction == '有偿维修' && this.specialfollow == false)) {
|
this.newflag = true;
|
}
|
console.log('this.newflag = '+this.newflag);
|
console.log('this.typeflag = '+this.typeflag);
|
console.log("this.hosTradeComplianceStatus"+ this.hosTradeComplianceStatus);
|
// WYL 贸易合规2期 start
|
if (this.hosTradeComplianceStatus =='黑名单') {
|
const evt = new ShowToastEvent({
|
title : '',
|
message: '黑名单:存在贸易合规风险,无法新建,有问题请联系法务部贸易合规窗口'+IFTradeComplianceAlertName+'。',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
console.info('发送邮件');
|
accSendEmailFW({
|
accname:this.HospitalN,
|
mcid:this.recordId,
|
type:'1',
|
FseEmail : this.OwnerEmail,
|
state:this.state
|
})
|
.then(result=>{
|
return;
|
}).catch(err=>{
|
console.log('邮件错误'+error);
|
})
|
this.dispatchEvent(evt);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else if (this.hosTradeComplianceStatus =='冻结,人工审批中') {
|
const evt = new ShowToastEvent({
|
title : '',
|
message: '冻结清单:可能存在贸易合规风险,目前正在评估中(一般需5-10个工作日),暂时无法新建,有问题请联系法务部贸易合规窗口'+IFTradeComplianceAlertName+'。',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
} else if (this.hosTradeComplianceStatus =='警示名单' && this.ProductCompliance == '0') {
|
LightningConfirm.open({
|
message: '您此次申请的业务可能存在贸易合规风险,请联系法务本部贸易合规窗口'+IFTradeComplianceAlertName+'进一步评估(一般需5-10个工作日),请确定是否继续进行下面操作',
|
variant: 'headerless',
|
label: 'this is the aria-label value',
|
}).then(res=>{
|
if(res) {
|
if ( this.newflag && this.typeflag) {
|
if (this.isUsedForTheOpera == 'YES') {
|
this.UseFailProductFinish = '是';
|
}else if(this.isUsedForTheOpera == 'NO-用替代品完成了'){
|
this.UseFailProductFinish = '否-用替代品完成';
|
}else if(this.isUsedForTheOpera == 'NO-用其他公司的同类产品完成了'){
|
this.UseFailProductFinish = '否-用其他公司的同类产品完成';
|
}else if(this.isUsedForTheOpera == 'NO-手术中止'){
|
this.UseFailProductFinish = '否-手术中止';
|
}
|
if ('使用前准备' == this.failuerSituation) {
|
this.failuerSituation = '使用前准备-患者未麻醉';
|
}
|
|
const defaultFieldValues =encodeDefaultFieldValues({
|
On_Call_ID__c: this.sourceOnCall,
|
QIS_ID__c: this.qisReportId,
|
Hospital__c: this.hospitalId1,
|
Department_Class__c: this.departmentClassId,
|
Account__c:this.hospitalDepartment,
|
Delivered_Product__c:this.nonyushohinId,
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
AssetName:this.nonyushohinIdname,
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
Incharge_Staff__c:this.ownerId,
|
Failure_Occurrence_Date__c:this.faliourdate,
|
Repair_Detail__c:this.comment,
|
Repair_Source__c:this.sourceforrepair,
|
DateReceiptQuestions__c:this.trableoccurdaYcollect,
|
ifDeadHurt__c:this.damageForDocOrPat,
|
ProductFailureRelated__c:this.relationWithTheProblem,
|
ReportAdverseEvents__c:this.reportForGoz,
|
WhatProject__c:this.whichProject,
|
OperationOrExaminationName__c:this.operaName,
|
BreakORFallOff__c:this.breakORFallOff,
|
SupportingProducts__c:this.setusageproduct,
|
Delay15Min__c:this.delay15Min,
|
AfterFailureInformation__c:this.afterFailureInformation,
|
InformationFrom__c:this.informationFrom,
|
FailureQInHospital__c:this.failureQInHospital,
|
ProblemOccurred__c:this.failuerSituation,
|
UseFailProductFinish__c:this.UseFailProductFinish,
|
SalesOfficeCode_selection__c:this.WorkLocation
|
});
|
|
this[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: 'Repair__c',
|
actionName: 'new'
|
},
|
state: {
|
//update by 王雪琴 2023/08/09 Start
|
// nooverride: '1',
|
//update by 王雪琴 2023/08/09 End
|
defaultFieldValues: defaultFieldValues
|
}
|
});
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
const evt = new ShowToastEvent({
|
title : '',
|
message: '该QIS不能新建修理',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
}else{
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
});
|
console.info('发送邮件');
|
accSendEmailFW({
|
accname:this.HospitalN,
|
mcid:this.recordId,
|
type:'7',
|
state:this.state,
|
useremail : this.userEmail,
|
Asset_Model_No:this.Asset_Model_No
|
})
|
.then(result=>{
|
return;
|
}).catch(err=>{
|
console.log('邮件错误'+error);
|
})
|
// WYL 贸易合规2期 end
|
}// WYL 贸易合规2期 end
|
else if ( this.newflag && this.typeflag) {
|
if (this.isUsedForTheOpera == 'YES') {
|
this.UseFailProductFinish = '是';
|
}else if(this.isUsedForTheOpera == 'NO-用替代品完成了'){
|
this.UseFailProductFinish = '否-用替代品完成';
|
}else if(this.isUsedForTheOpera == 'NO-用其他公司的同类产品完成了'){
|
this.UseFailProductFinish = '否-用其他公司的同类产品完成';
|
}else if(this.isUsedForTheOpera == 'NO-手术中止'){
|
this.UseFailProductFinish = '否-手术中止';
|
}
|
if ('使用前准备' == this.failuerSituation) {
|
this.failuerSituation = '使用前准备-患者未麻醉';
|
}
|
|
const defaultFieldValues =encodeDefaultFieldValues({
|
On_Call_ID__c: this.sourceOnCall,
|
QIS_ID__c: this.qisReportId,
|
Hospital__c: this.hospitalId1,
|
Department_Class__c: this.departmentClassId,
|
Account__c:this.hospitalDepartment,
|
Delivered_Product__c:this.nonyushohinId,
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
AssetName:this.nonyushohinIdname,
|
//2023 08 25 张赫阳 PIPL按钮改造 start
|
Incharge_Staff__c:this.ownerId,
|
Failure_Occurrence_Date__c:this.faliourdate,
|
Repair_Detail__c:this.comment,
|
Repair_Source__c:this.sourceforrepair,
|
DateReceiptQuestions__c:this.trableoccurdaYcollect,
|
ifDeadHurt__c:this.damageForDocOrPat,
|
ProductFailureRelated__c:this.relationWithTheProblem,
|
ReportAdverseEvents__c:this.reportForGoz,
|
WhatProject__c:this.whichProject,
|
OperationOrExaminationName__c:this.operaName,
|
BreakORFallOff__c:this.breakORFallOff,
|
SupportingProducts__c:this.setusageproduct,
|
Delay15Min__c:this.delay15Min,
|
AfterFailureInformation__c:this.afterFailureInformation,
|
InformationFrom__c:this.informationFrom,
|
FailureQInHospital__c:this.failureQInHospital,
|
ProblemOccurred__c:this.failuerSituation,
|
UseFailProductFinish__c:this.UseFailProductFinish,
|
SalesOfficeCode_selection__c:this.WorkLocation
|
});
|
|
this[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: 'Repair__c',
|
actionName: 'new'
|
},
|
state: {
|
//update by 王雪琴 2023/08/09 Start
|
// nooverride: '1',
|
//update by 王雪琴 2023/08/09 End
|
defaultFieldValues: defaultFieldValues
|
}
|
});
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
const evt = new ShowToastEvent({
|
title : '',
|
message: '该QIS不能新建修理',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
}).catch(error => {
|
|
const evt = new ShowToastEvent({
|
title : '',
|
message: '发生错误',
|
variant: 'error',
|
mode: 'sticky'
|
});
|
this.dispatchEvent(evt);
|
|
this.dispatchEvent(new CloseActionScreenEvent());
|
console.log('error='+error);
|
return;
|
}).finally(() => {
|
|
});
|
}
|
}
|