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';
|
|
/*
|
* @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 = '';
|
|
@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;
|
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;
|
}
|
}
|
}
|
}
|
console.log('this.oCMjudgement = '+this.oCMjudgement);
|
console.log('this.nextaction = '+this.nextaction);
|
console.log('this.specialfollow = '+this.specialfollow);
|
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);
|
|
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(() => {
|
|
});
|
}
|
}
|