From f3bc668e65e3de8ef51e5b16a24da16fa2fd9fb1 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Tue, 20 Jan 2026 16:56:36 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=9B=9E=E6=98=BE=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/business/algorithmModel/index.vue | 5 ++-- .../com/yfd/platform/config/WebConfig.java | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/business-css/frontend/src/views/business/algorithmModel/index.vue b/business-css/frontend/src/views/business/algorithmModel/index.vue index 197b4d6..9cac49b 100644 --- a/business-css/frontend/src/views/business/algorithmModel/index.vue +++ b/business-css/frontend/src/views/business/algorithmModel/index.vue @@ -14,6 +14,7 @@ import { searchAlgorithmsModelPage} from "@/api/business/algorithmModel"; import Page from '@/components/Pagination/page.vue' import { getDictItemById } from '@/api/dict'; +const apiUrl = import.meta.env.VITE_APP_BASE_API; // 基础路径 const menuData:any = ref([]); const algorithmData:any = ref([]); // 查询字典项 @@ -341,7 +342,7 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
@@ -379,7 +380,7 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
- +
diff --git a/framework/src/main/java/com/yfd/platform/config/WebConfig.java b/framework/src/main/java/com/yfd/platform/config/WebConfig.java index 45b051a..081988e 100644 --- a/framework/src/main/java/com/yfd/platform/config/WebConfig.java +++ b/framework/src/main/java/com/yfd/platform/config/WebConfig.java @@ -4,11 +4,14 @@ import cn.hutool.cache.Cache; import cn.hutool.cache.CacheUtil; import lombok.SneakyThrows; import jakarta.annotation.Resource; + +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -17,7 +20,20 @@ public class WebConfig implements WebMvcConfigurer { @Resource private FileSpaceProperties fileSpaceProperties; + @Value("${file-space.model-path:E:/python_coding/keffCenter/models/}") + private String modelPath; + + /** + * 跨域配置:允许前端访问 /models/** 资源 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/models/**") // 仅放行 /models/** 路径 + .allowedOrigins("http://localhost:3000") // 前端地址 + .allowedMethods("GET") // 仅允许 GET + .allowCredentials(true); // 如需带 cookie + } @Bean public Cache loginuserCache() { @@ -41,6 +57,7 @@ public class WebConfig implements WebMvcConfigurer { @SneakyThrows @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { + System.out.println("[WebConfig] modelPath in addResourceHandlers = " + modelPath); registry.addResourceHandler("/icon/**") .addResourceLocations("classpath:/static/icon/") .setCachePeriod(0); @@ -52,9 +69,19 @@ public class WebConfig implements WebMvcConfigurer { registry.addResourceHandler("swagger-ui.html").addResourceLocations( "classpath:/META-INF/resources/"); + // 把本地 modelPath 映射到 /models/** URL + String path = modelPath.replace("\\", "/"); + if (!path.endsWith("/")) { + path += "/"; + } + registry.addResourceHandler("/models/**") + .addResourceLocations("file:" + path); + String systemUrl = "file:" + fileSpaceProperties.getSystem().replace("\\", "/")+"user\\"; registry.addResourceHandler("/avatar/**").addResourceLocations(systemUrl).setCachePeriod(0); + + } From 7103ba3cacdbb61dde2ca8b40afd22f70a826980 Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Tue, 20 Jan 2026 17:18:54 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/business/algorithmModel/index.ts | 4 ++-- .../src/views/business/algorithm/index.vue | 2 +- .../src/views/business/algorithmModel/index.vue | 14 +++++++------- .../views/business/database/criticalData/index.vue | 2 +- .../src/views/business/database/device/index.vue | 2 +- .../src/views/business/database/material/index.vue | 2 +- .../frontend/src/views/business/project/index.vue | 2 +- .../src/views/component/scenario/index.vue | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/business-css/frontend/src/api/business/algorithmModel/index.ts b/business-css/frontend/src/api/business/algorithmModel/index.ts index cce6a00..69f76f9 100644 --- a/business-css/frontend/src/api/business/algorithmModel/index.ts +++ b/business-css/frontend/src/api/business/algorithmModel/index.ts @@ -33,7 +33,7 @@ export function searchAlgorithmsModelPage(queryParams:any){ //单个删除项目 -export function deleteAlgorithms (queryParams:any){ +export function deleteAlgorithmModels (queryParams:any){ return request({ url:'/algorithm-models/'+queryParams.id , method: 'delete' @@ -41,7 +41,7 @@ export function deleteAlgorithms (queryParams:any){ }); } //多选删除项目 -export function deleteBatchAlgorithms (queryParams:any){ +export function deleteBatchAlgorithmModels (queryParams:any){ return request({ url:'/algorithm-models', method: 'delete', diff --git a/business-css/frontend/src/views/business/algorithm/index.vue b/business-css/frontend/src/views/business/algorithm/index.vue index c02d2ad..6a90c38 100644 --- a/business-css/frontend/src/views/business/algorithm/index.vue +++ b/business-css/frontend/src/views/business/algorithm/index.vue @@ -168,7 +168,7 @@ function delAloneClick(row: any) { // 多选删除? function delClick() { - ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", { + ElMessageBox.confirm("确定删除已选择算法数据吗?", "删除提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", diff --git a/business-css/frontend/src/views/business/algorithmModel/index.vue b/business-css/frontend/src/views/business/algorithmModel/index.vue index 9cac49b..a326190 100644 --- a/business-css/frontend/src/views/business/algorithmModel/index.vue +++ b/business-css/frontend/src/views/business/algorithmModel/index.vue @@ -7,9 +7,9 @@ export default {