From 07390e2fcb4adf27c928335bf27ae7939c5a80ad Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 23 五月 2023 11:28:12 +0800
Subject: [PATCH] bakcup20230523

---
 force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js |   69 ++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
index 46706d3..82f115d 100644
--- a/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
+++ b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
@@ -12,6 +12,8 @@
 import init from '@salesforce/apex/otherButtonRepairController.init';
 import selectRecords from '@salesforce/apex/otherButtonRepairController.selectRecords';
 import sendToETQ from '@salesforce/apex/otherButtonRepairController.sendToETQ';
+import initSelectProfile from '@salesforce/apex/otherButtonRepairController.initSelectProfile';
+import initUserName from '@salesforce/apex/otherButtonRepairController.initUserName';
 import {
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
@@ -29,6 +31,8 @@
     ContainUseRSAC;
     userID;
     profileId;
+    profileName;
+    userName;
 
     @wire(CurrentPageReference)
     getStateParameters(currentPageReference) {
@@ -58,9 +62,27 @@
                 this.ContainUseRSAC = result.ContainUseRSAC;
                 this.userID = result.userID;
                 this.profileId = result.profileId;
+                initUserName({
+                    userId: this.userID
+                }).then(result => {
+                    console.log(result);
+                    if (result != null) {
+                        this.IsLoading = false;
+                        this.userName = result[0].Name;
+                    }
+                })
+                initSelectProfile({
+                    profileId: this.profileId
+                }).then(result => {
+                    if (result != null) {
+                        this.IsLoading = false;
+                        this.profileName = result[0].Name;
 
-                this.myDate();
-                this.myReload();
+                        this.myDate();
+                        this.myReload();
+                    }
+                })
+
                 this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
@@ -83,15 +105,13 @@
         selectRecords({
             recordId: this.Id
         }).then(result => {
-            console.log(result);
-            if (result.AsyncData__c == 'true' && result.ETQ_UPLOAD_STATUS__c != '3' || result.Complaint_Number__c != null) {
+            if (result[0].AsyncData__c == 'true' && result[0].ETQ_UPLOAD_STATUS__c != '3' || result[0].Complaint_Number__c != null) {
                 var btns = document.getElementsByName("sendrepairstoetq");
                 for (var i = 0; i < btns.length; i++) {
                     btns[i].disabled = true;
                     btns[i].className = 'btnDisabled';
                 }
-                this.ShowToastEvent('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�', "error");
-                // alert('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�')
+                alert('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�');
             } else {
                 this.SendRepairsToEtQ();
             }
@@ -102,19 +122,13 @@
 
     // 鍙戦�丒TQ
     SendRepairsToEtQ() {
-        console.log(this.userID);
-        console.log(this.profileId);
-
-        var uid = this.userID;
-        if (this.profileId != "00e10000000xnoO" && this.profileId != "00e10000000hl7w" && this.profileId != '00e10000000Y3o5') {
-            this.ShowToastEvent("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��", "error");
-            // alert("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��");
+        if (this.profileName != "2F7_OSH鎷呭綋" && this.profileName != "2F7_OSH璐ㄩ噺娉曡" && this.profileName != '绯荤粺绠$悊鍛�') {
+            alert("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��");
             return;
         }
         var statu = '';
         if (this.PAEDetermineC == undefined) {
-            this.ShowToastEvent("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
-            // alert("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+            alert("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
             return;
         }
         if (this.ETQUPLOADSTATUSC == "3") {
@@ -122,9 +136,8 @@
                 return;
             }
         }
-        if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && uid != "005100000068zJ6") {
-            this.ShowToastEvent("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ", "error");
-            // alert("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ");
+        if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && this.userName != "闆� 鏂板缓") {
+            alert("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ");
             return;
         }
         if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) {
@@ -132,19 +145,15 @@
         } else if ((this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != undefined) &&
             !(this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE")) {
             statu = "R2";
-            if (this.RepairInspectionDateC == "") {
-                this.ShowToastEvent("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
-                // alert("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+            if (this.RepairInspectionDateC == undefined) {
+                alert("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
                 return;
             }
             if (this.ContainUseRSAC == 1) {
-                this.ShowToastEvent("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�", "error");
-                // alert("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�");
+                alert("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�");
                 return;
             }
         }
-
-        var result;
         try {
             var repairids = new Array()
             repairids[0] = this.Id;
@@ -158,10 +167,8 @@
                 repairIds: repairids,
                 statu: statuArr[0]
             }).then(result => {
-                this.ShowToastEvent(result, "error");
-                // alert(result);
-            }).catch(error => {
-                console.log(error);
+                alert(result);
+                location.reload();
             })
 
             var btns = document.getElementsByName("sendrepairstoetq");
@@ -169,10 +176,8 @@
                 btns[i].disabled = true;
                 btns[i].className = 'btnDisabled';
             }
-            location.reload();
         } catch (error) {
-            this.ShowToastEvent("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode, "error");
-            // alert("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode);
+            alert("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode);
         }
     }
 

--
Gitblit v1.9.1