From a166a88ec749109e72b15646d305f45fd1ef0f88 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Tue, 24 May 2022 15:27:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=89=AF=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edit-file-category.component.html | 9 ++--- .../edit-file-category.component.ts | 5 ++- .../edit-update-category.component.html | 40 +++++++++---------- .../edit-update-category.component.ts | 34 ++++++++++------ 4 files changed, 47 insertions(+), 41 deletions(-) diff --git a/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html b/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html index 85f86ac..11ca6a3 100644 --- a/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html +++ b/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.html @@ -31,12 +31,11 @@ - +
- +
@@ -44,8 +43,8 @@
- - + +
diff --git a/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts b/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts index 9dd6a98..1d6cde1 100644 --- a/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts +++ b/src/app/pages/license/file-category/edit-file-category/edit-file-category.component.ts @@ -57,6 +57,7 @@ export class EditFileCategoryComponent implements OnInit { isLoadingSave: boolean = false uploadIndex: string filechange(e) { + this.isLoadingSave = true let oilStationId = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id let file = e.target.files[0] || null //获取上传的文件 this.openFileSelect(file, `stationPhotos/${oilStationId}/`) @@ -84,7 +85,7 @@ export class EditFileCategoryComponent implements OnInit { let filePath: string = ObjectsSimpleService.baseUrl + dataObj.objectName; this.imageUrl = filePath this.data2.imageUrl = filePath - console.log('上传成功', filePath) + this.isLoadingSave = false resolve('success') }); }) @@ -100,7 +101,7 @@ export class EditFileCategoryComponent implements OnInit { let filePath = dataObj.filePath this.imageUrl = filePath this.data2.imageUrl = filePath - console.log('上传成功', filePath) + this.isLoadingSave = false }); } diff --git a/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.html b/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.html index e2be913..df178bf 100644 --- a/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.html +++ b/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.html @@ -47,38 +47,36 @@

附件上传(图片格式、pdf格式、word格式)

-
+
- - + + - - + +
-
- - +
+ +
-
- - - +
+ + + - - + +
-
- - +
+ +
- - + +
diff --git a/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.ts b/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.ts index 2dcaf4a..d9b3977 100644 --- a/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.ts +++ b/src/app/pages/license/update-category/edit-update-category/edit-update-category.component.ts @@ -119,25 +119,27 @@ export class EditUpdateCategoryComponent implements OnInit { //查看文件 lookFile(item) { - if (!item.imageUrl) { + if (!item) { return } - if (this.getFileType(item.imageUrl) == 'word') { - let arr = item.imageUrl.split('.') + if (this.getFileType(item) == 'word') { + let arr = item.split('.') arr[arr.length - 1] = 'pdf' window.open(arr.join('.')) - } else if (this.getFileType(item.imageUrl) == 'pdf') { - window.open(item.imageUrl) + } else if (this.getFileType(item) == 'pdf') { + window.open(item) } else { this.message.create('warning', '暂不支持查看!'); } } - + uploadType: boolean; //是否是上传副本 isLoadingSave: boolean = false uploadIndex: string - filechange(e) { + filechange(e, type: boolean) { + this.uploadType = type + this.isLoadingSave = true let oilStationId = JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id let file = e.target.files[0] || null //获取上传的文件 this.openFileSelect(file, `stationPhotos/${oilStationId}/`) @@ -163,9 +165,12 @@ export class EditUpdateCategoryComponent implements OnInit { this.objectsSrv.postFile(this.postFilePath, file).subscribe(data => { let dataObj = data as any; let filePath: string = ObjectsSimpleService.baseUrl + dataObj.objectName; - this.imageUrl = filePath - this.data2.imageUrl = filePath - console.log('上传成功', filePath) + if (this.uploadType){ + this.data2.imageUrl = filePath + } else { + this.data2.attachment = filePath + } + this.isLoadingSave = false resolve('success') }); }) @@ -179,9 +184,12 @@ export class EditUpdateCategoryComponent implements OnInit { this.objectsSrv.postFile_MultipartUpload(this.postFilePath, file).then((value) => { let dataObj = value as any; let filePath = dataObj.filePath - this.imageUrl = filePath - this.data2.imageUrl = filePath - console.log('上传成功', filePath) + if (this.uploadType){ + this.data2.imageUrl = filePath + } else { + this.data2.attachment = filePath + } + this.isLoadingSave = false }); }