From b51b57a619d3f0075ccaa13303c99c9e849bf23a Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期二, 23 四月 2024 18:13:54 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/tenderLost/tenderLost.js |   43 +++++++++++++++++++++++++++++++------------
 1 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/lwc/tenderLost/tenderLost.js b/force-app/main/default/lwc/tenderLost/tenderLost.js
index 6530e03..af891e8 100644
--- a/force-app/main/default/lwc/tenderLost/tenderLost.js
+++ b/force-app/main/default/lwc/tenderLost/tenderLost.js
@@ -4,9 +4,15 @@
 // import SearchParent from '@salesforce/apex/TenderLostController.SearchParent';
 import InitData from '@salesforce/apex/TenderLostController.InitData';
 import LinkedHospitals from '@salesforce/apex/TenderLostController.LinkedHospitals';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import {loadStyle} from 'lightning/platformResourceLoader'	
+import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';	
 export default class TenderLost extends LightningElement {
-
+    @api
+    recordid;
+    @api
+    url;
     //璧勯噾鏉ユ簮閫夐」
     RelateOption=[
         {label:"鏀垮簻鎷ㄦ",value:"鏀垮簻璩囬噾"},
@@ -61,8 +67,11 @@
 
     //鍒濆鍖�
     connectedCallback(){
-        this.tenId = this.getQueryVariable('id');
-
+        Promise.all([					
+            loadStyle(this, tnederDeletePageCss)	
+        ]);		
+        // this.tenId = this.getQueryVariable('id');
+        this.tenId = this.recordid 
         InitData({ParamIdStr:this.tenId}).then(response=>{
             this.opp=JSON.parse(response);
         });
@@ -105,19 +114,22 @@
     //淇濆瓨鏁版嵁閫昏緫
     saveFn(){
         if(this.opp.Fund_Basis__c == undefined || this.opp.Sales_Method__c == undefined || this.opp.AccountId == undefined){
-            this.Alert("璇蜂笉瑕佽緭鍏ョ┖鍝︺��",false,true);
+            this.showToast("璇蜂笉瑕佽緭鍏ョ┖鍝︺��",'error')
         }else{
             this.OnLoading(true);
             SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
                 if (response != '' && response.indexOf('閿欒') < 0) {
                     this.OnLoading(false);
                     console.log(response);
-                    this.Alert("淇濆瓨鎴愬姛",false,true); 
-                    window.open('/apex/PCLLostReportPage?pageStatus=Create&oppId=' + response + '&lostType=澶卞崟');
+                    // this.Alert("淇濆瓨鎴愬姛",false,true);
+                    this.showToast("淇濆瓨鎴愬姛",'success')
+                    window.location.href = '/'+this.recordid
+                    window.open('/apex/PCLLostReportPageLwc?pageStatus=Create&oppId=' + response + '&lostType=澶卞崟');
+                    // top.window.close();
                     // window.location.hash = "Refresh"+"=="+response;
-                    top.window.close();
                 }else{
-                    this.Alert(response,true);
+                    // this.Alert(response,true);
+                    this.showToast(response,'error')
                 }
             });
         }
@@ -139,10 +151,10 @@
 
         if (error) {
             this.TongzhiIcon = "standard:first_non_empty";
-            this.BgColorStyle = "background-color:#f88568";
+            this.BgColorStyle = "background-color:rgb(234, 0, 30)";
         }else{
             this.TongzhiIcon = "standard:account";
-            this.BgColorStyle = "background-color:#69e669";
+            this.BgColorStyle = "background-color:rgb(46, 132, 74)";
         }
         if (left) {
             this.IsLeftStyle = "left: 0.25rem"
@@ -150,7 +162,14 @@
             this.IsLeftStyle = ""
         }
     }
-
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+    }
     //鍏抽棴鎻愮ず妗�
     CloseAlert(){
         this.closeOffRefresh();

--
Gitblit v1.9.1