/*
|
* @Description:
|
* @Author: [lijinhuan]
|
* @Date: 2023-08-14 22:10:38
|
* @LastEditors: [lijinhuan]
|
* @LastEditTime: 2023-09-13 20:38:00
|
*/
|
import { LightningElement,wire,track,api} from 'lwc';
|
import { CurrentPageReference } from "lightning/navigation";
|
import { CloseActionScreenEvent } from 'lightning/actions';
|
import { NavigationMixin } from 'lightning/navigation';
|
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
|
import recordTypeId from '@salesforce/apex/toBatchOwnerController.TypeId';
|
|
export default class LexAssignTaskButtonAccount extends NavigationMixin(LightningElement) {
|
@api recordId;
|
IsLoading=true;
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference){
|
console.log("进入页面");
|
console.log(currentPageReference);
|
if(currentPageReference){
|
const urvalue=currentPageReference.state.recordId;
|
if(urvalue){
|
let str=`${urvalue}`;
|
console.log('str');
|
console.log(str);
|
this.recordId=str;
|
}
|
}
|
}
|
connectedCallback(){
|
recordTypeId().then(res => {
|
// const defaultValues = encodeDefaultFieldValues({
|
// account__c: this.recordId,
|
// taskStatus__c: '01 分配',
|
// taskDifferent__c: '上级分配任务',
|
// Name:'*'
|
// });
|
// let url = '/setup/ui/recordtypeselect.jsp?ent=' + res.endId + '&p3=' + res.recordTypeId.slice(0,res.recordTypeId.length - 3) +'&retURL=%2F' +'&save_new_url=%2Fa3V%2Fe%3FretURL%3D%252Fa3V%252Fo'+
|
// '&account__c=' + this.recordId +
|
// '&taskStatus__c=01 分配' +
|
// '&taskDifferent__c=上级分配任务' +
|
// '&Name=*'
|
// this[NavigationMixin.Navigate]({
|
// type: 'standard__webPage',
|
// attributes: {
|
// url:url
|
// }});
|
// window.open(url);
|
|
const defaultValues = encodeDefaultFieldValues({
|
account__c: this.recordId,
|
taskStatus__c: '01 分配',
|
taskDifferent__c: '上级分配任务',
|
Name: '*'
|
});
|
let states =
|
{
|
nooverride: '1',
|
navigationLocation: 'LIST_VIEW',
|
// backgroundContext: '/lightning/o/Account/list?filterName=Recent&0.source=alohaHeader',
|
backgroundContext: '/lightning/r/Account/'+this.recordId+'/view',
|
defaultFieldValues: defaultValues,
|
};
|
|
// states['recordTypeId'] = res.recordTypeId;
|
states['useRecordTypeCheck'] = true;
|
this[NavigationMixin.Navigate]({
|
type: 'standard__objectPage',
|
attributes: {
|
objectApiName: 'task__c',
|
actionName: 'new'
|
},
|
state: states
|
// state: {
|
// nooverride: '1',
|
// defaultFieldValues: defaultValues,
|
// recordTypeId: res.recordTypeId
|
// }
|
});
|
|
// this[NavigationMixin.Navigate]({
|
// type: 'standard__objectPage',
|
// attributes: {
|
// objectApiName: 'task__c',
|
// actionName: 'new'
|
// },
|
// state: {
|
// nooverride: '1',
|
// defaultFieldValues: defaultValues,
|
// recordTypeId: res.recordTypeId
|
// }
|
// });
|
|
}).catch(err => {
|
console.log('err======>',err)
|
})
|
this.dispatchEvent(new CloseActionScreenEvent());
|
}
|
}
|