/*
|
* @Description: 备品检测分析报告
|
* @Author: [lijinhuan]
|
* @Date: 2023-06-25 17:32:18
|
* @LastEditors: [lijinhuan]
|
* @LastEditTime: 2023-07-10 17:25:47
|
*/
|
import { LightningElement, track, wire, api } from 'lwc';
|
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
|
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
|
import { updateRecord } from 'lightning/uiRecordApi';
|
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import {loadStyle} from 'lightning/platformResourceLoader';
|
|
import init from '@salesforce/apex/lexRentalApplyFaultReportController.init';
|
|
const columns = [
|
{ label: 'No.', fieldName: 'Name',type: 'text'},
|
{ label: '备品配套明细型号', fieldName: 'Fixture_Model_No__c',type: 'text' },
|
{ label: '固定资产号码', fieldName: 'Loaner_asset_no__c',type: 'text' },
|
{ label: '机身编码', fieldName: 'SerialNumber_F__c',type: 'text'},
|
{ label: '战略科室分类', fieldName: 'OCMdeptCategory',type: 'text' },
|
{ label: '医院', fieldName: 'Hospital',type: 'text' },
|
{ label: '检测结果', fieldName: 'Inspection_result_after__c',type: 'text'},
|
{ label: '检测NG区分', fieldName: 'Inspection_result_after_NG__c',type: 'text'},
|
{
|
type: "button", label: '故障报告', initialWidth: 130, typeAttributes: {
|
label: '故障报告',
|
name: 'View',
|
title: '故障报告',
|
disabled: false,
|
value: 'RentalApplyFault',
|
iconPosition: 'left',
|
iconName:'utility:preview',
|
variant:'Brand'
|
}
|
},
|
|
];
|
export default class LexRentalApplyFaultReport extends NavigationMixin(LightningElement) {
|
@api recordId;
|
IsLoading = true;
|
datas = [];
|
columns = columns;
|
selectedRas = [];
|
RentalApplyName;
|
PersonInCharge;
|
WorkPlace;
|
DemoPurpose2;
|
@track error;
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference){
|
if(currentPageReference) {
|
const urlValue = currentPageReference.state.recordId;
|
if(urlValue) {
|
let str = `${urlValue}`;
|
this.recordId = str;
|
}
|
}
|
}
|
|
connectedCallback(){
|
Promise.all([
|
loadStyle(this,lwcCSS)
|
]);
|
init({
|
recordId: this.recordId
|
}).then(result=>{
|
console.log('========result========',JSON.stringify(result));
|
if(JSON.stringify(result) != 'null'){
|
window.open('/apex/Rental_Apply_FaultReport?ra_id='+ this.recordId);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
this.dispatchEvent(new CloseActionScreenEvent());
|
// console.log('没有回收检测NG的一览');
|
this.showToast('没有回收检测NG的一览','warning');
|
this.updateRecordView(this.recordId);
|
return;
|
}
|
}).catch(err=>{
|
console.log("error:" + error.getMessage());
|
console.log(err);
|
this.error = err;
|
}).finally(()=>{
|
|
});
|
}
|
|
|
callRowAction(event) {
|
const rec = event.detail.row;
|
const actionName = event.detail.action.name;
|
// console.log(actionName);
|
if (actionName === 'View') {
|
console.log(rec.RentalApplyFault);
|
const recordId = rec.RentalApplyFault;
|
// this.handleAction(rec, 'view');
|
if(recordId != null && recordId !=''){
|
this[NavigationMixin.Navigate]({
|
type: 'standard__recordPage',
|
attributes: {
|
recordId: recordId,
|
objectApiName: 'Rental_Apply_Fault__c',
|
actionName: 'view'
|
}
|
})
|
// window.open("/"+faultId);
|
}else{
|
console.log('zheli00');
|
console.log('C:',rec);
|
// 新建跳转
|
// window.open("/a5C/e?
|
// Name=*"
|
// + "&CF00N10000009I5UX_lKid=" + radetailId
|
// + "&CF00N10000009I5UX=" + radetailName
|
// + "&CF00N10000009I5UV_lKid=" + personId
|
// + "&CF00N10000009I5UV=" + personName
|
// + "&00N10000009I5Uh=" + purpose2
|
// + "&00N10000009I5UW=" + name
|
// + "&00N10000009I6jv=" + hospitalName
|
// + "&00N10000009I5Ua=" + serialNumber
|
// + "&00N10000009I5UP=" + fixtureNo
|
// + "&00N10000009I5Uf=" + workPlace
|
// + "&00N10000009I5UU=" + deptCategory);
|
let defaultFieldValues = {};
|
// console.log('zheli01');
|
defaultFieldValues['Name'] = '*';
|
defaultFieldValues['Rental_Apply_Equipment_Set_Detail__c'] = rec.Id;
|
defaultFieldValues['Person_In_Charge_User__c']= rec.Rental_Apply__r.Person_In_Charge__c;
|
defaultFieldValues['demo_purpose2__c']= rec.Rental_Apply__r.demo_purpose2__c;
|
defaultFieldValues['RentalApplyNo__c']= rec.Rental_Apply__r.Name;
|
defaultFieldValues['HospitalText__c']= rec.Hospital;
|
defaultFieldValues['Repair_product_body_number__c']= rec.SerialNumber_F__c;
|
defaultFieldValues['Fixture_Model_No__c']= rec.Fixture_Model_No__c;
|
defaultFieldValues['WorkPlace__c']= rec.Rental_Apply__r.WorkPlace__c;
|
defaultFieldValues['OCM_dept_category__c']= rec.OCMdeptCategory;
|
this[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: 'Rental_Apply_Fault__c',
|
actionName: 'new'
|
},
|
state: {
|
nooverride: '1',
|
defaultFieldValues: encodeDefaultFieldValues(defaultFieldValues)
|
}
|
});
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|
}
|
showToast(msg,type) {
|
if(type == 'success'){
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.updateRecordView(this.recordId);
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}else{
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type,
|
mode: 'sticky'
|
});
|
this.dispatchEvent(event);
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|
|
updateRecordView(recordId) {
|
updateRecord({fields: { Id: recordId }});
|
}
|
}
|