diff --git a/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java b/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java
index 45d3651a9c..8f2a4fdb5d 100644
--- a/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java
+++ b/backend/src/main/java/io/metersphere/metadata/controller/FileMetadataController.java
@@ -108,4 +108,8 @@ public class FileMetadataController {
return fileMetadataService.myFiles(createUser, projectId);
}
+ @GetMapping(value = "/exist/{fileId}")
+ public boolean exist(@PathVariable("fileId") String fileId) {
+ return fileMetadataService.exist(fileId);
+ }
}
diff --git a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java
index e54978938f..d08f3f8421 100644
--- a/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java
+++ b/backend/src/main/java/io/metersphere/metadata/service/FileMetadataService.java
@@ -426,4 +426,8 @@ public class FileMetadataService {
fileMetadata.setUpdateUser(SessionUtils.getUserId());
}
}
+
+ public boolean exist(String fileId) {
+ return fileMetadataMapper.selectByPrimaryKey(fileId) != null;
+ }
}
diff --git a/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue
index 31e794affe..c397a612bb 100644
--- a/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue
+++ b/frontend/src/business/components/api/automation/scenario/variable/CsvFileUpload.vue
@@ -32,11 +32,12 @@
-
+
{{ file.file && file.file.name ? file.file.name : file.name }}
+ {{ file.isExist ? '文件已经被删除' : '' }}
@@ -56,7 +57,6 @@
-
@@ -71,6 +71,7 @@ export default {
data() {
return {
disabled: false,
+ loading: false,
};
},
components: {
@@ -83,7 +84,19 @@ export default {
return {}
}
},
+ mounted() {
+ this.exist();
+ },
methods: {
+ exist() {
+ this.loading = true;
+ this.parameter.files.forEach(file => {
+ this.$get('/file/metadata/exist/' + file.fileId, response => {
+ file.isExist = !response.data;
+ this.loading = false;
+ });
+ });
+ },
setModuleId(moduleId) {
let files = [];
if (this.file && this.file.file) {
@@ -203,6 +216,7 @@ export default {
if (!this.parameter.files) {
this.parameter.files = [];
}
+ this.exist();
}
}
diff --git a/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue b/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue
index 982140707a..223cf04abc 100644
--- a/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue
+++ b/frontend/src/business/components/api/definition/components/body/ApiBodyFileUpload.vue
@@ -27,11 +27,12 @@
{{ file.file && file.file.name ? file.file.name : file.name }}
-
-
-
-
-
+
+
+
+ {{ file.isExist ? '文件已经被删除' : '' }}
+
+
@@ -73,6 +74,13 @@ export default {
}
},
methods: {
+ exist() {
+ this.parameter.files.forEach(file => {
+ this.$get('/file/metadata/exist/' + file.fileId, response => {
+ file.isExist = !response.data;
+ });
+ });
+ },
setModuleId(moduleId) {
let files = [];
if (this.file && this.file.file) {
@@ -125,6 +133,7 @@ export default {
if (!this.parameter.files) {
this.parameter.files = [];
}
+ this.exist();
}
}
diff --git a/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue b/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue
index 3bbd49de64..f0dab91487 100644
--- a/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue
+++ b/frontend/src/business/components/project/menu/file/edit/EditFileMetadata.vue
@@ -200,7 +200,7 @@ export default {
});
},
getType(type) {
- return type ? type.substr(0, 1).toUpperCase() : "";
+ return type || "";
},
isImage(type) {
return (type && this.images.indexOf(type.toLowerCase()) !== -1);
@@ -332,7 +332,7 @@ export default {
.icon-title {
color: #fff;
text-align: center;
- font-size: 22px;
+ font-size: 16px;
}
diff --git a/frontend/src/business/components/project/menu/file/list/FileThumbnail.vue b/frontend/src/business/components/project/menu/file/list/FileThumbnail.vue
index 0d111c4c7b..787cefd7c2 100644
--- a/frontend/src/business/components/project/menu/file/list/FileThumbnail.vue
+++ b/frontend/src/business/components/project/menu/file/list/FileThumbnail.vue
@@ -44,7 +44,7 @@ export default {
currentPage: 1,
pageSize: 10,
total: 0,
- images: ["bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp", "avif", "apng","jpeg"]
+ images: ["bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp", "avif", "apng", "jpeg"]
};
},
props: {
@@ -83,7 +83,7 @@ export default {
this.$refs.editMetadata.open(row, this.pageSize, this.currentPage, this.total);
},
getType(type) {
- return type ? type.substr(0, 1).toUpperCase() : "X";
+ return type || "";
},
change() {
this.$emit("change", this.pageSize, this.currentPage);
@@ -114,7 +114,7 @@ export default {
.ms-file {
text-align: center;
- padding-top: 90px
+ padding-top: 85px
}
.ms-file-name-width {
@@ -132,7 +132,7 @@ export default {
.icon-title {
color: #fff;
text-align: center;
- font-size: 22px;
+ font-size: 16px;
}