From 626f3c3bb25e204568019e8d568e2d7547d1037a Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 09 八月 2023 10:54:08 +0800
Subject: [PATCH] 20230809修改伟意按钮同步

---
 force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js b/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
index a29af3b..1ee2859 100644
--- a/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
+++ b/force-app/main/default/lwc/lexDiscountRequest/lexDiscountRequest.js
@@ -17,7 +17,7 @@
     ShowToastEvent
 } from 'lightning/platformShowToastEvent';
 
-export default class LexDiscountRequest extends LightningElement {
+export default class lexDiscountRequest extends LightningElement {
     @api recordId;
     str;
     IsLoading = true;
@@ -36,7 +36,6 @@
     }
 
     connectedCallback() {
-        console.log(this.recordId);
         init({
             recordId: this.recordId
         }).then(result => {
@@ -47,7 +46,6 @@
                 this.RepairC = result.RepairC;
 
                 this.DiscountRequest();
-                this.dispatchEvent(new CloseActionScreenEvent());
             }
         }).catch(error => {
             console.log(error);
@@ -61,14 +59,15 @@
         }).then(repairs => {
             if (repairs != null && repairs.length > 0) {
                 var rp = repairs[0];
-                if (rp.Return_Without_Repair_IF__c == 'true') {
+                console.log(rp);
+                if (rp.Return_Without_Repair_IF__c == true) {
                     this.ShowToastEvent("鏈慨鐞嗗綊杩樼殑淇悊涓嶅厑璁稿噺浠风敵璇�", "error");
-                    // alert("鏈慨鐞嗗綊杩樼殑淇悊涓嶅厑璁稿噺浠风敵璇�");
+                    this.dispatchEvent(new CloseActionScreenEvent());
                     return;
                 } else {
-                    if (rp.Return_Without_Repair__c == 'true') {
+                    if (rp.Return_Without_Repair__c == true) {
                         this.ShowToastEvent("宸茬粡鐢宠鏈慨鐞嗚繑鍥烇紝濡傛灉闇�瑕佺户缁慨鐞嗚鍙栨秷\"鏈慨鐞嗗綊杩樼敵璇穃"鐨勫嬀閫夊悗鍐嶈繘琛屽噺浠风敵璇锋搷浣�", "error");
-                        // alert("宸茬粡鐢宠鏈慨鐞嗚繑鍥烇紝濡傛灉闇�瑕佺户缁慨鐞嗚鍙栨秷\"鏈慨鐞嗗綊杩樼敵璇穃"鐨勫嬀閫夊悗鍐嶈繘琛屽噺浠风敵璇锋搷浣�");
+                        this.dispatchEvent(new CloseActionScreenEvent());
                         return;
                     }
                 }
@@ -79,9 +78,13 @@
                 console.log(result);
                 if (result.length > 0) {
                     var split = result.split(", ");
-                    alert(split[1]);
+                    this.ShowToastEvent(split[1], "error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
                     return;
-                }
+                }else{
+                        this.ShowToastEvent("鏇存柊鎴愬姛锛�", "success");
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                    }
             })
             updateRepairQuotation04({
                 recordId: this.Id
@@ -89,11 +92,14 @@
                 console.log(result);
                 if (result.length > 0) {
                     var split = result.split(", ");
-                    alert(split[1]);
+                    this.ShowToastEvent(split[1], "error");
+                    this.dispatchEvent(new CloseActionScreenEvent());
                     return;
-                }
+                }else{
+                        this.ShowToastEvent("鏇存柊鎴愬姛锛�", "success");
+                        this.dispatchEvent(new CloseActionScreenEvent());
+                    }
             })
-            location.reload();
         })
     }
 

--
Gitblit v1.9.1