force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
New file @@ -0,0 +1,56 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init'; export default class LexCopyPIInspectionReport extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; @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.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.CopyPI(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } CopyPI() { window.location.href = '/' + this.Id + '/e?newclone=1'; } } force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.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/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
New file @@ -0,0 +1,68 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; export default class LexCreateReportMaintenanceContract extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeDeveloperNameC; EstimateTargetC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC; this.EstimateTargetC = result.EstimateTargetC; this.CreateReport(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } CreateReport() { var MaintenanceContractId = this.Id; var RecordTypeName = this.RecordTypeDeveloperNameC; var EstimateTarget = this.EstimateTargetC; var url = ''; if (EstimateTarget == "经销商" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) { url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName; } else { url = "http://powerbi.olympus.com.cn/Home/Login"; } window.open(url, '_bank'); } } force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.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/lexInsPageBtn/lexInsPageBtn.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
New file @@ -0,0 +1,61 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init'; export default class LexInsPageBtn extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; @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.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.insPageBtn(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } insPageBtn() { var url; if (this.RecordTypeId == '01210000000aLii') { url = '/apex/OFSInsReportLayoutForVm'; } else { url = '/apex/OFSInsReportLayout'; } window.open(url += '?id=' + this.Id) } } force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.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/lexPreContractSubmit/lexPreContractSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
New file @@ -0,0 +1,102 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import processResults from '@salesforce/apex/otherButtonMaintenanceContractCtl.processResults'; export default class LexPreContractSubmit extends LightningElement { @api recordId; str; IsLoading = true; oldIsRecognitionModelC; uploadToRMTimeC; IsRecognitionModelTrueC; MCApprovalStatusC; ContractprintCompletedC; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.oldIsRecognitionModelC = result.oldIsRecognitionModelC; this.uploadToRMTimeC = result.uploadToRMTimeC; this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC; this.MCApprovalStatusC = result.MCApprovalStatusC; this.ContractprintCompletedC = result.ContractprintCompletedC; this.Id = result.Id; this.preContractSubmit(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } preContractSubmit() { //update wangweipeng 2022/01/04 start //判断是否需要先上传认款合同吗,如果需要那么判断他是否已经上传,如果上传,那么判断他是否完成认款,如果都满足,那么才能正常走接口上传SAP //判断是认款合同吗 if (this.oldIsRecognitionModelC) { if (this.uploadToRMTimeC == null) { //判断是否已经上传认款合同 alert('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能复核。'); return; } else { //判断是否完成认款 if (!this.IsRecognitionModelTrueC) { alert('当前维修合同没有完成认款,不能进行复核。'); return; } } } //update wangweipeng 2022/01/04 end var status = this.MCApprovalStatusC; if (status != 'Draft' && status != 'Reject' && status != undefined) { alert('复核已经提交,请确认状态。'); return; } var con_no = this.ContractprintCompletedC; if (con_no == '') { alert('合同盖章完毕为空,不能提交合同复核申请。'); return; } if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { return; } processResults({ recordId: this.recordId }).catch(error => { if (error.body.pageErrors[0] != null) { var errmsg = error.body.pageErrors[0].message.toString(); alert(errmsg + '_sys'); return; } }) } } force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.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/lexSubmitForApproval/lexSubmitForApproval.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
New file @@ -0,0 +1,70 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import selectRecords from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectRecords'; export default class LexSubmitForApproval extends LightningElement { @api recordId; str; IsLoading = true; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.SubmitForApproval(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } SubmitForApproval() { var url = ''; selectRecords({ recordId: this.Id }).then(result => { console.log(result); if (result.length > 0) { url = "/apex/SubmitForApprovalPage?id=" + result[0].Id; } else { url = "/apex/SubmitForApprovalPage?mcId=" + this.Id; } window.open(url, '', 'height=350, width=600, top=200, left=350,location=no'); }).catch(error => { console.log("error"); }).finally(() => { }); } } force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.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/lexUploadToSap/lexUploadToSap.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
New file @@ -0,0 +1,167 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm'; import updateFirstContract from '@salesforce/apex/updateFirstServiceContractWebService.updateFirstContract'; import Check_plan from '@salesforce/apex/MaintenanceContractWebService.Check_plan'; import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap'; export default class LexUploadToSap extends LightningElement { @api recordId; str; IsLoading = true; MCApprovalStatusC; MaintenanceContractNoC; uploadToSapTimeC; oldIsRecognitionModelC; uploadToRMTimeC; IsRecognitionModelTrueC; Id; URFContractFC; urfFlag; rtn1; rtn; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.MCApprovalStatusC = result.MCApprovalStatusC; this.MaintenanceContractNoC = result.MaintenanceContractNoC; this.uploadToSapTimeC = result.uploadToSapTimeC; this.oldIsRecognitionModelC = result.oldIsRecognitionModelC; this.uploadToRMTimeC = result.uploadToRMTimeC; this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC; this.Id = result.Id; this.URFContractFC = result.URFContractFC; this.uploadToSap(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } uploadToSap() { if (this.MCApprovalStatusC != 'Pass') { alert("合同复核批准后才可以上传SAP。"); } else if (this.MaintenanceContractNoC == undefined) { alert('维修合同管理编码为空,不能上传SAP。'); } else if (this.uploadToSapTimeC != undefined) { alert('已经上传SAP,不能重复上传。'); } else { //update wangweipeng 2021/11/20 start //判断是否需要先上传认款合同吗,如果需要那么判断他是否已经上传,如果上传,那么判断他是否完成认款,如果都满足,那么才能正常走接口上传SAP //判断是认款合同吗 if (this.oldIsRecognitionModelC) { //判断是否已经上传认款合同 if (this.uploadToRMTimeC == undefined) { console.log("a"); alert('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能上传SAP。'); return; } else { //判断是否完成认款 if (!this.IsRecognitionModelTrueC) { console.log("b"); alert('当前维修合同没有完成认款,不能上传SAP。'); return; } } } //update wangweipeng 2021/11/20 end // sforce.connection.sessionId = this.api.sessionId; // var mcid = this.Id; // var result = sforce.apex.execute("MaintenanceContractSetColunmWebService", "updateColunm", { // mcid: mcid // }); updateColunm({ mcid: this.Id }).then(result=>{ console.log("updateColunm" + result); if (result != '1') { console.log("c"); alert('上传SAP失败,因为 来年合同相关信息修改失败'); //location.href = "/" + this.Id; } }); //首次服务合同赋值 // var updateResult = sforce.apex.execute("updateFirstServiceContractWebService", "updateFirstContract", { // mcid: mcid // }); updateFirstContract({ mcid: this.Id }).then(result=>{ console.log("updateFirstContract:" + result); if (result != '1') { alert(result); } }); //URF限次合同2期 LY 20220811 start this.urfFlag = this.URFContractFC; this.rtn1 = '1'; this.rtn = '1'; if (this.urfFlag == 'false') { // rtn1 = sforce.apex.execute("MaintenanceContractWebService", "Check_plan", { // mcidList: mcid // }); Check_plan({ mcidList: this.Id }).then(result=>{ console.log("Check_plan:" + result); this.rtn1 = result; }); } console.log("rtn1" + this.rtn1); //URF限次合同2期 LY 20220811 end if (this.rtn1 == '1') { // var rtn = sforce.apex.execute("MaintenanceContractWebService", "up2sap", { // mcid: mcid // }); up2sap({ mcid: this.Id }).then(result=>{ console.log("up2sap:" + result); this.rtn = result; }); console.log("rtn" + this.rtn); if (this.rtn == '1') { alert("上传SAP成功"); window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view"); //window.location.href = "/" + this.Id; } else { alert(this.rtn); } } else { alert(this.rtn1); } } } } force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.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>