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

---
 force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js b/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
index acfaab3..7b43a5b 100644
--- a/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
+++ b/force-app/main/default/lwc/lexAssignTaskButton/lexAssignTaskButton.js
@@ -4,7 +4,7 @@
  * @Author: chen jing wu
  * @Date: 2023-05-15 11:14:32
  * @LastEditors: chen jing wu
- * @LastEditTime: 2023-06-05 14:01:14
+ * @LastEditTime: 2023-09-21 17:13:37
  */
 import { LightningElement,wire,track,api} from 'lwc';
 import { CurrentPageReference } from "lightning/navigation";
@@ -12,7 +12,10 @@
 import init from '@salesforce/apex/OpportunityLightingButtonController.initForAssignTaskButtonButton';
 import { NavigationMixin } from 'lightning/navigation';
 import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
-export default class LexAssignTaskButton extends LightningElement {
+import RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP from '@salesforce/label/c.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {loadStyle} from 'lightning/platformResourceLoader';
+export default class LexAssignTaskButton extends NavigationMixin(LightningElement) {
     @api recordId;
     accountName;
     accountId;
@@ -34,13 +37,16 @@
          }
      }
      connectedCallback(){
+        Promise.all([
+            loadStyle(this, lwcCSS)
+           ]);
         init({
             recordId: this.recordId
         }).then(result=>{
             this.accountId = result.accountId;
             this.accountName = result.accountName;
             this.oppName = result.name;
-            this.recordTypeId = result.recordTypeId;
+            this.recordTypeId = RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP;
             this.assignTask();
         }).catch(error=>{
             console.log("error");
@@ -71,19 +77,28 @@
             account__c: this.accountId,
             OpportunityId__c: this.recordId,
             taskStatus__c: '01 鍒嗛厤',
-            taskDifferent__c: '涓婄骇鍒嗛厤浠诲姟'
+            taskDifferent__c: '涓婄骇鍒嗛厤浠诲姟',
+            Name: '*'
         });
+        let states = 
+                {
+                    nooverride: '1',
+                    navigationLocation: 'LIST_VIEW',
+                    // backgroundContext: '/lightning/o/Account/list?filterName=Recent&0.source=alohaHeader',
+                    backgroundContext: '/lightning/r/Opportunity/'+this.recordId+'/view',
+                    defaultFieldValues: defaultValues,
+                };
+
+            // states['recordTypeId'] =  this.recordTypeId;
+        states['useRecordTypeCheck'] =  true;
+       
         this[NavigationMixin.Navigate]({
             type: 'standard__objectPage',
             attributes: {
-                objectApiName: 'Task',
+                objectApiName: 'task__c',
                 actionName: 'new'
             },
-            state: {
-                nooverride: '1',
-                defaultFieldValues: defaultValues,
-                recordTypeId: this.recordTypeId
-            }
+            state: states
         });
         this.dispatchEvent(new CloseActionScreenEvent());
      }

--
Gitblit v1.9.1