unknown
2023-08-24 ddb0231ef7c5cf2bad9d3f1afc2f733674ad38a5
force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js
@@ -14,6 +14,7 @@
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
export default class LexOCSMNoToReportRepair extends LightningElement {
    @api recordId;
@@ -42,14 +43,12 @@
        }).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);
@@ -58,29 +57,7 @@
    // 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("不要报告后无法撤回,是否继续?");
    }
    // 弹窗
@@ -92,4 +69,41 @@
        });
        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());
        }
    }
}