| | |
| | | import { |
| | | ShowToastEvent |
| | | } from 'lightning/platformShowToastEvent'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | export default class LexSendRepairsToEtQ extends LightningElement { |
| | | @api recordId; |
| | |
| | | profileId; |
| | | profileName; |
| | | userName; |
| | | msg; |
| | | statu = ''; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.Id = result.Id; |
| | | this.PAEDetermineC = result.PAEDetermineC; |
| | | this.ETQUPLOADSTATUSC = result.ETQUPLOADSTATUSC; |
| | |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.userName = result[0].Name; |
| | | } |
| | | }) |
| | |
| | | profileId: this.profileId |
| | | }).then(result => { |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.profileName = result[0].Name; |
| | | |
| | | this.myDate(); |
| | |
| | | } |
| | | }) |
| | | |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | |
| | | selectRecords({ |
| | | recordId: this.Id |
| | | }).then(result => { |
| | | if (result[0].AsyncData__c == 'true' && result[0].ETQ_UPLOAD_STATUS__c != '3' || result[0].Complaint_Number__c != null) { |
| | | if (result[0].AsyncData__c == true && result[0].ETQ_UPLOAD_STATUS__c != '3' || result[0].Complaint_Number__c != null) { |
| | | var btns = document.getElementsByName("sendrepairstoetq"); |
| | | for (var i = 0; i < btns.length; i++) { |
| | | btns[i].disabled = true; |
| | | btns[i].className = 'btnDisabled'; |
| | | } |
| | | alert('该修理之前已经发送过了'); |
| | | this.ShowToastEvent('该修理之前已经发送过了', "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } else { |
| | | this.SendRepairsToEtQ(); |
| | | } |
| | |
| | | // 发送ETQ |
| | | SendRepairsToEtQ() { |
| | | if (this.profileName != "2F7_OSH担当" && this.profileName != "2F7_OSH质量法规" && this.profileName != '系统管理员') { |
| | | alert("您没有发送修理到EtQ的权限。"); |
| | | this.ShowToastEvent("您没有发送修理到EtQ的权限。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | var statu = ''; |
| | | if (this.PAEDetermineC == undefined) { |
| | | alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。"); |
| | | this.ShowToastEvent("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && this.userName != "雷 新建") { |
| | | this.ShowToastEvent("Close Complait的时候,不可以发送到EtQ", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | if (this.ETQUPLOADSTATUSC == "3") { |
| | | if (!confirm("是否清空EtQ同步状态,重新同步数据?")) { |
| | | return; |
| | | } |
| | | this.handleConfirmClick("是否清空EtQ同步状态,重新同步数据?"); |
| | | } else { |
| | | this.ll(); |
| | | } |
| | | if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && this.userName != "雷 新建") { |
| | | alert("Close Complait的时候,不可以发送到EtQ"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | ll() { |
| | | if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) { |
| | | statu = "R1"; |
| | | this.statu = "R1"; |
| | | } else if ((this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != undefined) && |
| | | !(this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE")) { |
| | | statu = "R2"; |
| | | this.statu = "R2"; |
| | | if (this.RepairInspectionDateC == undefined) { |
| | | alert("5.修理检测日是空的时候,不可以发送到EtQ。"); |
| | | this.ShowToastEvent("5.修理检测日是空的时候,不可以发送到EtQ。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | if (this.ContainUseRSAC == 1) { |
| | | alert("Final universal code为空,或者包含UseRSA,请确认。"); |
| | | this.ShowToastEvent("Final universal code为空,或者包含UseRSA,请确认。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | } |
| | | try { |
| | | var repairids = new Array() |
| | | repairids[0] = this.Id; |
| | | |
| | | var statuArr = new Array(); |
| | | statuArr.push(statu); |
| | | var repairids = new Array() |
| | | repairids[0] = this.Id; |
| | | |
| | | sendToETQ({ |
| | | iflog_Id: "", |
| | | rowDataSFDC: "", |
| | | repairIds: repairids, |
| | | statu: statuArr[0] |
| | | }).then(result => { |
| | | alert(result); |
| | | location.reload(); |
| | | }) |
| | | var statuArr = new Array(); |
| | | statuArr.push(this.statu); |
| | | |
| | | var btns = document.getElementsByName("sendrepairstoetq"); |
| | | for (var i = 0; i < btns.length; i++) { |
| | | btns[i].disabled = true; |
| | | btns[i].className = 'btnDisabled'; |
| | | sendToETQ({ |
| | | iflog_Id: "", |
| | | rowDataSFDC: "", |
| | | repairIds: repairids, |
| | | statu: statuArr[0] |
| | | }).then(result => { |
| | | console.log("result:" + result); |
| | | if (result == "发送成功!") { |
| | | this.ShowToastEvent(result, "success"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } else { |
| | | this.ShowToastEvent("发送修理到EtQ失败," + result, "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } catch (error) { |
| | | alert("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode); |
| | | }) |
| | | |
| | | var btns = document.getElementsByName("sendrepairstoetq"); |
| | | for (var i = 0; i < btns.length; i++) { |
| | | btns[i].disabled = true; |
| | | btns[i].className = 'btnDisabled'; |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | | } |