liuyn
2024-03-22 e8be4d964c6b336ed39dba5900b1b9a8f3181b96
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
/*
 * @Description: 
 * @version: 
 * @Author: chen jing wu
 * @Date: 2023-09-12 15:25:16
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-09-12 15:40:46
 */
import { LightningElement,api,wire } from 'lwc';
import { CloseActionScreenEvent } from "lightning/actions";
import { CurrentPageReference } from "lightning/navigation";
import Sample_Inventory_Report from "@salesforce/label/c.Sample_Inventory_Report";
import init from '@salesforce/apex/lexAccountController.init';
 
export default class LexSampleInventoryReport extends LightningElement {
    @api recordId;
    name;
    @wire(CurrentPageReference)
    getStateParameters(currentPageReference) {
      if (currentPageReference) {
        this.url = currentPageReference.state.backgroundContext;
        const urlValue = currentPageReference.state.recordId;
        if (urlValue) {
          let str = `${urlValue}`;
          this.recordId = str;
        }
      }
    }
 
    connectedCallback() {
        init({
            recordId: this.recordId
        }).then(result=>{
            this.name = result.name;
            window.open('/lightning/r/Report/' + Sample_Inventory_Report + '/view?fv0=' + this.name,'_blank');
            this.closeAction();
        });
        
    }
 
    closeAction() {
        this.dispatchEvent(new CloseActionScreenEvent());
        return;
    }
}