From 87861ae5f1ed5456685f97f8a8e7625e47b9576d Mon Sep 17 00:00:00 2001
From: KKbes <1620284052@qq.com>
Date: 星期四, 13 四月 2023 11:12:26 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev

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

diff --git a/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
new file mode 100644
index 0000000..9de188b
--- /dev/null
+++ b/force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
@@ -0,0 +1,71 @@
+import {
+    LightningElement,
+    wire,
+    api
+} from 'lwc';
+import {
+    CurrentPageReference
+} from "lightning/navigation";
+import {
+    CloseActionScreenEvent
+} from 'lightning/actions';
+import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init';
+import selectRecords from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectRecords';
+
+export default class LexSubmitForApproval extends LightningElement {
+    @api recordId;
+    str;
+    IsLoading = true;
+    Id;
+
+    @wire(CurrentPageReference)
+    getStateParameters(currentPageReference) {
+        if (currentPageReference) {
+            const urlValue = currentPageReference.state.recordId;
+            if (urlValue) {
+                let str = `${urlValue}`;
+                this.recordId = str;
+            }
+        }
+    }
+
+    connectedCallback() {
+        console.log(this.recordId);
+        init({
+            recordId: this.recordId
+        }).then(result => {
+            console.log(result);
+            if (result != null) {
+                this.IsLoading = false;
+                this.Id = result.Id;
+
+                this.SubmitForApproval();
+                this.dispatchEvent(new CloseActionScreenEvent());
+            }
+        }).catch(error => {
+            console.log(error);
+        }).finally(() => {
+
+        });
+    }
+
+    // 鍏抽棴璇环/鍏抽棴缁
+    SubmitForApproval() {
+        var url = '';
+        selectRecords({
+            recordId: this.Id
+        }).then(result => {
+            console.log(result);
+            if (result.length > 0) {
+                url = "/apex/SubmitForApprovalPage?id=" + result[0].Id;
+            } else {
+                url = "/apex/SubmitForApprovalPage?mcId=" + this.Id;
+            }
+            window.open(url, '', 'height=350, width=600, top=200, left=350,location=no');
+        }).catch(error => {
+            console.log("error");
+        }).finally(() => {
+
+        });
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1