From e6a0a7f9ffb463c5ce78d6770b09eac739f88b15 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 24 五月 2023 16:57:53 +0800
Subject: [PATCH] 优化确认框以及修改页面

---
 force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js |   45 +++++++++++++++++++++++++++++++--------------
 1 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
index 3aa9239..1b17446 100644
--- a/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
+++ b/force-app/main/default/lwc/lexOLYwinBid/lexOLYwinBid.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-13 13:15:52
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-13 13:37:19
+ * @LastEditTime: 2023-05-24 16:28:23
  */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
@@ -14,6 +14,7 @@
 import init  from '@salesforce/apex/OpportunityLightingButtonController.initForOLYwinBidButton';
 import updateForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.updateForOLYwinBidButton';
 import queryForOLYwinBidButton  from '@salesforce/apex/OpportunityLightingButtonController.queryForOLYwinBidButton';
+import LightningConfirm from 'lightning/confirm';
 export default class LexOLYwinBid extends LightningElement {
     @api recordId;
     ifOpenBid;
@@ -31,6 +32,34 @@
             console.log(str);
             this.recordId = str;
           }
+        }
+    }
+    async handleConfirmClick(msg) {
+        const result = await LightningConfirm.open({
+            message: msg,
+            variant: 'headerless',
+            label: 'this is the aria-label value',
+        });
+        console.log(result);
+        if(result){
+            try {
+                updateForOLYwinBidButton({
+                    recordId: this.recordId
+                }).then(result=>{
+                    if (result) {
+                        this.showToast(result,"error");
+                    }else{
+                        this.IsLoading = false;
+                        this.updateRecordView(this.recordId);
+                        this.showToast("鎿嶄綔鎴愬姛锛�","success");
+                    }
+                    this.dispatchEvent(new CloseActionScreenEvent());
+                });  
+                } catch(e) {
+                   console.log(e); 
+                }
+        }else{
+            this.dispatchEvent(new CloseActionScreenEvent()); 
         }
     }
     connectedCallback(){
@@ -66,19 +95,7 @@
             if(flag){
                 this.showToast("鏉′欢涓嶇鍚堬紝涓嶅彲鎿嶄綔","error");
             }else{
-                if (window.confirm('鏄惁纭OLY涓爣锛�')) {
-                    updateForOLYwinBidButton({
-                        recordId: this.recordId
-                    }).then(result=>{
-                        if (result) {
-                            this.showToast(result,"error");
-                        }else{
-                            this.IsLoading = false;
-                            this.updateRecordView(this.recordId);
-                            this.showToast("鎿嶄綔鎴愬姛锛�","success");
-                        }
-                    })  
-                }
+                this.handleConfirmClick('鏄惁纭OLY涓爣锛�');
             }
         });    
     }

--
Gitblit v1.9.1