From dc9dd4718143b694cad029dac5cfa33616e23262 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 12 四月 2024 10:09:28 +0800
Subject: [PATCH] 123

---
 force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
index 20aef43..5506261 100644
--- a/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
+++ b/force-app/main/default/lwc/lexOTHCreate/lexOTHCreate.js
@@ -1,3 +1,57 @@
-import { LightningElement } from 'lwc';
+/*
+ * @Description: 
+ * @version: 
+ * @Author: chen jing wu
+ * @Date: 2023-06-29 15:55:05
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-06-30 11:28:58
+ */
+import { api, wire,LightningElement } from 'lwc';
+import { CurrentPageReference } from "lightning/navigation";
+import { CloseActionScreenEvent } from 'lightning/actions';
+import init  from '@salesforce/apex/lexAccountController.initForOTHCreateButton';
 
-export default class LexOTHCreate extends LightningElement {}
\ No newline at end of file
+export default class LexOTHCreate extends LightningElement {
+    @api recordId;
+    recordTypeId;
+    @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(){
+        init({
+            recordId: this.recordId
+        }).then(result=>{
+            this.recordTypeId = result.recordTypeId;
+            this.OTHCreate();
+        });
+    }
+    OTHCreate(){
+        const defaultValues = encodeDefaultFieldValues({
+            Account__c: this.recordId
+        });
+        this[NavigationMixin.Navigate]({
+            type: 'standard__objectPage',
+            attributes: {
+                objectApiName: 'Account_Number_of_case__c',
+                actionName: 'new'
+            },
+            state: {
+                nooverride: '1',
+                defaultFieldValues: defaultValues,
+                RecordTypeId: this.recordTypeId
+            }
+        });
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1