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

diff --git a/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js b/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
index 854790a..ed8f724 100644
--- a/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
+++ b/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
@@ -4,17 +4,21 @@
  * @Author: chen jing wu
  * @Date: 2023-05-15 11:14:32
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-05-15 11:50:12
+ * @LastEditTime: 2023-09-04 13:16:23
  */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
 import { CloseActionScreenEvent } from 'lightning/actions';
 import init from '@salesforce/apex/OpportunityLightingButtonController.initForAssignTaskButtonButton';
-export default class LexAssignTaskButton extends LightningElement {
+import { NavigationMixin } from 'lightning/navigation';
+import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
+import RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP from '@salesforce/label/c.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP';
+export default class LexAssignTaskButton extends NavigationMixin(LightningElement) {
     @api recordId;
     accountName;
     accountId;
     oppName;
+    recordTypeId;
     @wire(CurrentPageReference)
      getStateParameters(currentPageReference) {
              console.log(111);
@@ -37,6 +41,7 @@
             this.accountId = result.accountId;
             this.accountName = result.accountName;
             this.oppName = result.name;
+            this.recordTypeId = RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP;
             this.assignTask();
         }).catch(error=>{
             console.log("error");
@@ -44,25 +49,44 @@
         });
      }
      assignTask(){
-        //鍩虹璺緞
-        var url = '/setup/ui/recordtypeselect.jsp?ent=01I100000016llf';
-        //璁板綍绫诲瀷
-        url += '&p3=01210000000cWfw';
-        url += '&retURL=%2F';
-        url += '&save_new_url=%2Fa3V%2Fe%3FretURL%3D%252Fa3V%252Fo';
-        //瀹㈡埛
-        url += '&CF00N100000095tn6=' + this.accountName;
-        url += '&CF00N100000095tn6_lkid=' + this.accountId;
-        //璇环
-        url += '&CF00N100000095zcA=' + this.oppName;
-        url += '&CF00N100000095zcA_lkid=' + this.recordId;
-        //浠诲姟鐘舵��
-        url += '&00N100000095tnR=01 鍒嗛厤';
-        //浠诲姟鍖哄垎
-        url += '&00N100000095tnP=涓婄骇鍒嗛厤浠诲姟';
-        //浠诲姟鍚嶇О
-        url += '&Name=*';
-        window.open(url);
+        // //鍩虹璺緞
+        // var url = '/setup/ui/recordtypeselect.jsp?ent=01I100000016llf';
+        // //璁板綍绫诲瀷
+        // url += '&p3=01210000000cWfw';
+        // url += '&retURL=%2F';
+        // url += '&save_new_url=%2Fa3V%2Fe%3FretURL%3D%252Fa3V%252Fo';
+        // //瀹㈡埛
+        // url += '&CF00N100000095tn6=' + this.accountName;
+        // url += '&CF00N100000095tn6_lkid=' + this.accountId;
+        // //璇环
+        // url += '&CF00N100000095zcA=' + this.oppName;
+        // url += '&CF00N100000095zcA_lkid=' + this.recordId;
+        // //浠诲姟鐘舵��
+        // url += '&00N100000095tnR=01 鍒嗛厤';
+        // //浠诲姟鍖哄垎
+        // url += '&00N100000095tnP=涓婄骇鍒嗛厤浠诲姟';
+        // //浠诲姟鍚嶇О
+        // url += '&Name=*';
+        // window.open(url);
+        const defaultValues = encodeDefaultFieldValues({
+            account__c: this.accountId,
+            OpportunityId__c: this.recordId,
+            taskStatus__c: '01 鍒嗛厤',
+            taskDifferent__c: '涓婄骇鍒嗛厤浠诲姟',
+            Name: '*'
+        });
+        this[NavigationMixin.Navigate]({
+            type: 'standard__objectPage',
+            attributes: {
+                objectApiName: 'task__c',
+                actionName: 'new'
+            },
+            state: {
+                nooverride: '1',
+                defaultFieldValues: defaultValues,
+                recordTypeId: this.recordTypeId
+            }
+        });
         this.dispatchEvent(new CloseActionScreenEvent());
      }
 }
\ No newline at end of file

--
Gitblit v1.9.1