import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import init from '@salesforce/apex/QISReportController.initForlexCreateRepairButton';
|
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
|
import { updateRecord } from 'lightning/uiRecordApi';
|
|
export default class lexCreateRepair extends 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='';
|
hospitalId='';
|
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 = '';
|
|
@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 () {
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
this.IsLoading = false;
|
this.qisReportId = result.Id;
|
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.hospitalId = result.hospitalId;
|
this.hospitalname = result.hospitalname;
|
this.departmentClassname = result.departmentClassname;
|
this.departmentClassId = result.departmentClassId;
|
this.hospitalDepartment = result.hospitalDepartment;
|
this.nonyushohinId = result.nonyushohinId;
|
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;
|
if (this.qisRecordTypeId != '01210000000RLWc' && this.qisRecordTypeId != '01210000000RLWh') {
|
this.typeflag = true;
|
}
|
if (this.accParentId != null) {
|
if (this.accParentRecordTypeId != null) {
|
this.accrecordId = this.accParentRecordTypeId.substring(0,15);
|
if (this.accrecordId == '01210000000QemL' || this.accrecordId == '01210000000QezZ' || this.accrecordId == '01210000000QemQ') {
|
if (this.accParentParentFSEGIMainLeader != null) {
|
this.WorkLocation = this.accParentParentFSEGIMainLeaderWorkLocation;
|
}
|
}else if(this.accrecordId == '01210000000Qeze' || this.accrecordId == '01210000000Qezj' || this.accrecordId == '01210000000Qezt'|| this.accrecordId == '01210000000Qezo'|| this.accrecordId == '01210000000Qezy'){
|
if (this.accParentParentFSESPMainLeader != null) {
|
this.WorkLocation = this.accParentParentFSESPMainLeaderWorkLocation;
|
}
|
}
|
}
|
}
|
if ((this.oCMjudgement == '质量问题' && this.nextaction == '无偿维修') ||
|
(this.oCMjudgement == '质量问题' && this.nextaction == '有偿维修' && this.specialfollow == '0') ||
|
(this.oCMjudgement == '非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == '1') ||
|
(this.oCMjudgement == '非质量问题' && this.nextaction == '有偿维修' && this.specialfollow == '0') ||
|
(this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '无偿维修' && this.specialfollow == '1') ||
|
(this.oCMjudgement == '质量问题+非质量问题' && this.nextaction == '有偿维修+无偿维修' && this.specialfollow == '0') ||
|
(this.oCMjudgement == '现象未发现' && this.nextaction == '无偿维修' && this.specialfollow == '1') ||
|
(this.oCMjudgement == '现象未发现' && this.nextaction == '有偿维修' && this.specialfollow == '0')) {
|
this.newflag = true;
|
}
|
console.log('this.newflag = '+this.newflag);
|
console.log('this.typeflag = '+this.typeflag);
|
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 = '使用前准备-患者未麻醉';
|
}
|
var url = '';
|
url = "/a0J/e?" +
|
"CF00N10000002FIJU_lkid="+this.sourceOnCall+"&" +
|
"CF00N10000002FIJU="+this.sourceOnCallname+"&" +
|
"CF00N10000002FIJZ_lkid="+this.qisReportId+"&" +
|
"CF00N10000002FIJZ="+this.name+"&" +
|
"CF00N10000002Dx66_lkid="+this.hospitalId+"&" +
|
"CF00N10000002Dx66="+this.hospitalname+"&" +
|
"CF00N10000002Dx5t_lkid="+this.departmentClassId+"&" +
|
"CF00N10000002Dx5t="+this.departmentClassname+"&" +
|
"CF00N10000002Dx5n_lkid="+this.hospitalDepartment+"&" +
|
"CF00N10000002Dx5n="+this.hospitalDepartmentname+"&" +
|
"CF00N10000002Dx1X_lkid="+this.nonyushohinId+"&" +
|
"CF00N10000002Dx1X="+this.nonyushohinIdname+"&" +
|
"CF00N10000002EMHw_lkid="+this.ownerId+"&" +
|
"CF00N10000002EMHw="+this.ownername+"&" +
|
"00N10000002Dx5y="+this.faliourdate+"&" +
|
"00N10000002Dx6I="+this.comment+"&" +
|
"00N10000002FH86="+this.sourceforrepair+"&" +
|
"00N10000006P6Rn="+this.repairSalesPointProvinceChina+"&" +
|
"00N10000008rsVQ="+this.trableoccurdaYcollect+"&" +
|
"00N10000008rsW7="+this.damageForDocOrPat+"&"+
|
"00N10000008rsVw="+this.relationWithTheProblem+"&"+
|
"00N10000008rsW2="+this.reportForGoz+"&"+
|
"00N10000008rsW6="+this.whichProject+"&"+
|
"00N10000008rsVk="+this.operaName+"&" +
|
"00N10000008rsVN="+this.breakORFallOff+"&"+
|
"00N10000008rsW4="+this.setusageproduct+"&" +
|
"00N10000008rsVL="+this.afterFailureInformation+"&" +
|
"00N10000008rsVR="+this.delay15Min+"&"+
|
"00N10000008rsVZ="+this.informationFrom+"&"+
|
"00N10000008rsVT="+this.failureQInHospital+"&" +
|
"00N10000008rsVv="+this.failuerSituation+"&"+
|
"00N10000008rsW5="+this.UseFailProductFinish+ "&" +
|
"00N10000006P6SM="+this.WorkLocation+ "&" +
|
"retURL=%2F"+this.qisReportId;
|
window.open(url, "_blank");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
const evt = new ShowToastEvent({
|
title : '该QIS不能新建修理',
|
message: '',
|
variant: 'error'
|
});
|
this.dispatchEvent(evt);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
}).catch(error => {
|
|
const evt = new ShowToastEvent({
|
title : '发生错误',
|
message: '',
|
variant: 'error'
|
});
|
this.dispatchEvent(evt);
|
|
this.dispatchEvent(new CloseActionScreenEvent());
|
console.log('error='+error);
|
return;
|
}).finally(() => {
|
|
});
|
}
|
}
|