From 35910c355f74e736e2068a0ffb7f39ae9615d8e1 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 16:29:00 +0800
Subject: [PATCH] 1
---
force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js | 57 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js b/force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js
index e7c5194..84ae69b 100644
--- a/force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js
+++ b/force-app/main/default/lwc/lexSubmitSolutionForApproval/lexSubmitSolutionForApproval.js
@@ -4,19 +4,25 @@
* @Author: chen jing wu
* @Date: 2023-06-20 14:37:24
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-07-07 16:11:12
+ * @LastEditTime: 2023-10-11 16:54:13
*/
-import { api, wire,LightningElement } from 'lwc';
+import { api, wire,LightningElement, track } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
import { CloseActionScreenEvent } from 'lightning/actions';
import updateSubmitSolutionForApprovalButton from '@salesforce/apex/lexSolutionProjectRequirementsController.updateSubmitSolutionForApprovalButton';
import init from '@salesforce/apex/lexSolutionProjectRequirementsController.initSubmitSolutionForApprovalButton';
import queryForAttachments from '@salesforce/apex/lexSolutionProjectRequirementsController.queryForAttachments';
-import { updateRecord } from 'lightning/uiRecordApi';
+import { updateRecord,getRecord } from 'lightning/uiRecordApi';
+import STATUS_FIELD from "@salesforce/schema/SolutionProjectRequirements__c.Status__c";
+import { refreshApex } from '@salesforce/apex';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import LightningConfirm from 'lightning/confirm';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
export default class LexSubmitSolutionForApproval extends LightningElement {
+ @wire(getRecord, { recordId: '$recordId', fields: [STATUS_FIELD] })
+ record;
@api recordId;
status;
submitDateYouWant;
@@ -41,12 +47,22 @@
}
}
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());
+ }
}
@@ -55,6 +71,10 @@
}
connectedCallback(){
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
+
init({
recordId: this.recordId
}).then(result=>{
@@ -79,13 +99,12 @@
this.dispatchEvent(new CloseActionScreenEvent());
return;
}
-
- if(this.submitDateYouWant < this.createdDate + 3){
+ this.createdDate.setDate(this.createdDate.getDate() + 3);
+ if(this.submitDateYouWant.getTime() < this.createdDate.getTime()){
this.showToast('甯屾湜鎻愪氦鏃ユ湡涓嶅緱灏忎簬涓夊ぉ锛屽绱ф�ラ渶姹傝閭欢鑱旂粶Solution鎷呭綋','error');
this.dispatchEvent(new CloseActionScreenEvent());
return;
}
- console.log("start");
queryForAttachments({
Id: this.departmentClassId
}).then(result=>{
@@ -95,7 +114,7 @@
var usrname = this.userName;
var rtn = '';
console.log("start");
- if(header.includes(usrname)){
+ if(header != undefined && header != null && header != '' && header.includes(usrname)){
rtn = 'Y';
}else{
rtn = 'N';
@@ -118,7 +137,7 @@
const result = await LightningConfirm.open({
message: msg,
variant: 'headerless',
- label: 'this is the aria-label value',
+ label: 'this is the aria-label value'
});
console.log(result);
if(result){
@@ -129,7 +148,13 @@
if(results){
this.showToast(results,"error");
this.dispatchEvent(new CloseActionScreenEvent());
- }
+ } else{
+ setTimeout(() => {
+ refreshApex(this.record);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }, 1000);
+
+ }
} catch (error) {
if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
this.showToast('褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�','error');
@@ -140,8 +165,6 @@
}
return;
}
- this.updateRecordView(this.recordId);
- this.dispatchEvent(new CloseActionScreenEvent());
});
// isopd.Id = "{!SolutionProjectRequirements__c.Id}";
// isopd.Submint_TF__c = true;
--
Gitblit v1.9.1