buli
2023-07-11 0c4796706fc9473d069b620321a54b20a119906c
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
import { LightningElement,track } from 'lwc';
 
 
 
export default class NewOrderList  extends NavigationMixin(LightningElement) {
    @track data = [];
       //排序
       defaultSortDirection = 'asc';
       sortDirection = 'asc';
       sortedBy;
 
 
       onHandleSort(event) {
        console.log('===>进入方法');
        const { fieldName: sortedBy, sortDirection } = event.detail;
        const cloneData = [...this.data];
        cloneData.sort(this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1));
        this.data = cloneData;
        this.sortDirection = sortDirection;
        this.sortedBy = sortedBy;
    }
 
    sortBy(field, reverse, primer) {
        const key = primer
            ? function (x) {
                  return primer(x[field]);
              }
            : function (x) {
                  return x[field];
              };
 
        return function (a, b) {
            a = key(a);
            b = key(b);
            return reverse * ((a > b) - (b > a));
        };
    }
    
 
    // @track orderList =[];
    // @wire(getOrderList)
    // result({error,data}){
    //     if(data){
    //        this.orderList = data;
    //        console.log("return is "+this.record);
    //        JSON.stringify("===>data",data);
    //     }
    //     if(error){
    //        this.error= error;
    //        console.log("retrun is "+this.error);
    //     }
    // }
    // showDetail(event){
    //     var orderdetailUrl = event.currentTarget.dataset.name;
    //     console.log('===>orderdetailUrl'+orderdetailUrl);
    //     this[NavigationMixin.Navigate]({
    //         type: 'standard__recordPage',
    //         attributes: {
    //             recordId: orderdetailUrl,
    //             objectApiName: 'Consumable_order__c',
    //             actionName: 'view'
    //         }
    //     });
    // }
    }