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/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js |   45 +++++++++++++++++++++------------------------
 1 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
index c75f6c5..983dcf7 100644
--- a/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
+++ b/force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
@@ -1,13 +1,12 @@
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
-import { NavigationMixin } from 'lightning/navigation';
 import  init  from '@salesforce/apex/ApplicationButtonController.initSubmitButton';
 import { updateRecord } from 'lightning/uiRecordApi';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import submitCancel from '@salesforce/apex/ApplicationButtonController.submitCancel';
-import UserInfo_Owner from '@salesforce/apex/ApplicationButtonController.UserInfo_Owner';
-export default class Submit extends LightningElement {
+import userInfo_Owner from '@salesforce/apex/ApplicationButtonController.userInfo_Owner';
+export default class lexApplicationCancelSubmit extends LightningElement {
     @api recordId;//OwnerId
     ownerId;
     monthlyReportId;
@@ -19,33 +18,25 @@
            const urlValue = currentPageReference.state.recordId;
            if (urlValue) {
              let str = `${urlValue}`;
-             console.log("str:"+str);
              this.recordId = str;
            }
          }
      }
     
-
     connectedCallback(){
         init({
             recordId: this.recordId
         }).then(result => {
-            if (result != null) {
                 this.IsLoading = false;
                 this.ownerId = result.OwnerId;
                 this.monthlyReportId = result.Id;
                 this.cancelSubmit();
-            }
-        }).catch(error => {
-            console.log("error"+error);
-        }).finally(() => {
-            
-        });        
+        })       
     }
-
+    //鎺堟潈鐢宠 鍙栨秷鎻愪氦
     cancelSubmit(){
-        UserInfo_Owner({}).then(result=>{
-            console.log(result,'鑾峰彇褰撳墠鐧婚檰浜篿d')
+        //'鑾峰彇褰撳墠鐧婚檰浜篿d'
+        userInfo_Owner({}).then(result=>{
             if(this.ownerId == result.id){
                 submitCancel({
                     recordId: this.recordId
@@ -65,20 +56,26 @@
         })
     }
 
-
     updateRecordView() {
         updateRecord({fields: { Id: this.recordId }});
     }
 
     showToast(msg,type) {
-        const event = new ShowToastEvent({
-            message: msg,
-            variant: type
-        });
         if(type == 'success'){
-            this.updateRecordView();
-        }
-        this.dispatchEvent(event);
-        this.dispatchEvent(new CloseActionScreenEvent());
+            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());
+        }   
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1