|
|
|
@ -4,11 +4,11 @@ import {MatSort} from '@angular/material/sort';
|
|
|
|
|
import {MatTableDataSource} from '@angular/material/table'; |
|
|
|
|
import { HttpClient,HttpHeaders } from '@angular/common/http'; |
|
|
|
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
|
|
|
import { IsLoginService } from '../../is-login.service' |
|
|
|
|
import { IsLoginService } from '../../is-login.service'; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
|
|
|
|
import {UploadFilesComponent} from '../upload-files/upload-files.component' |
|
|
|
|
import { ComponentServiceService } from '../../component-service.service' |
|
|
|
|
|
|
|
|
|
import {UploadFilesComponent} from '../upload-files/upload-files.component'; |
|
|
|
|
import { ComponentServiceService } from '../../component-service.service'; |
|
|
|
|
import { DomSanitizer } from "@angular/platform-browser"; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-all-file', |
|
|
|
|
templateUrl: './all-file.component.html', |
|
|
|
@ -18,7 +18,7 @@ export class AllFileComponent {
|
|
|
|
|
displayedColumns: string[] = ['select', 'name', 'weight', 'time']; |
|
|
|
|
dataSource:any = new MatTableDataSource; |
|
|
|
|
|
|
|
|
|
constructor(public emitService: ComponentServiceService,private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService,public dialog: MatDialog,private zone: NgZone) { } |
|
|
|
|
constructor(private sanitizer: DomSanitizer,public emitService: ComponentServiceService,private http: HttpClient,public snackBar: MatSnackBar,public downloadFile:IsLoginService,public dialog: MatDialog,private zone: NgZone) { } |
|
|
|
|
isCancel:boolean = false //搜索框的X是否显示
|
|
|
|
|
searchData:any = "搜索您的文件" //搜索框内容
|
|
|
|
|
isClickFile:boolean = false //是否点击过文件
|
|
|
|
@ -29,7 +29,6 @@ export class AllFileComponent {
|
|
|
|
|
|
|
|
|
|
isAdmin:boolean = false //是否是管理员
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
selectedDataBank:string = '' //当前需要显示的资料库
|
|
|
|
|
fileNum:any = 0 //当前资料库文件数量
|
|
|
|
|
|
|
|
|
@ -65,7 +64,11 @@ export class AllFileComponent {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
roleType:any |
|
|
|
|
aHrefUnsafe:any //战术授课a标签 去除unsafe标志
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.roleType = sessionStorage.getItem('roleType') |
|
|
|
|
this.dataSource.sort = this.sort; |
|
|
|
|
this.getALLFileList("支队级-主官") |
|
|
|
|
|
|
|
|
@ -79,6 +82,18 @@ export class AllFileComponent {
|
|
|
|
|
this.isAdmin = true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
aHrefUnsafeLearnFun(){ |
|
|
|
|
this.roleType = sessionStorage.getItem('roleType') |
|
|
|
|
let username = sessionStorage.getItem('username') |
|
|
|
|
let expires = sessionStorage.getItem('expires') |
|
|
|
|
let realName = sessionStorage.getItem('realName') |
|
|
|
|
let roleType = sessionStorage.getItem('roleType') |
|
|
|
|
let token = sessionStorage.getItem('token') |
|
|
|
|
let refreshToken = sessionStorage.getItem('refreshToken') |
|
|
|
|
let aHref = `ax://startup?username=${username}&token=${token}&refreshToken=${refreshToken}&expires=${expires}&realname=${realName}&roleType=${roleType}` |
|
|
|
|
this.aHrefUnsafe = this.sanitizer.bypassSecurityTrustUrl(aHref); |
|
|
|
|
return this.aHrefUnsafe |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得当前资料库的文件列表
|
|
|
|
|
getALLFileList(name){ |
|
|
|
@ -688,6 +703,7 @@ export class AllFileComponent {
|
|
|
|
|
let arrList = [] //匹配到 禁止删除的 目录
|
|
|
|
|
this.selection.selected.forEach((element)=>{ |
|
|
|
|
let data = element.key.split("/"); |
|
|
|
|
|
|
|
|
|
this.isTrueDelete.forEach(elements => { |
|
|
|
|
if (elements==data[data.length-2] && data.length-2==2) { |
|
|
|
|
arrList.push('true') |
|
|
|
@ -704,8 +720,6 @@ export class AllFileComponent {
|
|
|
|
|
|
|
|
|
|
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 : element.key, |
|
|
|
|
recursive : true |
|
|
|
@ -724,7 +738,6 @@ export class AllFileComponent {
|
|
|
|
|
this.isDelete = false |
|
|
|
|
} |
|
|
|
|
result(data) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
this.http.delete(`/api/Objects/drives/${element.key}`).subscribe(data=>{ |
|
|
|
|