buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
force-app/main/default/lwc/lexSendQISToEtQ/lexSendQISToEtQ.js
@@ -13,7 +13,7 @@
import sendToETQ from '@salesforce/apex/buttonQISReportCtl.sendToETQ';
import updateQISReportC from '@salesforce/apex/buttonQISReportCtl.updateQISReportC';
import selectQISReportC from '@salesforce/apex/buttonQISReportCtl.selectQISReportC';
import initSelectProfile from '@salesforce/apex/otherButtonRepairController.initSelectProfile';
import {
    ShowToastEvent
} from 'lightning/platformShowToastEvent';
@@ -31,6 +31,7 @@
    QISFinalJudgementC;
    ETQUPLOADSTATUSC;
    AEDetermineResultC;
    profileName;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
@@ -60,8 +61,17 @@
                this.ETQUPLOADSTATUSC = result.ETQUPLOADSTATUSC;
                this.AEDetermineResultC = result.AEDetermineResultC;
                this.myDate();
                this.myReload();
                initSelectProfile({
                    profileId: this.profileId
                }).then(result => {
                    if (result != null) {
                        this.IsLoading = false;
                        this.profileName = result[0].Name;
                        this.myDate();
                        this.myReload();
                    }
                })
                this.dispatchEvent(new CloseActionScreenEvent());
            }
        }).catch(error => {
@@ -79,24 +89,22 @@
    // 发送QIS到EtQ   
    SendQISToEtQ() {
        console.log(this.profileName);
        var QId = this.Id;
        var uid = this.userId;
        if (this.profileId != "00e10000000xnoO" && this.profileId != "00e10000000hl7w") {
        if (this.profileName != "2F7_OSH担当" && this.profileName != "2F7_OSH质量法规") {
            alert("您没有发送QIS到EtQ的权限。");
            return;
        }
        if (this.PAEDetermineC == undefined) {
            alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。");
            return;
        }
        if (this.AEDetermineResultC == "nonAE" && this.PAEDetermineC == "nonPAE" && this.PAEDetermineACC == "nonPAE" && this.OCMJudgementC == undefined && this.QISFinalJudgementC == undefined) {
            alert("nonAE并nonPAE的QIS同步到EtQ的时候,检测结论(OCSM)是必填的。不可以发送到EtQ。");
            return;
        }
        if (this.ETQUPLOADSTATUSC == "3") {
            if (!confirm("是否清空EtQ同步状态,重新同步数据?")) {
                return;
@@ -158,7 +166,8 @@
        selectQISReportC({
            QId: this.Id
        }).then(record => {
            if (record.AsyncData__c == 'true' && record.ETQ_UPLOAD_STATUS__c != '3' || record.Complaint_Number__c != null) {
        console.log(record);
            if (record[0].AsyncData__c == 'true' && record[0].ETQ_UPLOAD_STATUS__c != '3' || record[0].Complaint_Number__c != null) {
                var btns = document.getElementsByName("sendqistoetq");
                for (var i = 0; i < btns.length; i++) {
                    btns[i].disabled = true;
@@ -166,7 +175,7 @@
                }
                alert('该QIS之前已经发送过了')
            } else {
                SendQISToEtQ();
                this.SendQISToEtQ();
            }
        })
    }