From 1e20eeb0d153b036fc0ed89e6590f8522308807e Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Fri, 21 Nov 2025 18:01:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=BF=9B=E5=BA=A6=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/fileupload/FileUpload.java | 2 +- .../.env.development | 6 +- .../package-lock.json | 40 +++--- .../regulatory-management-util/package.json | 8 +- .../src/types/upload_file.ts | 28 ++++ .../src/utils/config.ts | 18 +++ .../src/utils/utils.ts | 50 ++++++- .../src/views/console/data/NewRegulatory.vue | 123 +++++++++++++++--- 开发日志.md | 31 +++++ 9 files changed, 259 insertions(+), 47 deletions(-) create mode 100644 code/web/regulatory-management-util/src/types/upload_file.ts create mode 100644 code/web/regulatory-management-util/src/utils/config.ts diff --git a/code/backend/RegulatoryManagementBackend/src/main/java/com/cpic/xim/web/controllers/fileupload/FileUpload.java b/code/backend/RegulatoryManagementBackend/src/main/java/com/cpic/xim/web/controllers/fileupload/FileUpload.java index 2733f35..4ade9d0 100644 --- a/code/backend/RegulatoryManagementBackend/src/main/java/com/cpic/xim/web/controllers/fileupload/FileUpload.java +++ b/code/backend/RegulatoryManagementBackend/src/main/java/com/cpic/xim/web/controllers/fileupload/FileUpload.java @@ -47,7 +47,7 @@ public class FileUpload @RequestMapping( path = "/file-upload.do" ) @ResponseBody public UploadFileResponse saveUploadFile( - @RequestParam( "file-name" ) String fileName, + @RequestParam( "fileName" ) String fileName, @RequestParam( "files" ) MultipartFile file, HttpServletRequest request ) diff --git a/code/web/regulatory-management-util/.env.development b/code/web/regulatory-management-util/.env.development index 840c3ab..2f0dbd2 100644 --- a/code/web/regulatory-management-util/.env.development +++ b/code/web/regulatory-management-util/.env.development @@ -13,4 +13,8 @@ VITE_APP_MOCK_DATA=true VITE_APP_CORS_ORIGIN=http://localhost:3000 VITE_APP_TIMEOUT=5000 VITE_APP_RETRY_ATTEMPTS=3 -VITE_APP_CACHE_ENABLED=true \ No newline at end of file +VITE_APP_CACHE_ENABLED=true + +#上传文件 +VITE_APP_URL_UPLOAD_FILE=http://localhost:8080/RegulatoryManagementBackend/file/file-upload.do +VITE_APP_URL_MOVE_FILE=http://localhost:8080/RegulatoryManagementBackend/file/move-file.do diff --git a/code/web/regulatory-management-util/package-lock.json b/code/web/regulatory-management-util/package-lock.json index c3112d8..2cac681 100644 --- a/code/web/regulatory-management-util/package-lock.json +++ b/code/web/regulatory-management-util/package-lock.json @@ -14,11 +14,11 @@ }, "devDependencies": { "@element-plus/icons-vue": "^2.3.2", - "@stylistic/eslint-plugin": "^5.6.0", + "@stylistic/eslint-plugin": "^5.6.1", "@types/node": "^24.10.1", "@typescript-eslint/eslint-plugin": "^8.47.0", "@typescript-eslint/parser": "^8.47.0", - "@vitejs/plugin-vue": "^6.0.1", + "@vitejs/plugin-vue": "^6.0.2", "@vue-office/docx": "^1.6.3", "@vue-office/excel": "^1.7.14", "@vue-office/pdf": "^2.0.10", @@ -28,9 +28,9 @@ "eslint": "^9.39.1", "eslint-plugin-vue": "^10.5.1", "path": "^0.12.7", - "sass": "^1.94.1", + "sass": "^1.94.2", "typescript": "~5.9.3", - "vite": "^7.2.2", + "vite": "^7.2.4", "vue-demi": "^0.14.10", "vue-eslint-parser": "^10.2.0", "vue-pdf-embed": "^2.1.3", @@ -1391,9 +1391,9 @@ } }, "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-beta.29", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.29.tgz", - "integrity": "sha512-NIJgOsMjbxAXvoGq/X0gD7VPMQ8j9g0BiDaNjVNVjvl+iKXxL3Jre0v31RmBYeLEmkbj2s02v8vFTbUXi5XS2Q==", + "version": "1.0.0-beta.50", + "resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.50.tgz", + "integrity": "sha512-5e76wQiQVeL1ICOZVUg4LSOVYg9jyhGCin+icYozhsUzM+fHE7kddi1bdiE0jwVqTfkjba3jUFbEkoC9WkdvyA==", "dev": true, "license": "MIT" }, @@ -1678,9 +1678,9 @@ ] }, "node_modules/@stylistic/eslint-plugin": { - "version": "5.6.0", - "resolved": "https://registry.npmmirror.com/@stylistic/eslint-plugin/-/eslint-plugin-5.6.0.tgz", - "integrity": "sha512-owEc4B8ME+O/xyZOkLVyLqPMsUgJXIM4XzCm5Vt3WvRXpyoOfYxgA+JkEiFqXPCI8+Nc2BzAT+KGAK7QleGs8Q==", + "version": "5.6.1", + "resolved": "https://registry.npmmirror.com/@stylistic/eslint-plugin/-/eslint-plugin-5.6.1.tgz", + "integrity": "sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==", "dev": true, "license": "MIT", "dependencies": { @@ -1998,13 +1998,13 @@ } }, "node_modules/@vitejs/plugin-vue": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.1.tgz", - "integrity": "sha512-+MaE752hU0wfPFJEUAIxqw18+20euHHdxVtMvbFcOEpjEyfqXH/5DCoTHiVJ0J29EhTJdoTkjEv5YBKU9dnoTw==", + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/@vitejs/plugin-vue/-/plugin-vue-6.0.2.tgz", + "integrity": "sha512-iHmwV3QcVGGvSC1BG5bZ4z6iwa1SOpAPWmnjOErd4Ske+lZua5K9TtAVdx0gMBClJ28DViCbSmZitjWZsWO3LA==", "dev": true, "license": "MIT", "dependencies": { - "@rolldown/pluginutils": "1.0.0-beta.29" + "@rolldown/pluginutils": "1.0.0-beta.50" }, "engines": { "node": "^20.19.0 || >=22.12.0" @@ -4069,9 +4069,9 @@ } }, "node_modules/sass": { - "version": "1.94.1", - "resolved": "https://registry.npmmirror.com/sass/-/sass-1.94.1.tgz", - "integrity": "sha512-/YVm5FRQaRlr3oNh2LLFYne1PdPlRZGyKnHh1sLleOqLcohTR4eUUvBjBIqkl1fEXd1MGOHgzJGJh+LgTtV4KQ==", + "version": "1.94.2", + "resolved": "https://registry.npmmirror.com/sass/-/sass-1.94.2.tgz", + "integrity": "sha512-N+7WK20/wOr7CzA2snJcUSSNTCzeCGUTFY3OgeQP3mZ1aj9NMQ0mSTXwlrnd89j33zzQJGqIN52GIOmYrfq46A==", "dev": true, "license": "MIT", "peer": true, @@ -4278,9 +4278,9 @@ "license": "MIT" }, "node_modules/vite": { - "version": "7.2.2", - "resolved": "https://registry.npmmirror.com/vite/-/vite-7.2.2.tgz", - "integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==", + "version": "7.2.4", + "resolved": "https://registry.npmmirror.com/vite/-/vite-7.2.4.tgz", + "integrity": "sha512-NL8jTlbo0Tn4dUEXEsUg8KeyG/Lkmc4Fnzb8JXN/Ykm9G4HNImjtABMJgkQoVjOBN/j2WAwDTRytdqJbZsah7w==", "dev": true, "license": "MIT", "peer": true, diff --git a/code/web/regulatory-management-util/package.json b/code/web/regulatory-management-util/package.json index 5a62ab5..8f9b837 100644 --- a/code/web/regulatory-management-util/package.json +++ b/code/web/regulatory-management-util/package.json @@ -15,11 +15,11 @@ }, "devDependencies": { "@element-plus/icons-vue": "^2.3.2", - "@stylistic/eslint-plugin": "^5.6.0", + "@stylistic/eslint-plugin": "^5.6.1", "@types/node": "^24.10.1", "@typescript-eslint/eslint-plugin": "^8.47.0", "@typescript-eslint/parser": "^8.47.0", - "@vitejs/plugin-vue": "^6.0.1", + "@vitejs/plugin-vue": "^6.0.2", "@vue-office/docx": "^1.6.3", "@vue-office/excel": "^1.7.14", "@vue-office/pdf": "^2.0.10", @@ -29,9 +29,9 @@ "eslint": "^9.39.1", "eslint-plugin-vue": "^10.5.1", "path": "^0.12.7", - "sass": "^1.94.1", + "sass": "^1.94.2", "typescript": "~5.9.3", - "vite": "^7.2.2", + "vite": "^7.2.4", "vue-demi": "^0.14.10", "vue-eslint-parser": "^10.2.0", "vue-pdf-embed": "^2.1.3", diff --git a/code/web/regulatory-management-util/src/types/upload_file.ts b/code/web/regulatory-management-util/src/types/upload_file.ts new file mode 100644 index 0000000..739fe39 --- /dev/null +++ b/code/web/regulatory-management-util/src/types/upload_file.ts @@ -0,0 +1,28 @@ +/** + * @Author: Kane Wang + * @Date: 2025-11-21 10:19:11 + * @LastEditors: Kane Wang + * @LastModified: 2025-11-21 10:36:19 + * @FilePath: src/types/upload_file.ts + * @Description: + * + * Copyright (c) 2025 by Kane All rights reserved + */ + +interface UploadFileResponse +{ + success: boolean; + message: string; + fileList: UploadedFile[]; +} + +interface UploadedFile +{ + fileName: string; + localFilePath: string; +} + +export { + type UploadedFile, + type UploadFileResponse +}; \ No newline at end of file diff --git a/code/web/regulatory-management-util/src/utils/config.ts b/code/web/regulatory-management-util/src/utils/config.ts new file mode 100644 index 0000000..32eeae3 --- /dev/null +++ b/code/web/regulatory-management-util/src/utils/config.ts @@ -0,0 +1,18 @@ +/** + * @Author: Kane Wang + * @Date: 2025-11-21 09:39:59 + * @LastEditors: Kane Wang + * @LastModified: 2025-11-21 09:40:00 + * @FilePath: src/utils/config.ts + * @Description: 保存应用的配置参数。 + * + * Copyright (c) 2025 by Kane All rights reserved + */ +const API_URL= { + URL_UPLOAD_FILE: import.meta.env.VITE_APP_URL_UPLOAD_FILE, + URL_MOVE_FILE: import.meta.env.VITE_APP_URL_MOVE_FILE, +}; + +console.log( API_URL ); + +export { API_URL }; \ No newline at end of file diff --git a/code/web/regulatory-management-util/src/utils/utils.ts b/code/web/regulatory-management-util/src/utils/utils.ts index 5df37d9..233d6e3 100644 --- a/code/web/regulatory-management-util/src/utils/utils.ts +++ b/code/web/regulatory-management-util/src/utils/utils.ts @@ -2,9 +2,55 @@ * @Author: Kane Wang * @Date: 2025-10-23 16:52:10 * @LastEditors: Kane Wang - * @LastModified: 2025-10-23 17:04:54 + * @LastModified: 2025-11-21 11:17:40 * @FilePath: src/utils/utils.ts - * @Description: + * @Description: 提供 一些功能性的函数 * * Copyright (c) 2025 by Kane All rights reserved */ + +/** + * 取文件路径末尾的扩展名作为文件类型 + * @param filePath 文件路径 + * @returns 文件类型字符串 + */ +function getFileType( filePath: string ): string +{ + let type = "未知类型"; + + if ( filePath == null || filePath.length == 0 ) + { + return type; + } + + const startIndex = filePath.lastIndexOf( "." ); + const fileType = filePath.slice( startIndex + 1 ).toUpperCase(); + + // ignore-eslint-next-line + switch( fileType ) + { + case "DOCX": + type = "WPS文档"; + break; + case "XLSX": + type = "WPS表格"; + break; + case "PDF": + type = "PDF文档"; + break; + case "JPG": + case "PNG": + case "BMP": + case "GIF": + type = "图片文件"; + break; + default: + type = "未知文件类型"; + } + + // type = fileType.length != 0 ? fileType + "文件" : "未知类型"; + + return type; +} + +export { getFileType }; \ No newline at end of file diff --git a/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue b/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue index 9836e03..f05ee65 100644 --- a/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue +++ b/code/web/regulatory-management-util/src/views/console/data/NewRegulatory.vue @@ -12,7 +12,7 @@ Copyright © CPIC All rights reserved 名称 - + @@ -20,13 +20,13 @@ Copyright © CPIC All rights reserved 部门 - + 发布、修订年份 - + @@ -34,7 +34,7 @@ Copyright © CPIC All rights reserved 备注 - + @@ -43,9 +43,6 @@ Copyright © CPIC All rights reserved 新增文档 - - 新增文档 - @@ -63,21 +60,27 @@ Copyright © CPIC All rights reserved border :head-cell-style="headerCellStyle" empty-text="请上传文件" + :data="ui.newRegulatory.regulatory_files" > - + - + - - 查看 - +
@@ -108,18 +111,41 @@ Copyright © CPIC All rights reserved