force-app/main/default/lwc/lexApplyForRepair/lexApplyForRepair.js
@@ -10,11 +10,12 @@ CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/buttonRepairSubOrderCtl.init'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexApplyForRepair extends LightningElement { export default class lexApplyForRepair extends NavigationMixin(LightningElement) { @api recordId; str; IsLoading = true; @@ -36,7 +37,7 @@ init({ recordId: this.recordId }).then(result => { console.log(result); // console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; @@ -47,9 +48,7 @@ } }).catch(error => { console.log(error); }).finally(() => { }); }) } //申请修理 @@ -59,8 +58,23 @@ this.ShowToastEvent("报修子单的状态不是 待处理 无法申请修理", "error") return; } var url = '/apex/ChoiceAsset?Id=' + this.Id + '&Type=Repair'; window.open(url, '申请修理', 'height=700, width=1000, top=200, left=200, toolbar=no, menubar=no, scrollbars=no, location=no, status=no'); const paramMap = { Id: this.recordId// 添加参数到URL中,替换paramName和paramValue为实际的参数名和值 }; this[NavigationMixin.Navigate]({ type: 'standard__webPage', attributes: { url: '/lightning/n/Tab5', target: '_blank' // 替换为你的自定义页面的API名称或URL }, state: { params: JSON.stringify(paramMap) } }); // var url = '/apex/ChoiceAsset?Id=' + this.Id + '&Type=Repair'; // window.open(url, '申请修理', 'height=700, width=1000, top=200, left=200, toolbar=no, menubar=no, scrollbars=no, location=no, status=no'); } ShowToastEvent(msg, type) { force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.css
New file @@ -0,0 +1,12 @@ .toast{ border: 1px solid #c9c9c9; border-radius: 10px; width: 50%; margin: 0 auto; font-size: 18px; font-weight: bold; padding: 10px 20px; background: #EA001E; display: flex; color: white; } force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.html
New file @@ -0,0 +1,15 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </div> <div if:false={IsLoading} class="toast"> <span style="padding: 10px;">{msg}</span> <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick={closeAction} title="Close" style="background-color: #e5e4e2;margin-top: 15px;"> <lightning-icon class="greyIcon" icon-name="utility:close" alternative-text="Connected" variant="inverse" size="small" title="Close" style="color: black;"></lightning-icon> <span class="slds-assistive-text">Close</span> </button> </div> </template> force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.js
New file @@ -0,0 +1,219 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/buttonAssetCtl.init'; import selecctRepairByFomatToday from '@salesforce/apex/buttonAssetCtl.selecctRepairByFomatToday'; import selecctQISReportrByFomatToday from '@salesforce/apex/buttonAssetCtl.selecctQISReportrByFomatToday'; import selectCASE from '@salesforce/apex/buttonAssetCtl.selectCASE'; import selectNullvalue from '@salesforce/apex/buttonAssetCtl.selectNullvalue'; import LightningConfirm from 'lightning/confirm'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexCreateQISFromAsset extends NavigationMixin(LightningElement) { @api recordId; str; IsLoading = true; Id; day1; AssetMarkC; AssetOwnerC; InstallDate; PostingDateC; AssetDayC; SerialNumber; OrderNoC; ProductIDC; HospitalId; HospitalC; DepartmentClassId; DepartmentClassC; Name; AccountId; msg; Old_Repair_Name = ''; Instration_date_consumable = null; Customer_asset_or_loaner = ''; fomatToday; @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 => { console.log(result); if (result != null) { this.Id = result.Id; this.day1 = result.day1; this.AssetMarkC = result.AssetMarkC; this.AssetOwnerC = result.AssetOwnerC; this.InstallDate = result.InstallDate; this.PostingDateC = result.PostingDateC; this.AssetDayC = result.AssetDayC; this.SerialNumber = result.SerialNumber; this.OrderNoC = result.OrderNoC; this.ProductIDC = result.ProductIDC; this.HospitalId = result.HospitalId; this.HospitalC = result.HospitalC; this.DepartmentClassId = result.DepartmentClassId; this.DepartmentClassC = result.DepartmentClassC; this.Name = result.Name; this.AccountId = result.AccountId; this.CreateQISFromAsset(); } }).catch(error => { console.log(error); }) } // 新建授课/考核报告 CreateQISFromAsset() { this.fomatToday = this.day1; selecctQISReportrByFomatToday({ AssetId: this.Id, fomatToday: this.fomatToday }).then(records => { console.log(records); if (this.AssetMarkC == null || this.AssetMarkC == undefined) { this.ShowToastEvent('保有设备标记为空,请联系管理员补充。!', "error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (records.length >= 1) { this.handleConfirmClick01('请确认此件是否属于10天内重复报告,如果是,请使用原QIS里的复制功能重新提交。'); } else { this.ss(); } }) } ss() { selecctRepairByFomatToday({ AssetId: this.Id, fomatToday: this.fomatToday }).then(records2 => { if (this.AssetMarkC == '耗材') { selectCASE({ AssetOwnerC: this.AssetOwnerC }).then(result => { console.log(result); this.Customer_asset_or_loaner = result; }) selectNullvalue({ InstallDate: this.InstallDate, PostingDateC: this.PostingDateC, AssetDayC: this.AssetDayC }).then(result => { console.log(result); this.Instration_date_consumable = result; }) } if (records2.length >= 1) { this.Old_Repair_Name = records2[0].Name; } if (records2.length >= 1) { this.handleConfirmClick02('请确认此件是否属于10天内重复报告,如果是,需按照原先的维修信息填写。'); } else { this.ll(); } }) } ll() { const url = encodeDefaultFieldValues({ Name: "*", Hospital__c: this.HospitalId, Department_Class__c: this.DepartmentClassId, nonyushohin__c: this.Id, Generation_Source__c: "保有设备", Lots_No__c: this.SerialNumber, sell__c: this.Customer_asset_or_loaner, Instration_date_consumable__c: this.Instration_date_consumable, consumable__c: this.ProductIDC, contract_number_ET__c: this.OrderNoC, Hospital_Department__c: this.AccountId, Old_Repair_Name__c: this.Old_Repair_Name }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'QIS_Report__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: url } }); this.dispatchEvent(new CloseActionScreenEvent()); } async handleConfirmClick01(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value' }); if (result) { this.ss(); } else { this.dispatchEvent(new CloseActionScreenEvent()); } } async handleConfirmClick02(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value' }); if (result) { this.ll(); } else { this.dispatchEvent(new CloseActionScreenEvent()); } } ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } closeAction() { location.reload(); } } force-app/main/default/lwc/lexCreateQISFromAsset/lexCreateQISFromAsset.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>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
@@ -17,7 +17,7 @@ ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexDiscountRequest extends LightningElement { export default class lexDiscountRequest extends LightningElement { @api recordId; str; IsLoading = true; force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js
@@ -15,7 +15,7 @@ ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOSHNogoods extends LightningElement { export default class lexOSHNogoods extends LightningElement { @api recordId; str; IsLoading = true; force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js
New file @@ -0,0 +1,49 @@ import { LightningElement, api } from 'lwc'; import { NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import checkStatus from '@salesforce/apex/LexQISCloneButtonController.checkStatus' export default class lexQISCloneButton extends NavigationMixin(LightningElement) { @api recordId; connectedCallback(){ window.clearTimeout(this.delayTimeout); this.delayTimeout = setTimeout(() => { this.handleClick(); }, 0); } handleClick(){ checkStatus({recordId: this.recordId}) .then(result => { console.log('result:', result); if (result) { var pageurl = '/lightning/cmp/c__LexQISPIPLAura?c__isClone=true&c__recordId=' + this.recordId; this.navigate(pageurl); } else { const evt = new ShowToastEvent({ title: 'Warning', message: '状态为取消的QIS才可以被复制并新建', variant: 'warning', mode: 'dismissable' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); }) } navigate(pageurl) { this[NavigationMixin.GenerateUrl]({ type: 'standard__webPage', attributes: { url: pageurl } }).then(generatedUrl => { setTimeout(() => { window.open(generatedUrl, '_self'); }, 0); }); } } force-app/main/default/lwc/lexQISCloneButton/lexQISCloneButton.js-meta.xml
New file @@ -0,0 +1,9 @@ <?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__RecordAction</target> <target>lightning__RecordPage</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.html
@@ -1,6 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js
@@ -11,10 +11,16 @@ } from 'lightning/actions'; import init from '@salesforce/apex/buttonQISReportCtl.init'; import { NavigationMixin } from 'lightning/navigation'; import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexQISMBCrequestNew extends LightningElement { export default class lexQISMBCrequestNew extends NavigationMixin(LightningElement) { @api recordId; str; IsLoading = true; @@ -46,6 +52,7 @@ this.QISMBCRequestNew(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); @@ -55,13 +62,27 @@ // 新建QIS M-BC申请. QISMBCRequestNew() { var status = this.QISStatusC; if (status != '完毕' && status != '已回答' && status != '取消') { this.ShowToastEvent("QIS没有审批完毕或取消,不可以创建QIS M-BC!", "error"); return; } var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id; window.top.location.href = url; const url = encodeDefaultFieldValues({ Name: this.Name, QIS_request_name__c: this.Id }); this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'QIS_M_BC__c', actionName: 'new' }, state: { nooverride: '1', defaultFieldValues: url } }); // var url = "a20/e?retURL=%2Fa20%2Fo&Name=" + this.Name + "&CF00N10000006Q4NP_lkid=" + this.Id; // window.open(url); } ShowToastEvent(msg, type) { force-app/main/default/lwc/lexQISMBCrequestNew/lexQISMBCrequestNew.js-meta.xml
@@ -7,5 +7,6 @@ <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> <target>lightning__FlowScreen</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexRentalApplyDiscountApproval/lexRentalApplyDiscountApproval.js
@@ -16,7 +16,7 @@ ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexRentalApplyDiscountApproval extends LightningElement { export default class lexRentalApplyDiscountApproval extends LightningElement { @api recordId; str; IsLoading = true; force-app/main/default/lwc/lexSCSubmit/lexSCSubmit.js
@@ -16,7 +16,7 @@ } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; export default class LexSCSubmit extends LightningElement { export default class lexSCSubmit extends LightningElement { @api recordId; str; IsLoading = true; force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.html
@@ -2,5 +2,6 @@ <div class="toReportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> <lightning-button onclick={handleConfirmClick} label="Open Confirm Modal"></lightning-button> </div> </template> force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js
@@ -17,8 +17,9 @@ import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import LightningConfirm from 'lightning/confirm'; export default class LexSendQISToEtQ extends LightningElement { export default class lexSendQISToEtQ extends LightningElement { @api recordId; str; IsLoading = true; @@ -32,6 +33,7 @@ ETQUPLOADSTATUSC; AEDetermineResultC; profileName; statu = ''; @wire(CurrentPageReference) getStateParameters(currentPageReference) { @@ -50,7 +52,6 @@ }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.userId = result.userId; this.profileId = result.profileId; @@ -72,7 +73,6 @@ this.myReload(); } }) this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); @@ -89,31 +89,51 @@ // 发送QIS到EtQ SendQISToEtQ() { console.log(this.profileName); var QId = this.Id; var uid = this.userId; if (this.profileName != "2F7_OSH担当" && this.profileName != "2F7_OSH质量法规") { alert("您没有发送QIS到EtQ的权限。"); this.ShowToastEvent("您没有发送QIS到EtQ的权限。", "error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.PAEDetermineC == undefined) { alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。"); this.ShowToastEvent("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。", "error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE" && this.OCMJudgementC == undefined && this.QISFinalJudgementC == undefined) { alert("nonAE并nonPAE的QIS同步到EtQ的时候,检测结论(OCSM)是必填的。不可以发送到EtQ。"); this.ShowToastEvent("nonAE并nonPAE的QIS同步到EtQ的时候,检测结论(OCSM)是必填的。不可以发送到EtQ。", "error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.ETQUPLOADSTATUSC == "3") { if (!confirm("是否清空EtQ同步状态,重新同步数据?")) { return; } this.handleConfirmClick("是否清空EtQ同步状态,重新同步数据?"); } else { this.ll(); } } var statu = ''; myReload() { selectQISReportC({ QId: this.Id }).then(record => { console.log(record); if (record[0].AsyncData__c == 'true' && record[0].ETQ_UPLOAD_STATUS__c != '3' || record[0].Complaint_Number__c != null) { var btns = document.getElementsByName("sendqistoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } this.ShowToastEvent('该QIS之前已经发送过了', "error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } else { this.SendQISToEtQ(); } }) } ll() { if (this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC == undefined) { statu = "Q1"; this.statu = "Q1"; } else if ( (this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != "nonPAE" && this.PAEDetermineACC != undefined) || (this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE") && @@ -123,61 +143,43 @@ (this.QISFinalJudgementC == undefined || this.QISFinalJudgementC == "质量问题")) || (this.OCMJudgementC == "非质量问题" || this.OCMJudgementC == "现象未发现") && this.QISFinalJudgementC == "质量问题")) { statu = "Q2"; this.statu = "Q2"; } else if ((this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE") && ((this.OCMJudgementC == undefined || this.OCMJudgementC == "质量问题" || this.OCMJudgementC == "质量问题+非质量问题") && this.QISFinalJudgementC == "非质量问题") || ((this.OCMJudgementC == "非质量问题" || this.OCMJudgementC == "现象未发现") && (this.QISFinalJudgementC == undefined || this.QISFinalJudgementC == "非质量问题"))) { statu = "Q3"; this.statu = "Q3"; } try { updateQISReportC({ QId: QId, uid: uid }) updateQISReportC({ QId: this.Id, uid: this.userId }) var qisreports = new Array() qisreports[0] = this.Id; var qisreports = new Array() qisreports[0] = this.Id; var statuArr = new Array(); statuArr.push(statu); var statuArr = new Array(); statuArr.push(this.statu); sendToETQ({ iflog_Id: "", rowDataSFDC: "", repairIds: qisreports, statu: statuArr[0] }).then(result => { alert(result); }) alert("发送成功!") var btns = document.getElementsByName("sendqistoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } location.reload(); } catch (error) { alert("发送QIS到EtQ失败" + error.faultstring + ' code:' + error.faultcode) } } myReload() { selectQISReportC({ QId: this.Id }).then(record => { console.log(record); if (record[0].AsyncData__c == 'true' && record[0].ETQ_UPLOAD_STATUS__c != '3' || record[0].Complaint_Number__c != null) { var btns = document.getElementsByName("sendqistoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } alert('该QIS之前已经发送过了') sendToETQ({ iflog_Id: "", rowDataSFDC: "", repairIds: qisreports, statu: statuArr[0] }).then(result => { if (result == "发送成功!") { this.ShowToastEvent(result, "success"); this.dispatchEvent(new CloseActionScreenEvent()); } else { this.SendQISToEtQ(); this.ShowToastEvent("发送QIS到EtQ失败," + result, "error"); this.dispatchEvent(new CloseActionScreenEvent()); } }) var btns = document.getElementsByName("sendqistoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } } // 弹窗 @@ -189,4 +191,18 @@ }); this.dispatchEvent(event); } async handleConfirmClick(msg) { const result = await LightningConfirm.open({ message: msg, variant: 'headerless', label: 'this is the aria-label value' }); if (result) { this.ll(); } else { this.dispatchEvent(new CloseActionScreenEvent()); } } } force-app/main/default/lwc/lexServiceCutPriceApply/lexServiceCutPriceApply.js
@@ -18,7 +18,7 @@ } from 'lightning/platformShowToastEvent'; export default class LexServiceCutPriceApply extends LightningElement { export default class lexServiceCutPriceApply extends LightningElement { @api recordId; str; IsLoading = true;