diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 1d5d86db88..790279babb 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -167,7 +167,7 @@ public class TestCaseController { } @PostMapping("/file/download") - public ResponseEntity downloadJmx(@RequestBody FileOperationRequest fileOperationRequest) { + public ResponseEntity download(@RequestBody FileOperationRequest fileOperationRequest) { byte[] bytes = fileService.loadFileAsBytes(fileOperationRequest.getId()); return ResponseEntity.ok() .contentType(MediaType.parseMediaType("application/octet-stream")) @@ -175,4 +175,13 @@ public class TestCaseController { .body(bytes); } + @GetMapping("/file/preview/{fileId}") + public ResponseEntity preview(@PathVariable String fileId) { + byte[] bytes = fileService.loadFileAsBytes(fileId); + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType("application/octet-stream")) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileId + "\"") + .body(bytes); + } + } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index cf6b065263..ee74568be0 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit cf6b06526324326a563d933e07118fac014a63b4 +Subproject commit ee74568be0beba46da19616f5832e83f9164c688 diff --git a/frontend/package.json b/frontend/package.json index c0ead7bf5d..1b15b96a2d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -35,7 +35,8 @@ "jspdf": "^2.1.1", "yan-progress": "^1.0.3", "nprogress": "^0.2.0", - "el-table-infinite-scroll": "^1.0.10" + "el-table-infinite-scroll": "^1.0.10", + "vue-pdf": "^4.2.0" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index dabae32940..9d9addf80b 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -252,6 +252,10 @@