| force-app/main/default/classes/lexRentalApplyFaultReportController.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/classes/lexRentalApplyFaultReportController.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.js-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
force-app/main/default/classes/lexRentalApplyFaultReportController.cls
New file @@ -0,0 +1,73 @@ /* * @Description: 备品检测分析报告 * @Author: [lijinhuan] * @Date: 2023-06-25 20:04:41 * @LastEditors: [lijinhuan] * @LastEditTime: 2023-07-06 15:50:03 */ public without sharing class lexRentalApplyFaultReportController { @AuraEnabled public static List<RetObject> init(String recordId){ try { List<RetObject> retObjectList = new List<RetObject>(); //备品借出申请一览明细 List<Rental_Apply_Equipment_Set_Detail__c> eList = [ SELECT Id, Name, Rental_Apply__r.OCM_dept_category__c, Rental_Apply__r.Name, Rental_Apply__r.Person_In_Charge__c, Rental_Apply__r.Person_In_Charge__r.Name, Rental_Apply__r.demo_purpose2__c, Rental_Apply__r.WorkPlace__c, Rental_Apply__r.Hospital__r.Name, Loaner_asset_no__c, AssetName__c, Fixture_Model_No__c, SerialNumber_F__c, Inspection_result_after__c, Inspection_result_after_NG__c FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = :recordId AND Inspection_result_after__c = 'NG' AND Is_Body__c = true ORDER BY Id]; List<Id> eIds = new List<Id>(); for(Rental_Apply_Equipment_Set_Detail__c e :eList){ eIds.add(e.Id); } //查当前明细下有多少故障报告 // 0 没有报告 // Id 有 最新一条为草案中 // 2 有很多条 Map<String,String> sIdMap = New Map<String,String>(); for(Rental_Apply_Fault__c raf : [SELECT Id ,status__c ,Rental_Apply_Equipment_Set_Detail__c from Rental_Apply_Fault__c where Rental_Apply_Equipment_Set_Detail__c in :eIds Order By CreatedDate DESC]){ if(!sIdMap.containsKey(raf.Rental_Apply_Equipment_Set_Detail__c)){ sIdMap.put(raf.Rental_Apply_Equipment_Set_Detail__c,raf.Id); } } for(Rental_Apply_Equipment_Set_Detail__c rae : eList){ RetObject temp = new RetObject(); temp.rae = rae; if(sIdMap.containsKey(rae.Id)){ temp.faultId = sIdMap.get(rae.Id) ; }else{ temp.faultId = ''; } retObjectList.add(temp); } return retObjectList; } catch (Exception e) { System.debug('*******lexRentalApplyFaultReportController******'+e.getMessage()); } return null; } public class RetObject { @AuraEnabled public Rental_Apply_Equipment_Set_Detail__c rae; @AuraEnabled public String faultId; } } force-app/main/default/classes/lexRentalApplyFaultReportController.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>57.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.html
New file @@ -0,0 +1,52 @@ <!-- * @Description: 备品检测分析报告 * @Author: [lijinhuan] * @Date: 2023-06-25 17:32:18 * @LastEditors: [lijinhuan] * @LastEditTime: 2023-07-05 19:31:34 --> <template> <article class="slds-card" if:false={IsLoading} > <!-- 样式头 --> <div class="slds-card__header slds-grid" > <header class="slds-media slds-media_center slds-has-flexi-truncate"> <div class="slds-media__body"> <h2 class="slds-card__header-title"> <!-- <a href="#" class="slds-card__header-link slds-truncate" title="备品检测分析报告"> --> <span>备品检测分析报告</span> <!-- </a> --> </h2> </div> </header> </div> <!-- 样式头 --> <div class="slds-card__body slds-card__body_inner" > <div > <!-- 申请No.--> <label class="slds-form-element__label" style="width:23%;text-align:right; margin-left: 20px;"> 申请No.:</label> <div class="slds-form-element__control" style="width:23%; text-align:left;display: inline-block;">{RentalApplyName}</div> <!-- 备品出借担当 --> <label class="slds-form-element__label" style="width:23%;text-align:right;margin-left: 15px;">备品出借担当:</label> <div class="slds-form-element__control" style="width:23%; text-align:left;display: inline-block;">{PersonInCharge}</div> <!-- 申请者办事处 --> <label class="slds-form-element__label" style="width:23%;text-align:right; margin-left: 20px;"> 申请No.:</label> <div class="slds-form-element__control" style="width:23%; text-align:left;display: inline-block;">{WorkPlace}</div> <!-- 使用目的2 --> <label class="slds-form-element__label" style="width:23%;text-align:right;margin-left: 15px;">使用目的2:</label> <div class="slds-form-element__control" style="width:23%; text-align:left;display: inline-block;">{DemoPurpose2}</div> </div> </div> </article> <div if:false={IsLoading} class="toast" style="width: 100%"> <div> <template if:true={datas}> <lightning-datatable key-field="Id" data={datas} columns={columns} hide-checkbox-column="true" hide-row-number-column="true" onrowaction={callRowAction}> </lightning-datatable> </template> <template if:true={error}> {error}> </template> </div> </div> </template> force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.js
New file @@ -0,0 +1,180 @@ /* * @Description: 备品检测分析报告 * @Author: [lijinhuan] * @Date: 2023-06-25 17:32:18 * @LastEditors: [lijinhuan] * @LastEditTime: 2023-07-06 16:04:00 */ 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 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(){ init({ recordId: this.recordId }).then(result=>{ if(JSON.stringify(result)!= '' && result.length>0){ this.IsLoading = false; this.records = result; let resultList = []; let objectTemp; result.forEach(item => { this.RentalApplyName = item.rae.Rental_Apply__r.Name; this.PersonInCharge = item.rae.Rental_Apply__r.Person_In_Charge__r.Name; this.WorkPlace = item.rae.Rental_Apply__r.WorkPlace__c; this.DemoPurpose2 = item.rae.Rental_Apply__r.demo_purpose2__c; // console.log(item); objectTemp = item.rae; objectTemp.OCMdeptCategory = item.rae.Rental_Apply__r.OCM_dept_category__c; objectTemp.Hospital = item.rae.Rental_Apply__r.Hospital__r.Name; // objectTemp.RentalApplyFault = '<a href="/'+item.faultId+'" >点击查看</a>'; objectTemp.RentalApplyFault = item.faultId; //console.log(JSON.stringify(objectTemp)); resultList.push(objectTemp); }); this.datas = resultList; }else{ // this.dispatchEvent(new CloseActionScreenEvent()); this.showToast('没有回收检测NG的一览','warning'); this.updateRecordView(this.recordId); return; } }).catch(err=>{ console.log("error:"); 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) { const event = new ShowToastEvent({ message: msg, variant: type }); if(type == 'success'){ this.updateRecordView(this.recordId); } this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } } force-app/main/default/lwc/lexRentalApplyFaultReport/lexRentalApplyFaultReport.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>57.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle>