| | |
| | | import init from '@salesforce/apex/otherButtonRepairController.init'; |
| | | import selectRecords from '@salesforce/apex/otherButtonRepairController.selectRecords'; |
| | | import sendToETQ from '@salesforce/apex/otherButtonRepairController.sendToETQ'; |
| | | import initSelectProfile from '@salesforce/apex/otherButtonRepairController.initSelectProfile'; |
| | | import initUserName from '@salesforce/apex/otherButtonRepairController.initUserName'; |
| | | import { |
| | | ShowToastEvent |
| | | } from 'lightning/platformShowToastEvent'; |
| | |
| | | ContainUseRSAC; |
| | | userID; |
| | | profileId; |
| | | profileName; |
| | | userName; |
| | | |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | |
| | | this.ContainUseRSAC = result.ContainUseRSAC; |
| | | this.userID = result.userID; |
| | | this.profileId = result.profileId; |
| | | initUserName({ |
| | | userId: this.userID |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.userName = result[0].Name; |
| | | } |
| | | }) |
| | | initSelectProfile({ |
| | | profileId: this.profileId |
| | | }).then(result => { |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.profileName = result[0].Name; |
| | | |
| | | this.myDate(); |
| | | this.myReload(); |
| | | this.myDate(); |
| | | this.myReload(); |
| | | } |
| | | }) |
| | | |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }).catch(error => { |
| | |
| | | selectRecords({ |
| | | recordId: this.Id |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result.AsyncData__c == 'true' && result.ETQ_UPLOAD_STATUS__c != '3' || result.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'; |
| | | } |
| | | this.ShowToastEvent('该修理之前已经发送过了', "error"); |
| | | // alert('该修理之前已经发送过了') |
| | | alert('该修理之前已经发送过了'); |
| | | } else { |
| | | this.SendRepairsToEtQ(); |
| | | } |
| | |
| | | |
| | | // 发送ETQ |
| | | SendRepairsToEtQ() { |
| | | console.log(this.userID); |
| | | console.log(this.profileId); |
| | | |
| | | var uid = this.userID; |
| | | if (this.profileId != "00e10000000xnoO" && this.profileId != "00e10000000hl7w" && this.profileId != '00e10000000Y3o5') { |
| | | this.ShowToastEvent("您没有发送修理到EtQ的权限。", "error"); |
| | | // alert("您没有发送修理到EtQ的权限。"); |
| | | if (this.profileName != "2F7_OSH担当" && this.profileName != "2F7_OSH质量法规" && this.profileName != '系统管理员') { |
| | | alert("您没有发送修理到EtQ的权限。"); |
| | | return; |
| | | } |
| | | var statu = ''; |
| | | if (this.PAEDetermineC == undefined) { |
| | | this.ShowToastEvent("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。", "error"); |
| | | // alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。"); |
| | | alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。"); |
| | | return; |
| | | } |
| | | if (this.ETQUPLOADSTATUSC == "3") { |
| | |
| | | return; |
| | | } |
| | | } |
| | | if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && uid != "005100000068zJ6") { |
| | | this.ShowToastEvent("Close Complait的时候,不可以发送到EtQ", "error"); |
| | | // alert("Close Complait的时候,不可以发送到EtQ"); |
| | | if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && this.userName != "雷 新建") { |
| | | alert("Close Complait的时候,不可以发送到EtQ"); |
| | | return; |
| | | } |
| | | if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) { |
| | |
| | | } else if ((this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != undefined) && |
| | | !(this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE")) { |
| | | statu = "R2"; |
| | | if (this.RepairInspectionDateC == "") { |
| | | this.ShowToastEvent("5.修理检测日是空的时候,不可以发送到EtQ。", "error"); |
| | | // alert("5.修理检测日是空的时候,不可以发送到EtQ。"); |
| | | if (this.RepairInspectionDateC == undefined) { |
| | | alert("5.修理检测日是空的时候,不可以发送到EtQ。"); |
| | | return; |
| | | } |
| | | if (this.ContainUseRSAC == 1) { |
| | | this.ShowToastEvent("Final universal code为空,或者包含UseRSA,请确认。", "error"); |
| | | // alert("Final universal code为空,或者包含UseRSA,请确认。"); |
| | | alert("Final universal code为空,或者包含UseRSA,请确认。"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | var result; |
| | | try { |
| | | var repairids = new Array() |
| | | repairids[0] = this.Id; |
| | |
| | | repairIds: repairids, |
| | | statu: statuArr[0] |
| | | }).then(result => { |
| | | this.ShowToastEvent(result, "error"); |
| | | // alert(result); |
| | | }).catch(error => { |
| | | console.log(error); |
| | | alert(result); |
| | | location.reload(); |
| | | }) |
| | | |
| | | var btns = document.getElementsByName("sendrepairstoetq"); |
| | |
| | | btns[i].disabled = true; |
| | | btns[i].className = 'btnDisabled'; |
| | | } |
| | | location.reload(); |
| | | } catch (error) { |
| | | this.ShowToastEvent("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode, "error"); |
| | | // alert("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode); |
| | | alert("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode); |
| | | } |
| | | } |
| | | |