liangxiaozhen
2023-08-06 7454e4fe769b5148309b8a932fbf2bc03b41b376
force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
@@ -33,6 +33,7 @@
    urfFlag;
    rtn1;
    rtn;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
        if (currentPageReference) {
@@ -45,7 +46,6 @@
    }
    connectedCallback() {
        console.log(this.recordId);
        init({
            recordId: this.recordId
        }).then(result => {
@@ -73,23 +73,18 @@
    uploadToSap() {
        if (this.MCApprovalStatusC != 'Pass') {
            this.ShowToastEvent("合同复核批准后才可以上传SAP。", "error")
            // alert("合同复核批准后才可以上传SAP。");
        } else if (this.MaintenanceContractNoC == undefined) {
            this.ShowToastEvent('维修合同管理编码为空,不能上传SAP。', "error")
            // alert('维修合同管理编码为空,不能上传SAP。');
        } else if (this.uploadToSapTimeC != undefined) {
            this.ShowToastEvent('已经上传SAP,不能重复上传。', "error")
            // alert('已经上传SAP,不能重复上传。');
        } else {
            if (this.oldIsRecognitionModelC) {
                if (this.uploadToRMTimeC == undefined) {
                    this.ShowToastEvent('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能上传SAP。', "error")
                    // alert('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能上传SAP。');
                    return;
                } else {
                    if (!this.IsRecognitionModelTrueC) {
                        this.ShowToastEvent('当前维修合同没有完成认款,不能上传SAP。', "error")
                        // alert('当前维修合同没有完成认款,不能上传SAP。');
                        return;
                    }
                }
@@ -99,7 +94,6 @@
            }).then(result => {
                if (result != '1') {
                    this.ShowToastEvent('上传SAP失败,因为 来年合同相关信息修改失败', "error")
                    // alert('上传SAP失败,因为 来年合同相关信息修改失败');
                }
            });
            updateFirstContract({
@@ -107,7 +101,6 @@
            }).then(result => {
                if (result != '1') {
                    this.ShowToastEvent(result, "error")
                    // alert(result);
                }
            });
            this.urfFlag = this.URFContractFC;
@@ -128,15 +121,12 @@
                });
                if (this.rtn == '1') {
                    this.ShowToastEvent("上传SAP成功", "success")
                    // alert("上传SAP成功");
                    window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view");
                    location.href = "/" + this.Id;
                } else {
                    this.ShowToastEvent(this.rtn, "error")
                    // alert(this.rtn);
                }
            } else {
                this.ShowToastEvent(this.rtn1, "error")
                // alert(this.rtn1);
            }
        }
    }