| | |
| | | import { |
| | | ShowToastEvent |
| | | } from 'lightning/platformShowToastEvent'; |
| | | import LightningConfirm from 'lightning/confirm'; |
| | | |
| | | export default class LexOCSMNoToReportRepair extends LightningElement { |
| | | @api recordId; |
| | |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result != null) { |
| | | this.IsLoading = false; |
| | | this.Id = result.Id; |
| | | this.OCSMAdministrativeReportNumberC = result.OCSMAdministrativeReportNumberC; |
| | | this.OCSMAdministrativeReportDateC = result.OCSMAdministrativeReportDateC; |
| | | this.AwareDateC = result.AwareDateC; |
| | | |
| | | this.OCSMNoToReport(); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | }).catch(error => { |
| | | console.log(error); |
| | |
| | | |
| | | // OCSM不要报告 |
| | | OCSMNoToReport() { |
| | | if (!confirm("不要报告后无法撤回,是否继续?")) { |
| | | return; |
| | | } |
| | | if (this.OCSMAdministrativeReportNumberC != undefined || |
| | | this.OCSMAdministrativeReportDateC != undefined) { |
| | | this.ShowToastEvent("已经报告的QIS,不可以点击OCSM不要报告。", "error") |
| | | return; |
| | | } |
| | | if (this.AwareDateC != undefined) { |
| | | updateRepair({ |
| | | recordId: this.Id |
| | | }).then(result => { |
| | | console.log(result); |
| | | if (result.length > 0) { |
| | | var split = result.split(", "); |
| | | alert(split[1]); |
| | | } |
| | | 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.OCSMAdministrativeReportNumberC != undefined || |
| | | this.OCSMAdministrativeReportDateC != undefined) { |
| | | this.ShowToastEvent("已经报告的QIS,不可以点击OCSM不要报告。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | if (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; |
| | | } |
| | | window.location.reload(); |
| | | }) |
| | | } else { |
| | | this.ShowToastEvent("没有AwareDate或已经OCSM行政报告,请确认。", "error"); |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | return; |
| | | } |
| | | } else { |
| | | this.dispatchEvent(new CloseActionScreenEvent()); |
| | | } |
| | | } |
| | | } |