From 1a1303f4f3c933dcfb67df7f1f630159e6ee0740 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 20:03:36 +0800
Subject: [PATCH] 123
---
force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js | 71 +++++++++++++++++++++++++++--------
1 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js b/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
index a35eaa0..69fa193 100644
--- a/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
+++ b/force-app/main/default/lwc/improvedForecastTime/improvedForecastTime.js
@@ -1,11 +1,16 @@
-import { LightningElement, track } from 'lwc';
+import { api, wire,LightningElement } from 'lwc';
import GetOppinformationcData from '@salesforce/apex/ImprovedForecastTimeController.GetOppinformationcData';
import getReason from '@salesforce/apex/ImprovedForecastTimeController.getReason';
import SaveData from '@salesforce/apex/ImprovedForecastTimeController.SaveData';
import SystemModstamp from '@salesforce/schema/Account.SystemModstamp';
-
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import { CloseActionScreenEvent } from 'lightning/actions';
+import { updateRecord } from 'lightning/uiRecordApi';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+import lexDateCss from '@salesforce/resourceUrl/lexDateCss';
export default class ImprovedForecastTime extends LightningElement {
-
+ @api recordId;
//鏄剧ず涓庨殣钘�
isAdvance = false; //閫夌潃 鎻愬墠 鐨勬爣璇�
isDelay = false; //閫夌潃 寤跺悗 鐨勬爣璇�
@@ -14,6 +19,9 @@
{label:"鎻愬墠",value:"鎻愬墠"},
{label:"寤跺悗",value:"寤跺悗"},
]
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
handleRelationFn(event){
@@ -99,8 +107,12 @@
//鍒濆鍖�
connectedCallback(){
- this.oppId = this.getQueryVariable('id');
-
+ Promise.all([
+ loadStyle(this, lwcCSS),
+ loadStyle(this, lexDateCss)
+ ]);
+ this.oppId = this.recordId;
+ console.log('oppId--' + this.oppId);
GetOppinformationcData({ParamIdStr:this.oppId}).then(response=>{
this.opp=JSON.parse(response);
@@ -136,10 +148,10 @@
if (error) {
this.TongzhiIcon = "standard:first_non_empty";
- this.BgColorStyle = "background-color:#f88568";
+ this.BgColorStyle = "background-color:#ba0517";
}else{
this.TongzhiIcon = "standard:account";
- this.BgColorStyle = "background-color:#69e669";
+ this.BgColorStyle = "background-color:#DD7A01";
}
if (left) {
this.IsLeftStyle = "left: 0.25rem"
@@ -147,7 +159,25 @@
this.IsLeftStyle = ""
}
}
+ 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);
+ }
+ }
//鍏抽棴鎻愮ず妗�
CloseAlert(){
this.closeOffRefresh();
@@ -212,24 +242,24 @@
// if(this.opp.Date_InAdvance_Delay == '' ||this.opp.Date_InAdvance_Delay == undefined || this.opp.Predicted_date_ChangeReason == '' ||this.opp.Predicted_date_ChangeReason == undefined|| myDate5 == '' || myDate5 == undefined){
if(!this.opp.Date_InAdvance_Delay || !this.opp.Predicted_date_ChangeReason || !this.opp.Close_Forecasted_Date){
//SWAG-CJR4PC銆愬鎵樸�戣皟鏌�-淇敼棰勬祴鏃ユ彁鍓嶇悊鐢遍敊璇� fy end
- this.Alert("璇烽�夋嫨鏃ユ湡/鐞嗙敱銆�",false,true);
+ this.showToast("璇烽�夋嫨鏃ユ湡/鐞嗙敱銆�","error");
}
else if(this.opp.Date_InAdvance_Delay == '鎻愬墠' && (myDate5 >= myDate4 || myDate5 < myDate3)){
- this.Alert("璇烽�夋嫨 鈥滄彁鍓嶁�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡 涓� 涓嶆棭浜庝粖澶┿��",false,true);
+ this.showToast("璇烽�夋嫨 鈥滄彁鍓嶁�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡 涓� 涓嶆棭浜庝粖澶┿��","error");
}
else if(this.opp.Date_InAdvance_Delay == '寤跺悗' && myDate5 <= myDate4){
- this.Alert("璇烽�夋嫨 鈥滃欢鍚庘�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡銆�",false,true);
+ this.showToast("璇烽�夋嫨 鈥滃欢鍚庘�� 浜庡綋鍓嶉娴婳CSM绛剧害鏃ョ殑鏃ユ湡銆�","error");
}
else if(myDate7 < myDate5){
- this.Alert("棰勬祴鍙戣揣鏃ヤ笉鑳藉皬浜庨娴嬬绾︽棩銆�",false,true);
+ this.showToast("棰勬祴鍙戣揣鏃ヤ笉鑳藉皬浜庨娴嬬绾︽棩銆�","error");
}
//20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� start
else if(myDate5 > OrderDate){
- this.Alert("璁㈣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ヤ笁璐㈠勾鍐呫��",false,true);
+ this.showToast("璁㈣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ヤ笁璐㈠勾鍐呫��","error");
}
else if(myDate7 > ShipmentsDate){
- this.Alert("鍙戣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ュ洓璐㈠勾鍐呫��",false,true);
+ this.showToast("鍙戣揣棰勬祴鏃ヨ鍦ㄦ湭鏉ュ洓璐㈠勾鍐呫��","error");
}
//20221226 lt DB202212359066澧炲姞闄愬埗-淇敼棰勬祴鏃ユ渶澶ф棩鏈� end
@@ -238,10 +268,19 @@
SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
if (response == '鎴愬姛') {
this.OnLoading(false);
- this.Alert("淇濆瓨鎴愬姛",false,true);
- window.location.hash = "Refresh"+"=="+this.oppId;
+ this.showToast("淇濆瓨鎴愬姛","success");
+ // window.location.hash = "Refresh"+"=="+this.oppId;
+ const closeEvent = new CustomEvent('closeaction', {
+ bubbles: true, // 鍏佽浜嬩欢鍐掓场鑷崇埗缁勪欢
+ composed: true, // 鍏佽浜嬩欢绌胯秺 Shadow DOM 鐣岄檺
+ });
+ setTimeout(() => {
+ window.location = '/' + this.recordId;
+ }, 2000);
+ this.dispatchEvent(closeEvent);
}else{
- this.Alert(response,true);
+ this.showToast(response,"error");
+ this.IsLoading = false;
}
});
}
--
Gitblit v1.9.1