From 34267bc00787c34d0ff9385f68fe045711305745 Mon Sep 17 00:00:00 2001
From: wangxiaoshuang <825034831@qq.com>
Date: Mon, 11 Nov 2024 13:24:28 +0800
Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=B5=8F=E8=A7=88=E7=BB=84?=
=?UTF-8?q?=E4=BB=B6=E7=BB=9F=E4=B8=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/reviewers/components/Agreements.vue | 70 ++++++++++++++-----
.../components/file/agreement.vue | 26 ++++++-
2 files changed, 77 insertions(+), 19 deletions(-)
diff --git a/src/views/reviewers/components/Agreements.vue b/src/views/reviewers/components/Agreements.vue
index 34501ae9..9a206336 100644
--- a/src/views/reviewers/components/Agreements.vue
+++ b/src/views/reviewers/components/Agreements.vue
@@ -257,6 +257,7 @@
:on-remove="handleRemoveFile2"
:show-file-list="true"
:limit="1"
+ accept=".pdf"
:file-list="fileList"
>
{{ $t('common:button:upload') }}
+ {{ $t('system:tip:file:pdf') }}
@@ -368,6 +370,7 @@ export default {
],
},
fileList: [],
+ accept: '.pdf',
}
},
watch: {
@@ -414,41 +417,66 @@ export default {
this.form.FilePath = null
this.fileList = []
},
- beforeUpload() {
+ beforeUpload(row) {
if (this.fileList.length > 0) {
this.$alert('最多只能传一个附件')
return
}
+ if (!this.checkFileSuffix(row.name)) {
+ this.$message.warning(`Must be in .pdf format`)
+ return false
+ }
},
handlePreview3(row) {
+ return this.$preview({
+ path: row.FilePath,
+ type: 'pdf',
+ title: row.FileName,
+ })
if (row.FilePath) {
window.open(this.OSSclientConfig.basePath + row.FilePath, '_blank')
}
},
handlePreview2(row, r2) {
+ return this.$preview({
+ path: row.fullPath,
+ type: 'pdf',
+ title: row.FileName,
+ })
if (row.fullPath) {
window.open(this.OSSclientConfig.basePath + row.fullPath, '_blank')
}
},
- async handleUploadFile(param) {
- this.btnLoading = true
- var fileName = param.file.name
- let file = await this.fileToBlob(param.file)
- let res = await this.OSSclient.put(
- `/SystemData/reviewer/${
- this.form.FileType === 0 ? '既往阅片情况声明' : '入项资格确认书'
- }/${this.doctorId}/${fileName}`,
- file
+ checkFileSuffix(fileName) {
+ var index = fileName.lastIndexOf('.')
+ var suffix = fileName.substring(index + 1, fileName.length)
+ return (
+ this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === 1
)
- this.form.FileName = param.file.name
- this.form.FilePath = this.$getObjectName(res.url)
- this.fileList[0] = {
- name: this.$getObjectName(res.url),
- path: this.$getObjectName(res.url),
- fullPath: this.$getObjectName(res.url),
- url: res.url,
+ },
+ async handleUploadFile(param) {
+ try {
+ this.btnLoading = true
+ var fileName = param.file.name
+ let file = await this.fileToBlob(param.file)
+ let res = await this.OSSclient.put(
+ `/SystemData/reviewer/${
+ this.form.FileType === 0 ? '既往阅片情况声明' : '入项资格确认书'
+ }/${this.doctorId}/${fileName}`,
+ file
+ )
+ this.form.FileName = param.file.name
+ this.form.FilePath = this.$getObjectName(res.url)
+ this.fileList[0] = {
+ name: this.$getObjectName(res.url),
+ path: this.$getObjectName(res.url),
+ fullPath: this.$getObjectName(res.url),
+ url: res.url,
+ }
+ this.btnLoading = false
+ } catch (err) {
+ console.log(err)
}
- this.btnLoading = false
},
handleCancle() {
this.model_cfg.visible = false
@@ -499,6 +527,12 @@ export default {
})
},
handlePreview(row) {
+ console.log(row)
+ return this.$preview({
+ path: row.FullPath,
+ type: 'pdf',
+ title: row.FileName,
+ })
if (row.FullPath) {
window.open(this.OSSclientConfig.basePath + row.FullPath, '_blank')
}
diff --git a/src/views/reviewers/curriculumVitae/components/file/agreement.vue b/src/views/reviewers/curriculumVitae/components/file/agreement.vue
index 3e0fad57..bd97602d 100644
--- a/src/views/reviewers/curriculumVitae/components/file/agreement.vue
+++ b/src/views/reviewers/curriculumVitae/components/file/agreement.vue
@@ -107,6 +107,7 @@
:on-remove="handleRemoveFile2"
:show-file-list="true"
:limit="1"
+ :accept="accept"
:file-list="fileList"
>
{{ $t('common:button:upload') }}
+ {{ $t('system:tip:file:pdf') }}
@@ -226,6 +228,7 @@ export default {
],
},
fileList: [],
+ accept: '.pdf',
}
},
watch: {
@@ -285,19 +288,40 @@ export default {
this.form.FilePath = null
this.fileList = []
},
- beforeUpload() {
+ beforeUpload(row) {
if (this.fileList.length > 0) {
// this.$alert('最多只能传一个附件')
this.$alert(this.$t('upload:rule:maxFile1'))
return
}
+ if (!this.checkFileSuffix(row.name)) {
+ this.$message.warning(`Must be in .pdf format`)
+ return false
+ }
+ },
+ checkFileSuffix(fileName) {
+ var index = fileName.lastIndexOf('.')
+ var suffix = fileName.substring(index + 1, fileName.length)
+ return (
+ this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === 1
+ )
},
handlePreview3(row) {
+ return this.$preview({
+ path: row.FilePath,
+ type: 'pdf',
+ title: row.FileName,
+ })
if (row.FilePath) {
window.open(this.OSSclientConfig.basePath + row.FilePath, '_blank')
}
},
handlePreview2(row, r2) {
+ return this.$preview({
+ path: row.FullPath,
+ type: 'pdf',
+ title: row.FileName,
+ })
if (row.fullPath) {
window.open(this.OSSclientConfig.basePath + row.fullPath, '_blank')
}