| | |
| | | import { |
| | | ShowToastEvent |
| | | } from 'lightning/platformShowToastEvent'; |
| | | |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | export default class LexOCSMToReportRepair extends LightningElement { |
| | | @api recordId; |
| | |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.Id = result.Id; |
| | | this.AwareDateC = result.AwareDateC; |
| | | this.OCSMAdministrativeReportStatusC = result.OCSMAdministrativeReportStatusC; |
| | | |
| | | this.OCSMToReport(); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | |
| | | |
| | | // OCSM要报告 |
| | | OCSMToReport() { |
| | | if (!confirm("报告后无法撤回,是否继续?")) { |
| | | return; |
| | | } |
| | | if (this.OCSMAdministrativeReportStatusC == undefined && this.AwareDateC != undefined) { |
| | | updateRepair({ |
| | | recordId: this.Id |
| | | }).catch(error => { |
| | | if (error.body.pageErrors.length > 0) { |
| | | // alert(messages.join("\n")); |
| | | var errmsg = error.body.pageErrors[0].message.toString(); |
| | | this.ShowToastEvent(errmsg.join("\n"), "error") |
| | | return; |
| | | } |
| | | }) |
| | | window.location.reload(); |
| | | } else { |
| | | this.ShowToastEvent("没有AwareDate或已经OCSM行政报告,请确认。", "error") |
| | | return; |
| | | } |
| | | this.handleConfirmClick("报告后无法撤回,是否继续?"); |
| | | } |
| | | |
| | | // 弹窗 |
| | |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | |
| | | async handleConfirmClick(msg) { |
| | | const result = await LightningConfirm.open({ |
| | | message: msg, |
| | | variant: 'headerless', |
| | | label: 'this is the aria-label value' |
| | | }); |
| | | if(result){ |
| | | if (this.OCSMAdministrativeReportStatusC == undefined && this.AwareDateC != undefined) { |
| | | updateRepair({ |
| | | recordId: this.Id |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result.length > 0) { |
| | | var split = result.split(", "); |
| | | this.ShowToastEvent(split[1], "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | location.reload(); |
| | | }) |
| | | } else { |
| | | this.ShowToastEvent("没有AwareDate或已经OCSM行政报告,请确认。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | } |
| | | else{ |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } |
| | | } |