zhangchunxu
2023-07-21 14e3923804ac265cb8bf6e571232131b662fd204
force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
@@ -14,6 +14,8 @@
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
export default class LexPreContractSubmit extends LightningElement {
    @api recordId;
@@ -44,7 +46,6 @@
        }).then(result => {
            console.log(result);
            if (result != null) {
                this.IsLoading = false;
                this.oldIsRecognitionModelC = result.oldIsRecognitionModelC;
                this.uploadToRMTimeC = result.uploadToRMTimeC;
                this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC;
@@ -53,7 +54,6 @@
                this.Id = result.Id;
                this.preContractSubmit();
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
            console.log(error);
@@ -64,37 +64,30 @@
    preContractSubmit() {
        if (this.oldIsRecognitionModelC) {
            if (this.uploadToRMTimeC == null) {
                this.ShowToastEvent('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能复核。', "error")
                this.ShowToastEvent('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能复核。', "error");
                this.dispatchEvent(new CloseActionScreenEvent());
                return;
            } else {
                if (!this.IsRecognitionModelTrueC) {
                    this.ShowToastEvent('当前维修合同没有完成认款,不能进行复核。', "error")
                    this.ShowToastEvent('当前维修合同没有完成认款,不能进行复核。', "error");
                    this.dispatchEvent(new CloseActionScreenEvent());
                    return;
                }
            }
        }
        var status = this.MCApprovalStatusC;
        if (status != 'Draft' && status != 'Reject' && status != undefined) {
            this.ShowToastEvent('复核已经提交,请确认状态。', "error")
            this.ShowToastEvent('复核已经提交,请确认状态。', "error");
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        var con_no = this.ContractprintCompletedC;
        if (con_no == undefined) {
            this.ShowToastEvent('合同盖章完毕为空,不能提交合同复核申请。', "error")
            this.ShowToastEvent('合同盖章完毕为空,不能提交合同复核申请。', "error");
            this.dispatchEvent(new CloseActionScreenEvent());
            return;
        }
        if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) {
            return;
        }
        processResults({
            recordId: this.recordId
        }).catch(error => {
            if (error.body.pageErrors[0] != null) {
                var errmsg = error.body.pageErrors[0].message.toString();
                this.ShowToastEvent(errmsg + '_sys', "error")
                return;
            }
        })
        this.handleConfirmClick("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?");
    }
    // 弹窗
@@ -106,4 +99,27 @@
        });
        this.dispatchEvent(event);
    }
    async handleConfirmClick(msg) {
        const result = await LightningConfirm.open({
            message: msg,
            variant: 'headerless',
            label: 'this is the aria-label value'
        });
        if (result) {
            processResults({
                recordId: this.Id
            }).catch(error => {
                if (error.body.pageErrors[0] != null) {
                    var errmsg = error.body.pageErrors[0].message.toString();
                    this.ShowToastEvent(errmsg, "error");
                    this.dispatchEvent(new CloseActionScreenEvent());
                    return;
                }
            })
        } else {
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
}