陈鹏飞 5 years ago
parent
commit
7e1fc79423
  1. 4
      src/app/navigation/navigation.component.html
  2. 1
      src/app/navigation/navigation.component.ts
  3. 48
      src/app/ui/all-file/all-file.component.ts
  4. 3
      src/app/ui/all-file/folderdalog.html

4
src/app/navigation/navigation.component.html

@ -2,7 +2,7 @@
<mat-sidenav-container class="example-container" autosize [class.myapp-dark-theme]="darktheme">
<mat-sidenav #drawer class="example-sidenav" mode="side" opened="true" color="primary" style="overflow-x: hidden;">
<div class="biglogobox">
<img src="../../assets/images/logo.png" alt="">
<img src="../../assets/images/logo.png" alt="logo">
</div>
<div class="navbox">
<div class="openSystem" style="border-bottom: 1px solid gray;">
@ -31,7 +31,7 @@
</ul> -->
<mat-accordion multi="true">
<mat-expansion-panel>
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
支队级
</mat-expansion-panel-header>

1
src/app/navigation/navigation.component.ts

@ -65,6 +65,7 @@ export class NavigationComponent implements OnInit {
// }
// })
// this.getAllDataBank()
this.selectedDataBank = "支队级-主官"
}

48
src/app/ui/all-file/all-file.component.ts

@ -64,7 +64,8 @@ export class AllFileComponent {
ngOnInit(): void {
this.dataSource.sort = this.sort;
this.getAllDataBank()
// this.getAllDataBank()
this.getALLFileList("支队级-主官")
}
//获得所有资料库,默认显示第一个资料库的文件
@ -374,8 +375,6 @@ export class AllFileComponent {
fileArr:any
//上传文件夹
async selectFiles (e) {
// console.log(e)
this.fileArr = e.target.files || null //上传的文件
this.uploadisLoading2 = true
@ -462,26 +461,26 @@ export class AllFileComponent {
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
let _result = result
for (let i = 0;i < allSlice;i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
let formData = new FormData()
formData.append("file",file.slice(start, end))
//同步写法实现异步调用
let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/drives/${this.objectName2}?uploadId=${this.uploadId2}&partNumber=${i+1}`,formData).subscribe((data:any)=>{
let msg = {
"partNumber":data.partNumber || null,
"eTag": data.eTag || null}
resolve(msg) // 调用 promise 内置方法处理成功
})
});
this.PartNumberETag2.push(result)
if (this.PartNumberETag2.length === allSlice) {
this.endUploading2(e,_result,reject,filesnum,selectedDataBank2)}
let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
let formData = new FormData()
formData.append("file",file.slice(start, end))
//同步写法实现异步调用
let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/drives/${this.objectName2}?uploadId=${this.uploadId2}&partNumber=${i+1}`,formData).subscribe((data:any)=>{
let msg = {
"partNumber":data.partNumber || null,
"eTag": data.eTag || null}
resolve(msg) // 调用 promise 内置方法处理成功
})
});
this.PartNumberETag2.push(result)
if (this.PartNumberETag2.length === allSlice) {
this.endUploading2(e,_result,reject,filesnum,selectedDataBank2)
}
}//for循环
}
//完成分块上传
@ -493,10 +492,9 @@ export class AllFileComponent {
this.filesTag2.push("data")
this.zone.run(() => {
  setTimeout(() => this.uploadProgress2 = this.filesTag2.length + "/" + filesnum, 0);
  setTimeout(() => this.uploadProgress2 = this.filesTag2.length + "/" + filesnum, 0);
});
result("成功了")
this.child.endUpload(e) //子组件 当前文件上传成功
@ -816,7 +814,7 @@ export class AllFileComponent {
config.duration = 3000
this.snackBar.open('文件夹不支持下载','确定',config)
}else{
this.http.get('/api/ObjectMetadata/drives/allFiles/' + this.selectDownloadFile.key).subscribe(data=>{
this.http.get('/api/ObjectMetadata/drives/' + this.selectDownloadFile.key).subscribe(data=>{
console.log(123,data)
this.download = data
this.downloadFile.download(this.download)

3
src/app/ui/all-file/folderdalog.html

@ -1,9 +1,9 @@
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<mat-form-field>
<input matInput id="name" name="name" type='text'
required
style="font-size: 12px;"
onfocus="this.select()"
[(ngModel)]="newFolderName" placeholder="创建文件夹">
</mat-form-field>
@ -11,5 +11,4 @@
<button type="submit" class="savebtn" mat-raised-button color="primary" [disabled]='form.invalid'>确定</button>
<button type="button" mat-button (click)="onNoClick()" mat-raised-button>取消</button>
</div>
</form>
Loading…
Cancel
Save