From 1727a4f4d02e429475608e60f142a63bc24127bc Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 23 十月 2023 10:07:34 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js |   95 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 70 insertions(+), 25 deletions(-)

diff --git a/force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js b/force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js
index b5ea9bb..c95bda2 100644
--- a/force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js
+++ b/force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js
@@ -1,13 +1,14 @@
-import { LightningElement, track } from 'lwc';
+import { LightningElement,api, track } from 'lwc';
 import GetInspectById from '@salesforce/apex/EnquiryNoBiddingController.GetInspectById';
 import SaveDataYB from '@salesforce/apex/EnquiryNoBiddingController.SaveDataYB';
 import ChangeDataYB from '@salesforce/apex/EnquiryNoBiddingController.ChangeDataYB';
 import GetIrresponsibleReason from '@salesforce/apex/EnquiryNoBiddingController.GetIrresponsibleReason';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import CheckOwnerRequest from '@salesforce/apex/EnquiryNoBiddingController.CheckOwner';
-
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
 import GetTenderInformationById from '@salesforce/apex/EnquiryNoBiddingController.GetTenderInformationById';
-
+import { CloseActionScreenEvent } from 'lightning/actions';
 
 import GetDataById from '@salesforce/apex/EnquiryNoBiddingController.GetDataById';
 
@@ -30,6 +31,25 @@
 TongzhiIcon = 'standard:account'  //鎻愮ず鏄剧ず鐨勬爣绛�
 IsLeftStyle = ""  //鎻愮ず鏄剧ず鐨勬牱寮�
 BgColorStyle = ""
+showToast(msg,type) {
+    if(type == 'success'){
+      const event = new ShowToastEvent({
+        title: '',
+        message: msg,
+        variant: type
+      });
+      this.dispatchEvent(event);
+    }else{
+      const event = new ShowToastEvent({
+        title: '',
+        message: msg,
+        variant: type,
+        mode: 'sticky'
+    });
+    this.dispatchEvent(event);
+    }
+
+}
 Alert(content,error = false,left = false){
     this.SaveShowText = content;
     this.Tongzhishow = true;
@@ -72,23 +92,28 @@
         }
         return(false);
     }
-    ParamIdStr = '' //涓嶅簲鏍囩敵璇穒D
-    ParamOIdStr = '' //璇环ID
-    ParamPIdStr = '' //鎷涙姇鏍嘔D
+    @api ParamIdStr = ''; //涓嶅簲鏍囩敵璇穒D
+    @api ParamOIdStr = '';//璇环ID
+    @api ParamPIdStr = ''; //鎷涙姇鏍嘔D
 
     
     connectedCallback(){
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
+        console.log('123456');
+        console.log(this.ParamOIdStr);
         this.OnLoading(true);
         
-        var paramId =  this.getQueryVariable('id');
-        var paramOId =  this.getQueryVariable('oid');
-        var paramTId =  this.getQueryVariable('tid');
+        // var paramId =  this.getQueryVariable('id');
+        // var paramOId =  this.getQueryVariable('oid');
+        // var paramTId =  this.getQueryVariable('tid');
         // paramId = 'a4Y1m0000000dhGEAQ';
         // paramOId = '0061000000QL9M4AAL';
 
-        this.ParamIdStr= paramId;
-        this.ParamOIdStr = paramOId;
-        this.ParamPIdStr = paramTId;
+        // this.ParamIdStr= paramId;
+        // this.ParamOIdStr = paramOId;
+        // this.ParamPIdStr = paramTId;
      
         debugger;
 
@@ -96,7 +121,7 @@
        
         // Opp_Bid__c | Bidding_Project_Name_BidId__c
 
-        if(this.ParamOIdStr !=undefined && this.ParamOIdStr!=false)
+        if(this.ParamOIdStr !='' && this.ParamOIdStr!=false)
         {
             GetDataById({Id:this.ParamOIdStr}).then(response=>{
                 var data = JSON.parse(response);
@@ -109,7 +134,10 @@
                 setTimeout(()=>{
                     this.OnLoading(false);
                 },1500);
-            })
+            }).catch(error=>{
+                console.log('error');
+                console.log(error);
+            });
         }
     }
 
@@ -237,7 +265,7 @@
     //鏁版嵁淇濆瓨鏂规硶
     saveFn(event,temp){
         if(!this.IsCheck){return;}
-
+        this.IsLoading = true;
         this.IsCheck = false;
         
         debugger;
@@ -262,18 +290,27 @@
             debugger;
 
             var IsInsert = this.InspectData.Id==undefined?"鏄�":"鍚�";
+            const closeEvent = new CustomEvent('closeaction', {
+                bubbles: true, // 鍏佽浜嬩欢鍐掓场鑷崇埗缁勪欢
+                composed: true, // 鍏佽浜嬩欢绌胯秺 Shadow DOM 鐣岄檺
+            });
             if (temp == 1) {
                 ChangeDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                     if (response.indexOf("鎴愬姛") != -1) {
-                        this.Alert("鎻愪氦鎴愬姛");
+                        // this.Alert("鎻愪氦鎴愬姛");
+                        this.showToast("鎻愪氦鎴愬姛","success");
                         this.DisabledSet();
-
+                        this.IsLoading = false;
                         this.IsCheck = true;
-
-
-                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
+                        setTimeout(() => {
+                            window.location = '/' + this.ParamOIdStr;
+                        }, 2000);
+                        this.dispatchEvent(closeEvent);
+                        // window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
                     }else{
-                        this.Alert(response,true);
+                        this.showToast(response,"error");
+                        this.IsLoading = false;
+                        // this.Alert(response,true);
                         this.IsCheck = true;
                     }
                 });
@@ -281,11 +318,19 @@
             {
                 SaveDataYB({JsonData:JSON.stringify(this.InspectData),Id:this.ParamOIdStr,IsInsert:IsInsert}).then((response)=>{
                     if (response=="鎴愬姛") {
-                        this.Alert("淇濆瓨鎴愬姛",false,true);
-                        window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
+                        // this.Alert("淇濆瓨鎴愬姛",false,true);
+                        this.showToast("淇濆瓨鎴愬姛","success");
+                        this.IsLoading = false;
+                        // window.location.hash = "Refresh"+"=="+this.ParamOIdStr;
+                        setTimeout(() => {
+                            window.location = '/' + this.ParamOIdStr;
+                        }, 2000);
+                        this.dispatchEvent(closeEvent);
                         this.IsCheck = true;
                     }else{
-                        this.Alert(response,true);
+                        // this.Alert(response,true);
+                        this.showToast(response,"error");
+                        this.IsLoading = false;
                         this.IsCheck = true;
                     }
                 });

--
Gitblit v1.9.1