|
|
@ -8,6 +8,7 @@ import { IsLoginService } from '../../is-login.service' |
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
import {UploadFilesComponent} from '../upload-files/upload-files.component' |
|
|
|
import {UploadFilesComponent} from '../upload-files/upload-files.component' |
|
|
|
import { ComponentServiceService } from '../../component-service.service' |
|
|
|
import { ComponentServiceService } from '../../component-service.service' |
|
|
|
|
|
|
|
import { element } from 'protractor'; |
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-all-file', |
|
|
|
selector: 'app-all-file', |
|
|
|
templateUrl: './all-file.component.html', |
|
|
|
templateUrl: './all-file.component.html', |
|
|
@ -705,12 +706,30 @@ export class AllFileComponent { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isTrueDelete:any = ['基础知识','装备','技战术','消防设施','资料库']; //匹配内置一级目录 是否被选择删除
|
|
|
|
// 删除文件
|
|
|
|
// 删除文件
|
|
|
|
deleteFiles(){ |
|
|
|
deleteFiles(){ |
|
|
|
if (this.selection.selected.length != 0) { |
|
|
|
if (this.selection.selected.length != 0) { |
|
|
|
let isDelete = confirm('您确定要删除选中文件吗') |
|
|
|
let isDelete = confirm('您确定要删除选中文件吗') |
|
|
|
let arr = [] |
|
|
|
let arr = [] |
|
|
|
if (isDelete) { |
|
|
|
if (isDelete) { |
|
|
|
|
|
|
|
let notDelete = [] //所有要删除文件 的 一级目录
|
|
|
|
|
|
|
|
let arrList = [] //匹配到 禁止删除的 目录
|
|
|
|
|
|
|
|
this.selection.selected.forEach((element)=>{ |
|
|
|
|
|
|
|
let data = element.key.split("/"); |
|
|
|
|
|
|
|
notDelete.push(data[2]) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.isTrueDelete.forEach(element => { |
|
|
|
|
|
|
|
notDelete.forEach(elements=>{ |
|
|
|
|
|
|
|
if (element==elements) { arrList.push('true') } |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (arrList.length) { |
|
|
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
|
|
|
config.duration = 3000 |
|
|
|
|
|
|
|
this.snackBar.open('内置文件夹不允许删除','确定',config); |
|
|
|
|
|
|
|
} else { |
|
|
|
this.selection.selected.forEach( async (element,index) => { |
|
|
|
this.selection.selected.forEach( async (element,index) => { |
|
|
|
|
|
|
|
|
|
|
|
let result = await new Promise((result,reject)=>{ |
|
|
|
let result = await new Promise((result,reject)=>{ |
|
|
@ -758,6 +777,8 @@ export class AllFileComponent { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} // if arrList
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|