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/lexCancelSubmit/lexCancelSubmit.js |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
index 17d0216..1a561c2 100644
--- a/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
+++ b/force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-04-07 09:02:03
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-04-11 11:17:24
+ * @LastEditTime: 2023-10-10 17:32:11
  */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
@@ -15,10 +15,13 @@
 import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
 export default class LexCancelSubmit extends LightningElement {
     @api recordId;//OwnerId
     ownerId;
     monthlyReportId;
+    userId;
     IsLoading = true;
 
 
@@ -39,6 +42,10 @@
     }
 
     connectedCallback () {
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
+           
         console.log(this.recordId);
         init({
             recordId: this.recordId
@@ -46,9 +53,9 @@
             console.log(result);
             if (result != null) {
                 this.ownerId = result.ownerId;
+                this.userId = result.userId;
                 this.monthlyReportId = result.Id;
                 this.cancelSubmit();
-                console.log("end");
                 //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Monthly_Report__c/" + this.monthlyReportId + "/view");
             }
         }).catch(error => {
@@ -58,19 +65,28 @@
     }
 
     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 }});
     }
     cancelSubmit () {
-        //闇�瑕佸畬鍠�
-        if(this.ownerId == UserInfo_Owner.Id) {
+        if(this.ownerId == this.userId) {
             cancel({
                 recordId: this.recordId
             }).then(result=>{

--
Gitblit v1.9.1