From 41ad0c0840a6135b7acf2280f0eebdc29bf6479b Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 30 五月 2023 14:25:11 +0800
Subject: [PATCH] backup0530

---
 force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js |   60 ++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 38 insertions(+), 22 deletions(-)

diff --git a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
index f48c776..c6976a3 100644
--- a/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
+++ b/force-app/main/default/lwc/lexProductLimitEdit/lexProductLimitEdit.js
@@ -93,18 +93,21 @@
             console.log('鏁板瓧'+this.isNum(this.invRecords[i]["inventory1"]));
 
             if(this.isNum(this.invRecords[i]["inventory1"]) == false || this.isNum(this.invRecords[i]["inventory2"]==false)){
-                alert("杈撳叆鏍煎紡涓嶆纭�,璇疯緭鍏ユ暟瀛�!");
+                // alert("杈撳叆鏍煎紡涓嶆纭�,璇疯緭鍏ユ暟瀛�!");
+                this.showMyToast('淇濆瓨澶辫触','杈撳叆鏍煎紡涓嶆纭�,璇疯緭鍏ユ暟瀛�','error');
                 this.showSpinner = false;
                 return;
             }
             if(this.invRecords[i]["inventory1"] == ''||this.invRecords[i]["inventory1"] == null ||this.invRecords[i]["inventory2"] == null ||
             this.invRecords[i]["inventory2"] == ''){
-                alert('璇疯緭鍏�' +this.invRecords[i]["productNumber"] + '搴撳瓨涓婁笅闄愪俊鎭紒');
+                // alert('璇疯緭鍏�' +this.invRecords[i]["productNumber"] + '搴撳瓨涓婁笅闄愪俊鎭紒');
+                this.showMyToast('淇濆瓨澶辫触','璇疯緭鍏�' +this.invRecords[i]["productNumber"] + '搴撳瓨涓婁笅闄愪俊鎭�','error');
                 this.showSpinner = false;
                 return;
             }
             if(Number(this.invRecords[i]["inventory1"])>Number(this.invRecords[i]["inventory2"])){
-                alert( this.invRecords[i]["productNumber"]  + '搴撳瓨涓嬮檺澶т簬涓婇檺锛�');
+                // alert( this.invRecords[i]["productNumber"]  + '搴撳瓨涓嬮檺澶т簬涓婇檺锛�');
+                this.showMyToast('淇濆瓨澶辫触',this.invRecords[i]["productNumber"]  + '搴撳瓨涓嬮檺澶т簬涓婇檺','error');
                 this.showSpinner = false;
                 return;
             }
@@ -122,28 +125,17 @@
                 userPro_Type:this.userPro_Type
             }).then((result) => {
                 result = JSON.parse(JSON.stringify(result));
-                console.log('result'+JSON.stringify(result));
+                console.log('result===>'+JSON.stringify(result));
                 if(result.status == 'Success'){
-                    const evt = new ShowToastEvent({
-						title: "淇濆瓨鎴愬姛",
-						message: result.msg,
-						variant: "Success",
-					});
-					this.dispatchEvent(evt);
+                    this.showMyToast('淇濆瓨鎴愬姛','','success');
                     this.showSpinner = false;
-                    this[NavigationMixin.Navigate]({
-                        type: 'standard__webPage',
-                        attributes: {
-                            url: '/lextoppage'
-                        }
-                    });
+                    // setTimeout(this.toLexToppage(),5000 );  
+                    setTimeout(() => {
+                        this.toLexToppage();
+                    }, 500);
+                   
                 }else{
-                    const evt = new ShowToastEvent({
-						title: "淇濆瓨澶辫触",
-						message: result.msg,
-						variant: "Error",
-					});
-					this.dispatchEvent(evt);
+                    this.showMyToast('淇濆瓨澶辫触',result.msg,'error');
                     this.showSpinner = false;
 
                 }
@@ -174,4 +166,28 @@
     var reNum =/^[0-9]+$/;
     return (reNum.test(num));
     }
+    showMyToast(title, message, variant) {
+        console.log('show custom message');
+        var iconName = '';
+        var content = '';
+        if(variant == 'success'){
+           iconName = 'utility:check';
+        }else{
+           iconName = 'utility:error';
+        }
+        if(message != ''){
+           content = '<h2><strong>'+title+'<strong/></h2><h5>'+message+'</h5>';
+        }else{
+           content = '<h2><strong>'+title+'<strong/></h2>';
+        }
+        this.template.querySelector('c-common-toast').showToast(variant,content,iconName,10000);
+        }
+        toLexToppage(){
+            this[NavigationMixin.Navigate]({
+                type: 'standard__webPage',
+                attributes: {
+                    url: '/lextoppage'
+                }
+            });
+        }
 }
\ No newline at end of file

--
Gitblit v1.9.1