From af908216bb0012fe849e3b49b3039c7ba238f8f0 Mon Sep 17 00:00:00 2001
From: liangxiaozhen <liangxiaozhen>
Date: 星期五, 11 八月 2023 14:35:43 +0800
Subject: [PATCH] 补充controller,修改变量,主页bug修改

---
 force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js |   78 ++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js b/force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
index 927e6d3..64a66f8 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,16 +62,32 @@
                 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 => {
             console.log(error);
-        }).finally(() => {
-
-        });
+        })
     }
 
     // 鏍规嵁鏃ユ湡鏋勫缓MessageGroupNumber
@@ -85,40 +105,30 @@
         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('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�')
+                this.ShowToastEvent('璇ヤ慨鐞嗕箣鍓嶅凡缁忓彂閫佽繃浜�','error');
             } else {
                 this.SendRepairsToEtQ();
             }
         }).catch(error => {
             console.log(error);
-        }).finally(() => {
-
-        });
+        })
     }
 
     // 鍙戦�丒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 != '绯荤粺绠$悊鍛�') {
+            this.ShowToastEvent("鎮ㄦ病鏈夊彂閫佷慨鐞嗗埌EtQ鐨勬潈闄愩��",'error');
             return;
         }
         var statu = '';
         if (this.PAEDetermineC == undefined) {
-            this.ShowToastEvent("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�", "error");
-            // alert("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�");
+            this.ShowToastEvent("OCSM QARA鐨凱AE鍒ゅ畾鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�",'error');
             return;
         }
         if (this.ETQUPLOADSTATUSC == "3") {
@@ -126,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 != "闆� 鏂板缓") {
+            this.ShowToastEvent("Close Complait鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ",'error');
             return;
         }
         if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) {
@@ -136,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) {
+                this.ShowToastEvent("5.淇悊妫�娴嬫棩鏄┖鐨勬椂鍊欙紝涓嶅彲浠ュ彂閫佸埌EtQ銆�",'error');
                 return;
             }
             if (this.ContainUseRSAC == 1) {
-                this.ShowToastEvent("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�", "error");
-                // alert("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�");
+                this.ShowToastEvent("Final universal code涓虹┖锛屾垨鑰呭寘鍚玌seRSA锛岃纭銆�",'error');
                 return;
             }
         }
-
-        var result;
         try {
             var repairids = new Array()
             repairids[0] = this.Id;
@@ -162,10 +167,9 @@
                 repairIds: repairids,
                 statu: statuArr[0]
             }).then(result => {
-                this.ShowToastEvent(result, "error");
-                // alert(result);
-            }).catch(error => {
-                console.log(error);
+                this.ShowToastEvent(result,'error');
+                this.dispatchEvent(new CloseActionScreenEvent());
+                location.reload();
             })
 
             var btns = document.getElementsByName("sendrepairstoetq");
@@ -173,10 +177,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);
+            this.ShowToastEvent("鍙戦�佷慨鐞嗗埌EtQ澶辫触" + error.faultstring + ' code:' + error.faultcode,'error');
         }
     }
 

--
Gitblit v1.9.1