From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改

---
 force-app/main/default/lwc/lexSubmitSolutionSchemeForApproval/lexSubmitSolutionSchemeForApproval.js |   59 +++++++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/force-app/main/default/lwc/lexSubmitSolutionSchemeForApproval/lexSubmitSolutionSchemeForApproval.js b/force-app/main/default/lwc/lexSubmitSolutionSchemeForApproval/lexSubmitSolutionSchemeForApproval.js
index 479b649..55c7347 100644
--- a/force-app/main/default/lwc/lexSubmitSolutionSchemeForApproval/lexSubmitSolutionSchemeForApproval.js
+++ b/force-app/main/default/lwc/lexSubmitSolutionSchemeForApproval/lexSubmitSolutionSchemeForApproval.js
@@ -1,15 +1,8 @@
-/*
- * @Description: 
- * @version: 
- * @Author: chen jing wu
- * @Date: 2023-06-21 09:17:25
- * @LastEditors: chen jing wu
- * @LastEditTime: 2023-07-07 16:35:41
- */
 import { api, wire,LightningElement } from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
 import updateSubmitSolutionSchemeForApprovalButton  from '@salesforce/apex/lexSolutionProgrammeController.updateSubmitSolutionSchemeForApprovalButton';
+import submitApproval  from '@salesforce/apex/lexSolutionProgrammeController.submitApproval';
 import init  from '@salesforce/apex/lexSolutionProgrammeController.initSubmitSolutionSchemeForApprovalButton';
 import queryForAttachments  from '@salesforce/apex/lexSolutionProgrammeController.queryForAttachments';
 import { updateRecord } from 'lightning/uiRecordApi';
@@ -36,15 +29,6 @@
           }
         }
     }
-    showToast(msg,type) {
-        const event = new ShowToastEvent({
-            title: '',
-            message: msg,
-            variant: type
-        });
-        this.dispatchEvent(event);
-    }
-
 
     updateRecordView(recordId) {
         updateRecord({fields: { Id: recordId }});
@@ -54,8 +38,9 @@
         init({
             recordId: this.recordId
         }).then(result=>{
-            this.schemeType = result.schemeType == undefined ? result.schemeType : '';
-            this.confirmationResult = result.confirmationResult == undefined ? result.confirmationResult : '';
+            console.log(result);
+            this.schemeType = result.schemeType;
+            this.confirmationResult = result.confirmationResult == undefined ?  '' : result.confirmationResult;
             this.submitSolutionSchemeForApproval();
         });
     }
@@ -76,22 +61,29 @@
         });
         console.log(result);
         if(result){
-            if(this.schemeType == '缁撴' && this.confirmationResult == ''){
+            console.log(this.schemeType);
+            console.log(this.confirmationResult);
+            if(this.schemeType == '缁撴' && (this.confirmationResult == '' || this.confirmationResult == undefined)){
                 this.showToast('缁撴鏂规鎻愪氦鍓嶏紝鏂规閲囩撼缁撴灉蹇呭~','error');
                 this.dispatchEvent(new CloseActionScreenEvent());
                 return;
             }
+            console.log('this.schemeType:'+this.schemeType);
             if((this.records.length > 0 && this.schemeType == '缁撴') || (this.schemeType == '鍒濇')){
-                updateSubmitSolutionSchemeForApprovalButton({
-                    recordId: this.recordId
-                }).then(result=>{
-                    if(result){
-                        this.showToast(result,'error');
+                submitApproval({recordId:this.recordId}).then(rep => {
+                    console.log(rep);
+                    if(rep==='OK'){
+                        console.log('1');
+                        this.showToast('鎻愪氦瀹℃壒鎴愬姛','success');
                     }else{
-                        this.updateRecordView(this.recordId);
+                        console.log('2');
+                        this.showToast(rep,'error');
                     }
-                    this.dispatchEvent(new CloseActionScreenEvent());
-                });
+                }).catch(err => {
+                    console.log('3');
+                    console.log(err);
+                    this.showToast(err,'error');
+                })
             }else{
                 this.showToast('缁撴鐨勬柟妗堟彁浜ゅ墠锛屽繀椤讳笂浼犵粨妗堥檮浠�','error');
                 this.dispatchEvent(new CloseActionScreenEvent());
@@ -103,4 +95,15 @@
             return;
         }
     }
+    showToast(msg, type) {
+        const event = new ShowToastEvent({
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+        this.dispatchEvent(new CloseActionScreenEvent());
+        if(type==='success'){
+            window.location.href = '/lightning/r/Solution_Programme__c/'+this.recordId+'/view';
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1