liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
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
/*
 * @Author: zhangchunxu
 * @Date: 2023-07-21 11:33:34
 * @LastEditors: zhangchunxu
 * @LastEditTime: 2023-08-01 13:45:13
 * 
 */
import { LightningElement, api, track } from 'lwc';
import BatchDelete from '@salesforce/apex/SetFrameNumManageWebService.BatchDelete';
import { NavigationMixin } from 'lightning/navigation';
import { ShowToastEvent } from "lightning/platformShowToastEvent";
import LightningConfirm from 'lightning/confirm';
 
export default class LexBatchDelete extends NavigationMixin(LightningElement) {
    @api listViewIds;
    @track isLoading = false;
 
    // 机身号管理 批量删除
    connectedCallback() {
        console.log('this.listViewIds = ' + this.listViewIds);
        if (this.listViewIds) {
            this.isLoading = true;
            let keyList = (this.listViewIds + '').split(',');        
            if (confirm('确定要删除这' + keyList.length + '条数据吗?')) {
                BatchDelete({
                    ids : keyList
                }).then((r) => {
                    if (r == 'success') {
                        
                    }else{
                        alert(r);
                    }
                    this.BatchDeleteListing();
                })
            }else{
                this.BatchDeleteListing();
            }
        } else {
            alert('请至少选择一条数据。');
            this.BatchDeleteListing();
        }
    }
 
    BatchDeleteListing() {
        window.open('/lightning/o/FrameNumManage__c/list?filterName=Recent')
        window.close();
    }
 
    showToast(type, msg) {
        this.isLoading = false;
        const event = new ShowToastEvent({
            title: msg,
            variant: type,
        });
        this.dispatchEvent(event);
    }
}