import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/lexToAddMaintenanceContractController.initUploadToRecognition'; import updateColunm from '@salesforce/apex/otherButtonMaintenanceContractCtl.updateColunm'; import up2sap from '@salesforce/apex/LexOtherButtonMc.up2sap'; import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; import {loadStyle} from 'lightning/platformResourceLoader'; import lexSendNfm103 from '@salesforce/resourceUrl/lexSendNfm103'; export default class lexUploadToRecognition extends LightningElement { @api recordId; @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), loadStyle(this, lexSendNfm103) ]); init({ recordId: this.recordId }).then(returnData => { if(returnData) { console.log(returnData); this.dispatchEvent(new CloseActionScreenEvent()); debugger this.IsLoading = false; var records = returnData var msg = ''; var j =0; for(var i=0;i { if (result != '1') { resultMsg = '2'; return resultMsg ; // this.ShowToastEvent('上传认款合同失败,因为 来年合同相关信息修改失败', "error"); // this.dispatchEvent(new CloseActionScreenEvent()); } }) await up2sap({ mcid: mcid }).then(rtn => { if (rtn == '1') { resultMsg ="1"; } else { resultMsg ='3'; } return resultMsg ; }) } showToast(msg,type) { if(type == 'success'){ const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); }else{ const event = new ShowToastEvent({ message: msg, variant: type, mode: 'sticky' }); this.dispatchEvent(event); } } } // old js //zhangzhengmei 2023/06/28 start /*var executeFoo = function() { var mcpid = '{!MaintanceContractPack__c.Id}'; console.log('mcpid ='+mcpid); var sql = "select Id,Name,Decided_Estimation__c,Contract_quotation_or_not__c,Maintenance_Contract_No__c,upload_to_sap_time__c,upload_to_RM_time__c,old_Is_RecognitionModel__c,Payment_Plan_Sum_First__c from Maintenance_Contract__c where MaintanceContractPack__c='" + mcpid + "'"; var sqlResult = sforce.connection.query(sql); var records = sqlResult.getArray("records"); var msg = ''; for(var i=0;i