|
|
|
@ -41,9 +41,11 @@ export class AllFileComponent {
|
|
|
|
|
if(element.key.indexOf(".") != -1){ |
|
|
|
|
let typeArr = element.key.split('.') |
|
|
|
|
element.type = typeArr[typeArr.length - 1] |
|
|
|
|
} |
|
|
|
|
element.newTime = new Date(element.lastModified).getTime() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
// console.log(666,e)
|
|
|
|
|
if( e.direction=='asc' ) { //从小到大排序
|
|
|
|
|
data.sort( function(a,b) { |
|
|
|
|
return a.newTime - b.newTime |
|
|
|
@ -108,21 +110,22 @@ export class AllFileComponent {
|
|
|
|
|
size: 0, |
|
|
|
|
isDir: false, |
|
|
|
|
type: "denggao" |
|
|
|
|
}, |
|
|
|
|
{ key: "装备车辆/灭火侦查机器人", |
|
|
|
|
lastModified: null, |
|
|
|
|
eTag: null, |
|
|
|
|
size: 0, |
|
|
|
|
isDir: false, |
|
|
|
|
type: "miehuo" |
|
|
|
|
}, |
|
|
|
|
{ key: "装备车辆/空气呼吸器", |
|
|
|
|
lastModified: null, |
|
|
|
|
eTag: null, |
|
|
|
|
size: 0, |
|
|
|
|
isDir: false, |
|
|
|
|
type: "kongqi" |
|
|
|
|
} |
|
|
|
|
// ,
|
|
|
|
|
// { key: "装备车辆/灭火侦查机器人",
|
|
|
|
|
// lastModified: null,
|
|
|
|
|
// eTag: null,
|
|
|
|
|
// size: 0,
|
|
|
|
|
// isDir: false,
|
|
|
|
|
// type: "miehuo"
|
|
|
|
|
// },
|
|
|
|
|
// { key: "装备车辆/空气呼吸器",
|
|
|
|
|
// lastModified: null,
|
|
|
|
|
// eTag: null,
|
|
|
|
|
// size: 0,
|
|
|
|
|
// isDir: false,
|
|
|
|
|
// type: "kongqi"
|
|
|
|
|
// }
|
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
if(this.selectedDataBank == "设备设施"){ |
|
|
|
@ -213,7 +216,7 @@ export class AllFileComponent {
|
|
|
|
|
prefix : this.searchData |
|
|
|
|
} |
|
|
|
|
}).subscribe(data=>{ |
|
|
|
|
console.log(data) |
|
|
|
|
// console.log(data)
|
|
|
|
|
}, |
|
|
|
|
err=>{ |
|
|
|
|
|
|
|
|
@ -226,18 +229,17 @@ export class AllFileComponent {
|
|
|
|
|
// console.log(item)
|
|
|
|
|
e.stopPropagation() |
|
|
|
|
|
|
|
|
|
if(item.type == "jpg" || item.type == "png" || item.type == "bmp"&& !item.isDir){ |
|
|
|
|
if(item.type == "jpg" || item.type == "png" || item.type == "bmp"|| item.type == "gif"&& !item.isDir){ |
|
|
|
|
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '1600px', |
|
|
|
|
height:'900px', |
|
|
|
|
|
|
|
|
|
data: {url:item.key,type:"img"} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}else if(item.type == "mp4" || item.type == "MP4" && !item.isDir){ |
|
|
|
|
|
|
|
|
|
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
|
width: '1600px', |
|
|
|
|
height:'900px', |
|
|
|
|
width: '1400px', |
|
|
|
|
height:'800px', |
|
|
|
|
data: {url:item.key,type:"video"} |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe( |
|
|
|
@ -633,61 +635,42 @@ export class AllFileComponent {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//删除文件
|
|
|
|
|
// deleteFiles(){
|
|
|
|
|
// if (this.selection.selected.length != 0) {
|
|
|
|
|
// let isDelete = confirm('您确定要删除吗')
|
|
|
|
|
// let arr = []
|
|
|
|
|
// if (isDelete) {
|
|
|
|
|
// this.selection.selected.forEach( async (element,index) => {
|
|
|
|
|
// let result = await new Promise((result,reject)=>{
|
|
|
|
|
// this.http.delete(`/api/Objects/drives/${element.key}`).subscribe(data=>{
|
|
|
|
|
// result(index)
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
// arr.push(result)
|
|
|
|
|
// if (arr.length == this.selection.selected.length) {
|
|
|
|
|
// this.getALLFileList(this.selectedDataBank)
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('删除文件成功','确定',config);}
|
|
|
|
|
// this.selection.clear()
|
|
|
|
|
// this.isDelete = false
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('请选择要删除的文件','确定',config);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// 删除文件
|
|
|
|
|
deleteFiles(){ |
|
|
|
|
if (this.selection.selected.length == 1) { |
|
|
|
|
let isDelete = confirm('您确定要删除吗') |
|
|
|
|
if (this.selection.selected.length != 0) { |
|
|
|
|
let isDelete = confirm('您确定要删除选中文件吗') |
|
|
|
|
let arr = [] |
|
|
|
|
if (isDelete) { |
|
|
|
|
let item = this.selection.selected[0] |
|
|
|
|
if(item.isDir){//如果是文件夹
|
|
|
|
|
this.selection.selected.forEach( async (element,index) => { |
|
|
|
|
|
|
|
|
|
let result = await new Promise((result,reject)=>{ |
|
|
|
|
if(element.isDir){ //如果是文件夹
|
|
|
|
|
let lastIndex = element.key.lastIndexOf("/") |
|
|
|
|
let prefix = element.key.substring(0,lastIndex) |
|
|
|
|
let paramsdata:any = { |
|
|
|
|
prefix : item.key, |
|
|
|
|
prefix : prefix, |
|
|
|
|
recursive : true |
|
|
|
|
} |
|
|
|
|
this.http.delete(`/api/Objects/drives`,{ |
|
|
|
|
params:paramsdata |
|
|
|
|
}).subscribe(data=>{ |
|
|
|
|
arr.push("删除成功了") |
|
|
|
|
if (arr.length == this.selection.selected.length) { |
|
|
|
|
this.getALLFileList(this.selectedDataBank) |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除文件夹成功','确定',config); |
|
|
|
|
this.snackBar.open('删除文件成功','确定',config); |
|
|
|
|
this.selection.clear() |
|
|
|
|
this.isDelete = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
this.http.delete(`/api/Objects/drives/${item.key}`).subscribe(data=>{ |
|
|
|
|
result(data) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.http.delete(`/api/Objects/drives/${element.key}`).subscribe(data=>{ |
|
|
|
|
arr.push("删除成功了") |
|
|
|
|
if (arr.length == this.selection.selected.length) { |
|
|
|
|
this.getALLFileList(this.selectedDataBank) |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
@ -695,26 +678,81 @@ export class AllFileComponent {
|
|
|
|
|
this.snackBar.open('删除文件成功','确定',config); |
|
|
|
|
this.selection.clear() |
|
|
|
|
this.isDelete = false |
|
|
|
|
} |
|
|
|
|
result(data) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
if (this.selection.selected.length == 0) { |
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请选择要删除的文件','确定',config); |
|
|
|
|
} |
|
|
|
|
if (this.selection.selected.length > 1) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('暂不支持批量删除','确定',config); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// deleteFiles(){
|
|
|
|
|
// if (this.selection.selected.length == 1) {
|
|
|
|
|
// let isDelete = confirm('您确定要删除吗')
|
|
|
|
|
// let arr = []
|
|
|
|
|
// if (isDelete) {
|
|
|
|
|
// let item = this.selection.selected[0]
|
|
|
|
|
// if(item.isDir){//如果是文件夹
|
|
|
|
|
// let paramsdata:any = {
|
|
|
|
|
// prefix : item.key,
|
|
|
|
|
// recursive : true
|
|
|
|
|
// }
|
|
|
|
|
// this.http.delete(`/api/Objects/drives`,{
|
|
|
|
|
// params:paramsdata
|
|
|
|
|
// }).subscribe(data=>{
|
|
|
|
|
// this.getALLFileList(this.selectedDataBank)
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('删除文件夹成功','确定',config);
|
|
|
|
|
// this.selection.clear()
|
|
|
|
|
// this.isDelete = false
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// this.http.delete(`/api/Objects/drives/${item.key}`).subscribe(data=>{
|
|
|
|
|
// this.getALLFileList(this.selectedDataBank)
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('删除文件成功','确定',config);
|
|
|
|
|
// this.selection.clear()
|
|
|
|
|
// this.isDelete = false
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (this.selection.selected.length == 0) {
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('请选择要删除的文件','确定',config);
|
|
|
|
|
// }
|
|
|
|
|
// if (this.selection.selected.length > 1) {
|
|
|
|
|
// const config = new MatSnackBarConfig();
|
|
|
|
|
// config.verticalPosition = 'top';
|
|
|
|
|
// config.duration = 3000
|
|
|
|
|
// this.snackBar.open('暂不支持批量删除','确定',config);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//下载文件
|
|
|
|
|
//下载↓
|
|
|
|
|
selectDownloadFile:any; //选择下载的文件
|
|
|
|
@ -771,7 +809,9 @@ export class ViewDetails {
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.Url = "/api/Objects/drives/" + this.data.url |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeDialog(){ |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|