| | |
| | | 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 { NavigationMixin } from 'lightning/navigation'; |
| | | import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; |
| | | 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=''; |
| | | /* |
| | | * @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=''; |
| | |
| | | UseFailProductFinish=''; |
| | | failuerSituation=''; |
| | | sourceOnCall=''; |
| | | hospitalId=''; |
| | | departmentClassId=''; |
| | | hospitalId1; |
| | | departmentClassId; |
| | | hospitalDepartment=''; |
| | | nonyushohinId=''; |
| | | ownerId=''; |
| | | nonyushohinId; |
| | | ownerId; |
| | | faliourdate=''; |
| | | sourceforrepair=''; |
| | | repairSalesPointProvinceChina=''; |
| | |
| | | hospitalDepartmentname = ''; |
| | | nonyushohinIdname = ''; |
| | | sourceOnCallname = ''; |
| | | oneFSE = ''; |
| | | twoOCSM = ''; |
| | | huxi = ''; |
| | | xiaohua = ''; |
| | | eT = ''; |
| | | puwai = ''; |
| | | miniao = ''; |
| | | fuke = ''; |
| | | erbihou = ''; |
| | | qita = ''; |
| | | |
| | | @wire(CurrentPageReference) |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | console.log(111); |
| | | console.log(currentPageReference); |
| | |
| | | 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.accParentId = result.accParentId; |
| | | this.comment = result.comment; |
| | | if (result.sourceOnCall!=null) { |
| | | this.sourceOnCall = result.sourceOnCall; |
| | | this.sourceOnCallname = result.sourceOnCallname; |
| | | this.sourceOnCall = result.sourceOnCall; |
| | | this.sourceOnCallname = result.sourceOnCallname; |
| | | } |
| | | this.name = result.name; |
| | | this.hospitalId = result.hospitalId; |
| | | this.hospitalId1 = result.hospitalId; |
| | | this.hospitalname = result.hospitalname; |
| | | this.departmentClassname = result.departmentClassname; |
| | | this.departmentClassId = result.departmentClassId; |
| | |
| | | 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 == 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.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); |
| | | |
| | | 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: '', |
| | | 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, |
| | | 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: { |
| | | nooverride: '1', |
| | | defaultFieldValues: defaultFieldValues |
| | | } |
| | | }); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | }else{ |
| | | const evt = new ShowToastEvent({ |
| | | title : '', |
| | | message: '该QIS不能新建修理', |
| | | variant: 'error' |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | }).catch(error => { |
| | | |
| | | const evt = new ShowToastEvent({ |
| | | title : '发生错误', |
| | | message: '', |
| | | title : '', |
| | | message: '发生错误', |
| | | variant: 'error' |
| | | }); |
| | | this.dispatchEvent(evt); |
| | | |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | console.log('error='+error); |
| | | return; |
| | | return; |
| | | }).finally(() => { |
| | | |
| | | }); |