From 26ad084e248b21ced76e6226ab2a32db53f582b9 Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期三, 26 四月 2023 13:37:50 +0800
Subject: [PATCH] tt

---
 force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
index 4ae611c..0c3c21f 100644
--- a/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
+++ b/force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
@@ -12,7 +12,9 @@
 import init from '@salesforce/apex/otherButtonRepairController.init';
 import selectCustomDeleteById from '@salesforce/apex/otherButtonRepairController.selectCustomDeleteById';
 import deleteRepair from '@salesforce/apex/otherButtonRepairController.deleteRepair';
-
+import {
+    ShowToastEvent
+} from 'lightning/platformShowToastEvent';
 
 export default class LexCustomDelete extends LightningElement {
     @api recordId;
@@ -63,13 +65,13 @@
                     rp.Status__c != "1.鍙楃悊瀹屾瘯(SAP寰呭彂閫�)" &&
                     rp.Status__c != "4.淇悊鍝佽繑閫侀樁娈�"
                 ) {
-                    alert("涓嶆槸鑽夋涓紝涓嶈兘鍒犻櫎");
+                    this.ShowToastEvent("涓嶆槸鑽夋涓紝涓嶈兘鍒犻櫎", "error")
                 } else if (rp.Status__c == "4.淇悊鍝佽繑閫侀樁娈�" &&
-                    (rp.SAP_Transfer_time__c != "" || rp.Repair_Ordered_Date__c != "")
+                    (rp.SAP_Transfer_time__c != undefined || rp.Repair_Ordered_Date__c != undefined)
                 ) {
-                    alert("宸茬粡鍙戦�佽繃SAP锛屼笉鑳藉垹闄�");
+                    this.ShowToastEvent("宸茬粡鍙戦�佽繃SAP锛屼笉鑳藉垹闄�", "error")
                 } else if (this.userID.substring(0, 15) != rp.CreatedById.substring(0, 15) && this.userID.substring(0, 15) != rp.Acc_OwnerId__c.substring(0, 15) && this.userID.substring(0, 15) != rp.FSE_ownerid__c.substring(0, 15)) {
-                    alert("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏SE涓昏礋璐d汉锛屼笉鑳藉垹闄�");
+                    this.ShowToastEvent("涓嶆槸鎵�鏈変汉銆佸垱寤轰汉鎴朏SE涓昏礋璐d汉锛屼笉鑳藉垹闄�", "error")
                 } else {
                     if (confirm("鏄惁纭畾锛�")) {
                         deleteRepair({
@@ -86,4 +88,13 @@
             }
         })
     }
+
+    ShowToastEvent(msg, type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1