From c1194414df9e35e8d15e59855d148ca193b1e3c9 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期四, 13 六月 2024 09:01:30 +0800
Subject: [PATCH] 限制文件上传条件
---
src/views/safetyReview/projectSupplement/components/supplemenrtDialog.vue | 24 +++++++++++++++++-------
src/views/safetyReview/projectManage/components/rateConclusion.vue | 14 ++++++++------
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/views/safetyReview/projectManage/components/rateConclusion.vue b/src/views/safetyReview/projectManage/components/rateConclusion.vue
index 2cbc955..0396e72 100644
--- a/src/views/safetyReview/projectManage/components/rateConclusion.vue
+++ b/src/views/safetyReview/projectManage/components/rateConclusion.vue
@@ -253,6 +253,7 @@
}
const handleRemove = async (file, uploadFiles) => {
+ if (file && file.status === 'success') {
ElMessageBox.confirm(
'确定删除该附件?',
'提示',
@@ -261,30 +262,31 @@
cancelButtonText: '取消',
type: 'warning',
})
- .then( async() => {
+ .then(async () => {
let accessoryFileId = "";
- if(file.id){
+ if (file.id) {
accessoryFileId = file.id
- }else {
+ } else {
accessoryFileId = file.response.data.id
}
const res = await delAccessoryFile(accessoryFileId)
- if(res.code == 200){
+ if (res.code == 200) {
ElMessage({
type: 'success',
message: '文件已删除'
})
await getProcessFiles()
- }else{
+ } else {
ElMessage({
type: 'warning',
message: res.message
})
}
})
- .catch(()=>{
+ .catch(() => {
getProcessFiles()
})
+ }
}
defineExpose({
diff --git a/src/views/safetyReview/projectSupplement/components/supplemenrtDialog.vue b/src/views/safetyReview/projectSupplement/components/supplemenrtDialog.vue
index be5a2f5..1ec4eb6 100644
--- a/src/views/safetyReview/projectSupplement/components/supplemenrtDialog.vue
+++ b/src/views/safetyReview/projectSupplement/components/supplemenrtDialog.vue
@@ -269,6 +269,14 @@
}
const picSize = async (rawFile) => {
+ console.log("111",rawFile.name.length)
+ if(rawFile.name.length >100){
+ ElMessage({
+ type: 'warning',
+ message: '文件名不能超过100字'
+ });
+ return false
+ }
if(rawFile.size / 1024 / 1024 > 15){
ElMessage({
type: 'warning',
@@ -278,6 +286,7 @@
}
};
const handleRemove = async (file, uploadFiles) => {
+ if (file && file.status === 'success') {
ElMessageBox.confirm(
'确定删除该附件?',
'提示',
@@ -286,29 +295,30 @@
cancelButtonText: '取消',
type: 'warning',
})
- .then( async() => {
+ .then(async () => {
let path = "";
- if(file.path){
+ if (file.path) {
path = file.path
- }else {
+ } else {
path = file.response.data.path
}
- const res = await delPic({path:path})
- if(res.code == 200){
+ const res = await delPic({path: path})
+ if (res.code == 200) {
ElMessage({
type: 'success',
message: '文件已删除'
})
state.form.files = state.fileList;
- }else{
+ } else {
ElMessage({
type: 'warning',
message: res.message
})
}
})
- .catch(()=>{
+ .catch(() => {
})
+ }
}
const handlePreview = (file) => {
let path = "";
--
Gitblit v1.9.2