From fd1234ddc5be42b9ec2fad9d9286cd2aa58eb0ef Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期二, 11 四月 2023 14:29:54 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

---
 force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
new file mode 100644
index 0000000..b364850
--- /dev/null
+++ b/force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
@@ -0,0 +1,104 @@
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-03-27 14:08:56
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-10 17:49:00
+ */
+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/ReportController.initForVOCConfirmButton';
+import  updateForVOCConfirmButton from '@salesforce/apex/ReportController.updateForVOCConfirmButton';
+import { updateRecord } from 'lightning/uiRecordApi';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+export default class LexVOCConfirm extends LightningElement {
+    @api recordId;
+    status;
+    VOCSatisfy;
+    VOCSatisfy1;
+    Isloading = true;
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+            console.log(111);
+            console.log(currentPageReference);
+
+        if (currentPageReference) {
+          const urlValue = currentPageReference.state.recordId;
+          if (urlValue) {
+            let str = `${urlValue}`;
+            console.log("str");
+            console.log(str);
+            this.recordId = str;
+          }
+        }
+    }
+
+
+
+    connectedCallback(){
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.status = result.status;
+                this.VOCSatisfy = result.Satisfy;
+                this.VOCSatisfy1 = result.Satisfy1;
+                console.log(this.VOCSatisfy);
+                console.log(this.VOCSatisfy1);
+                console.log(this.status);
+                this.update();
+            }
+        }).catch(error => {
+            console.log("error");
+            console.log(error);
+        }).finally(() => {
+            
+        });
+        //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view");
+        this.updateRecordView(this.recordId);
+    }
+
+    updateRecordView(recordId) {
+        updateRecord({fields: { Id: recordId }});
+    }
+
+    showToast(msg,type) {
+        const event = new ShowToastEvent({
+            title: '',
+            message: msg,
+            variant: type
+        });
+        this.dispatchEvent(event);
+    }
+
+
+    update(){
+        if (this.status != "宸插洖绛�") {
+            this.showToast("涓嶆槸宸插洖绛斾笉鑳界偣鍑�","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+            }
+            if (this.VOCSatisfy == undefined) {
+            this.showToast("璇烽�夋嫨鏄惁婊℃剰","error");
+            this.dispatchEvent(new CloseActionScreenEvent());
+            return;
+            }
+        updateForVOCConfirmButton({
+            recordId: this.recordId,
+            Satisfy: this.VOCSatisfy,
+            Satisfy1: this.VOCSatisfy1    
+        }).then(result=>{
+            this.updateRecordView(this.recordId);
+            this.showToast("鎴愬姛","success");
+            this.Isloading = false;
+            this.dispatchEvent(new CloseActionScreenEvent());
+        });
+
+        
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1