buli
2023-05-23 07390e2fcb4adf27c928335bf27ae7939c5a80ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * @Description: 
 * @version: 
 * @Author: chen jing wu
 * @Date: 2023-05-15 11:14:32
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-05-15 11:50:12
 */
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 {
    @api recordId;
    accountName;
    accountId;
    oppName;
    @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.accountId = result.accountId;
            this.accountName = result.accountName;
            this.oppName = result.name;
            this.assignTask();
        }).catch(error=>{
            console.log("error");
            console.log(error);
        });
     }
     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);
        this.dispatchEvent(new CloseActionScreenEvent());
     }
}