|
|
|
@ -29,6 +29,30 @@ export class AllFileComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
selection = new SelectionModel(true, []); |
|
|
|
|
@ViewChild(MatSort) sort: MatSort; |
|
|
|
|
|
|
|
|
|
oldDataSource:any; //原始表格数据
|
|
|
|
|
//表头排序
|
|
|
|
|
sortData (e) { |
|
|
|
|
let data = this.oldDataSource.concat(); |
|
|
|
|
data.forEach(element => { |
|
|
|
|
let typeArr = element.key.split('.') |
|
|
|
|
element.type = typeArr[typeArr.length - 1] |
|
|
|
|
element.newTime = new Date(element.lastModified).getTime() |
|
|
|
|
}); |
|
|
|
|
if( e.direction=='asc' ) { //从小到大排序
|
|
|
|
|
data.sort( function(a,b) { |
|
|
|
|
return a.newTime - b.newTime |
|
|
|
|
} ) |
|
|
|
|
this.dataSource = new MatTableDataSource(data); |
|
|
|
|
} else if ( e.direction=='desc' ) {//从大到小排序
|
|
|
|
|
data.sort( function(a,b) { |
|
|
|
|
return b.newTime - a.newTime |
|
|
|
|
} ) |
|
|
|
|
this.dataSource = new MatTableDataSource(data); |
|
|
|
|
} else { //原始数据
|
|
|
|
|
this.dataSource = new MatTableDataSource(this.oldDataSource); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
@ -55,15 +79,13 @@ export class AllFileComponent implements OnInit {
|
|
|
|
|
this.http.get(`/api/Objects/drives`,{ |
|
|
|
|
params:paramsdata |
|
|
|
|
}).subscribe((data:any) => { |
|
|
|
|
// console.log(data)
|
|
|
|
|
this.oldDataSource = data.contents //保存表格数据
|
|
|
|
|
data.contents.forEach((item)=>{ |
|
|
|
|
let typeArr = item.key.split('.') |
|
|
|
|
item.type = typeArr[typeArr.length - 1] |
|
|
|
|
}) |
|
|
|
|
this.dataSource = new MatTableDataSource(data.contents); |
|
|
|
|
|
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
|
|
|
|
|
|
this.fileNum = data.contents.length |
|
|
|
|
if(data.contents.length == 0){ |
|
|
|
|
this.isNoFileTitle = true |
|
|
|
|