From bdb1a98b64a2cf59bcfd575c579aa0742e0de954 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 17:21:32 +0800
Subject: [PATCH] 1

---
 force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js |   44 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
index 1caae11..41650dc 100644
--- a/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
+++ b/force-app/main/default/lwc/lexNewOpportunityAgency/lexNewOpportunityAgency.js
@@ -9,6 +9,9 @@
 import queryForRecords2 from '@salesforce/apex/OpportunityLightingButtonController.queryForNewOpportunityAgencyButtonToRecords2';
 import { NavigationMixin } from 'lightning/navigation';
 import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+
 export default class LexNewOpportunityAgency extends NavigationMixin(LightningElement) {
     @api recordId;
     agency1Id;
@@ -41,6 +44,10 @@
         }
     }
     connectedCallback(){
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
+           
         init({
             recordId: this.recordId
         }).then(result=>{
@@ -206,8 +213,21 @@
                                             // + encodeURIComponent(this.opportunityCategory);
                                             // console.log(url);
                                             // window.open(url);
+                                            if(this.closeForecastedDate){
+                                                if(!this.closeForecastedDate.includes(' ')){
+                                                    this.closeForecastedDate += ' 00:00:00'
+                                                }
+                                                this.closeForecastedDate = this.closeForecastedDate.replace(' ','T').replaceAll('/','-') + '.000Z';
+                                                console.log(this.closeForecastedDate);
+                                            }
+                                            if(this.bidPlannedDate){
+                                                if(!this.bidPlannedDate.includes(' ')){
+                                                    this.bidPlannedDate += ' 00:00:00'
+                                                }
+                                                this.bidPlannedDate = this.bidPlannedDate.replace(' ','T').replaceAll('/','-') + '.000Z';
+                                            }
                                             const defaultValues = encodeDefaultFieldValues({
-                                                Name: '(OLYMPUS)',
+                                                Name: '(OLYMPUS)' + this.name,
                                                 Close_Forecasted_Date__c: this.closeForecastedDate,
                                                 Bid_Planned_Date__c: this.bidPlannedDate,
                                                 OCM_Change_To_Opportunity_Flg__c: '1',
@@ -244,12 +264,22 @@
         this.IsLoading = false;
     }
     showToast(msg,type) {
-        const event = new ShowToastEvent({
-            title: '',
-            message: msg,
-            variant: type
-        });
-        this.dispatchEvent(event);
+        if(type == 'success'){
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }else{
+            const event = new ShowToastEvent({
+                message: msg,
+                variant: type,
+                mode: 'sticky'
+            });
+            this.dispatchEvent(event);
+            this.dispatchEvent(new CloseActionScreenEvent());
+        }   
     }
     updateRecordView(recordId) {
         updateRecord({fields: { Id: recordId }});

--
Gitblit v1.9.1