根据需求修改页面

This commit is contained in:
limengnan 2026-03-16 16:09:11 +08:00
parent 6ca6516b12
commit 36d4b57ce3
10 changed files with 151 additions and 76 deletions

View File

@ -35,3 +35,11 @@ export function deleteAlgorithms (queryParams:any){
// params: queryParams // params: queryParams
}); });
} }
export function trainStatus(taskId:any){
return request({
url: '/train/status/'+taskId ,
method: 'get'
});
}

View File

@ -58,4 +58,3 @@ export function algorithmsType(type:any){
} }

View File

@ -12,25 +12,14 @@ export function searchAlgorithmsModelPage(queryParams:any){
// //新增项目 // //激活
// export function addAlgorithms(data:any){ export function algorithmModels(params:any){
// return request({ return request({
// url:'/algorithms' , url:'/algorithm-models/activate' ,
// method: 'Post', method: 'Post',
// data: data params: params
// }); });
// } }
// //更新项目信息
// export function updateAlgorithms (queryParams:any){
// return request({
// url:'/algorithms' ,
// method: 'PUT',
// data: queryParams
// });
// }
//单个删除项目 //单个删除项目
export function deleteAlgorithmModels (queryParams:any){ export function deleteAlgorithmModels (queryParams:any){

View File

@ -66,6 +66,16 @@ export function topologyDevicesLsit(queryParams:any){
}); });
} }
//初始化项目模拟数据
export function simRun(data:any){
return request({
url:'/sim/run' ,
method: 'Post',
data:data
});
}
//初始化项目模拟数据 //初始化项目模拟数据
export function simulationInit(queryParams:any){ export function simulationInit(queryParams:any){
return request({ return request({

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

View File

@ -9,7 +9,7 @@ import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus"; import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchAlgorithmsPage,addAlgorithms,updateAlgorithms} from "@/api/business/algorithm"; import { searchAlgorithmsPage,addAlgorithms,updateAlgorithms} from "@/api/business/algorithm";
import { searchAlgorithmsModelPage, deleteAlgorithmModels,deleteBatchAlgorithmModels } from "@/api/business/algorithmModel"; import { searchAlgorithmsModelPage, deleteAlgorithmModels,deleteBatchAlgorithmModels,algorithmModels } from "@/api/business/algorithmModel";
import Page from '@/components/Pagination/page.vue' import Page from '@/components/Pagination/page.vue'
@ -252,15 +252,20 @@ onMounted(() => {
gettableData(); gettableData();
}); });
function changeStatus(row: any) { function changeStatus(row: any) {
let params = { ElMessageBox.confirm("确定是否激活此算法数据吗?", "激活提示", {
algorithmId: row.algorithmId, confirmButtonText: "确定",
status: row.status, cancelButtonText: "取消",
}; type: "warning",
updateAlgorithms(params).then((res) => { }).then(() => {
gettableData(); let params = {
ElMessage({ algorithmModelId: row.algorithmModelId,
type: "success", };
message: "更新成功", algorithmModels(params).then((res) => {
gettableData();
ElMessage({
type: "success",
message: "更新成功",
});
}); });
}); });
} }
@ -313,24 +318,26 @@ function changeShowResult(isShow:boolean){ // 切换显示结果模型
<el-table-column prop="metrics" label="训练评估指标 " min-width="100"></el-table-column> <el-table-column prop="metrics" label="训练评估指标 " min-width="100"></el-table-column>
<el-table-column prop="updatedAt" label="是否激活" width="90" align="center"> <el-table-column prop="updatedAt" label="是否激活" width="90" align="center">
<template #default="scope"> <template #default="scope">
<el-switch <!-- <el-switch
v-model="scope.row.isCurrent" v-model="scope.row.isCurrent"
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
size="small" size="small"
style="margin-right: 5px" style="margin-right: 5px"
@change="changeStatus(scope.row)" @change="changeStatus(scope.row)"
/> /> -->
<span v-if="scope.row.isCurrent == 1" style="color: #409eff"></span> <span v-if="scope.row.isCurrent == 1" style="color: #409eff"></span>
<span v-else style="color: #909399;"></span> <span v-else style="color: #909399;"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center"> <el-table-column fixed="right" label="操作" width="100" align="center">
<template #default="scope"> <template #default="scope">
<span <span
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; "> style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/table/view.png" alt="" title="查看详情" <img src="@/assets/table/view.png" alt="" title="查看详情"
@click="editClick(scope.row)" style="cursor: pointer; "> @click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/activate.png" alt="" title="是否激活"
@click="changeStatus(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/del.png" alt="" title="删除" <img src="@/assets/table/del.png" alt="" title="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; "> @click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span> </span>

View File

@ -7,7 +7,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, nextTick,reactive } from "vue"; import { onMounted, ref, nextTick,reactive } from "vue";
import { ElForm, ElMessage, ElMessageBox,FormRules } from "element-plus"; import { ElForm, ElMessage, ElMessageBox,FormRules } from "element-plus";
import { addAlgorithms,deleteAlgorithms,trainAlgorithmsPage,trainPublish} from "@/api/algorithml"; import { addAlgorithms,deleteAlgorithms,trainAlgorithmsPage,trainPublish,trainStatus} from "@/api/algorithml";
import { searchAlgorithmsPage,algorithmsType } from "@/api/business/algorithm"; import { searchAlgorithmsPage,algorithmsType } from "@/api/business/algorithm";
import { getDictItemById } from '@/api/dict'; import { getDictItemById } from '@/api/dict';
@ -210,10 +210,12 @@ function confirmClick(formEl: any) {
} }
}) })
} }
const timer:any = ref(null)
//- //-
function handleClose() { function handleClose() {
dialogVisibles.value = false; dialogVisibles.value = false;
dialogViewVisible.value = false; dialogViewVisible.value = false;
clearTimeout(timer.value)
if (infoForm.value != null) infoForm.value.resetFields(); if (infoForm.value != null) infoForm.value.resetFields();
} }
function handleClosed(){ function handleClosed(){
@ -237,6 +239,23 @@ function viewClick(row: any) {
}) })
} }
} }
clearTimeout(timer.value)
timer.value = setInterval(() => {
trainStatus(row.taskId).then((result:any) => {
if(result.data !=null && result.data.status !=null){
info.value = result.data
if(result.data.status == 'Success' || result.data.status == 'Failed'){
clearTimeout(timer.value)
}
}
})
}, 2000);
dialogViewVisible.value = true; dialogViewVisible.value = true;
} }
@ -379,6 +398,37 @@ function confirmsClick(){
}) })
modelVisible.value=false modelVisible.value=false
} }
const objectSpanMethod = ({
row,
column,
rowIndex,
columnIndex,
}: any) => {
if (columnIndex === 0) {
if (rowIndex === 0 || row.category !== algorithmsTypeData.value[rowIndex - 1].category) {
let rowspan = 1;
for (let i = rowIndex + 1; i < algorithmsTypeData.value.length; i++) {
if (algorithmsTypeData.value[i].category === row.category) {
rowspan++;
} else {
break;
}
}
return {
rowspan,
colspan: 1
};
} else {
return {
rowspan: 0,
colspan: 0
};
}
}
}
</script> </script>
<template> <template>
@ -476,7 +526,9 @@ function confirmsClick(){
<span style="font-weight: bold;">输入数据预处理说明</span>输入数据在训练前已进行标准化处理StandardScaler,因此 rbf_length_scale 等参数对应的是标准化后的尺度不是原始数据的物理单位 <span style="font-weight: bold;">输入数据预处理说明</span>输入数据在训练前已进行标准化处理StandardScaler,因此 rbf_length_scale 等参数对应的是标准化后的尺度不是原始数据的物理单位
</div> </div>
<el-table v-loading="loading" :data="algorithmsTypeData" style="width: 100%;" border <el-table v-loading="loading" :data="algorithmsTypeData" style="width: 100%;" border
:span-method="objectSpanMethod"
:header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }"> :header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
<el-table-column prop="category" label="参数类型" width="100" ></el-table-column>
<el-table-column prop="name" label="参数名称" width="180" ></el-table-column> <el-table-column prop="name" label="参数名称" width="180" ></el-table-column>
<el-table-column prop="key" label="参数标识" width="160" ></el-table-column> <el-table-column prop="key" label="参数标识" width="160" ></el-table-column>
<el-table-column prop="description" label="参数说明" min-width="160" ></el-table-column> <el-table-column prop="description" label="参数说明" min-width="160" ></el-table-column>
@ -520,7 +572,7 @@ function confirmsClick(){
<div style=" width: calc(100%); height: calc(100vh - 200px);"> <div style=" width: calc(100%); height: calc(100vh - 200px);">
<div style="display: flex; margin-bottom: 20px; border-bottom: 1px solid #e5e5e5;padding-bottom: 5px;"> <div style="display: flex; margin-bottom: 20px; border-bottom: 1px solid #e5e5e5;padding-bottom: 5px;">
<div @click="changeShowResult(false)" class="adddevice_navigation_left" :class="{'adddevice_navigation_activeleft':!isEchartsModel}">基本信息</div> <div @click="changeShowResult(false)" class="adddevice_navigation_left" :class="{'adddevice_navigation_activeleft':!isEchartsModel}">基本信息</div>
<div @click="changeShowResult(true)" class="adddevice_navigation_right" :class="{'adddevice_navigation_activeright':isEchartsModel}">/训练结果</div> <div @click="changeShowResult(true)" class="adddevice_navigation_right" :class="{'adddevice_navigation_activeright':isEchartsModel}">训练结果</div>
</div> </div>
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px" <el-form ref="infoForm" :model="info" :rules="rules" label-width="100px"
style="margin-top: 20px;" v-if="!isEchartsModel"> style="margin-top: 20px;" v-if="!isEchartsModel">
@ -558,13 +610,13 @@ function confirmsClick(){
</el-form> </el-form>
<div v-else style="width: 100%; height: calc(100% - 50px);"> <div v-else style="width: 100%; height: calc(100% - 50px);">
<div v-if="info.status == 'Success'"> <div v-if="info.status == 'Success'" style="width: 100%; height:100%">
<img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;"> <img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;">
</div> </div>
<div v-if="info.status == 'Failed'"> <div v-if="info.status == 'Failed'" style="width: 100%; height:100%;">
失败 失败
</div> </div>
<div v-if="info.status == 'Training'"> <div v-if="info.status == 'Training'" style="width: 100%; height:100%;">
训练中 训练中
</div> </div>
</div> </div>
@ -702,5 +754,37 @@ function confirmsClick(){
height: 40px; height: 40px;
} }
.adddevice_navigation_left{
width: 110px;
height: 32px;
line-height: 32px;
text-align: center;
cursor: pointer;
font-family: 'Arial Normal', 'Arial';
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #363636;
background-image: url('@/assets/x6/navleft.png');
}
.adddevice_navigation_left:hover{
color: #266fff ;
}
.adddevice_navigation_activeleft{
background-image: url('@/assets/x6/navleft_active.png');
color: #fff !important;
}
.adddevice_navigation_right{
width: 110px;
height: 32px;
line-height: 32px;
text-align: center;
cursor: pointer;
font-family: 'Arial Normal', 'Arial';
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #363636;
background-image: url('@/assets/x6/navright.png');
}
</style> </style>

View File

@ -313,7 +313,8 @@ function getDeviceInfo(e:any){ // 获取设备信息
<div v-for="(item, index) in menuList[menuIndex].segments" :key="index" class="segmentation-item" <div v-for="(item, index) in menuList[menuIndex].segments" :key="index" class="segmentation-item"
:class="{'segmentation-item-active': index == segmentationIndex}" @click="segmentationIndex = index"> :class="{'segmentation-item-active': index == segmentationIndex}" @click="segmentationIndex = index">
<span>{{ item.segmentId }}</span> <span>{{ item.segmentId }}</span>
<svg v-if="isEdit == true && menuList[menuIndex].segments.length > 1"
<svg v-if="isEdit == true && menuList[menuIndex].segments.length >1 && menuList[menuIndex].segments.length - 1 == index"
@click.top="removeSegmentation(index)" @click.top="removeSegmentation(index)"
t="1766969938271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4998" width="14" height="14"><path d="M571.01312 523.776l311.3472-311.35232c15.7184-15.71328 15.7184-41.6256 0-57.344l-1.69472-1.69984c-15.7184-15.71328-41.6256-15.71328-57.34912 0l-311.3472 311.77728-311.35232-311.77728c-15.7184-15.71328-41.63072-15.71328-57.344 0l-1.69984 1.69984a40.0128 40.0128 0 0 0 0 57.344L452.92544 523.776l-311.35232 311.35744c-15.71328 15.71328-15.71328 41.63072 0 57.33888l1.69984 1.69984c15.71328 15.7184 41.6256 15.7184 57.344 0l311.35232-311.35232 311.3472 311.35232c15.72352 15.7184 41.63072 15.7184 57.34912 0l1.69472-1.69984c15.7184-15.70816 15.7184-41.6256 0-57.33888l-311.3472-311.35744z" p-id="4999" fill="currentColor"></path></svg> t="1766969938271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4998" width="14" height="14"><path d="M571.01312 523.776l311.3472-311.35232c15.7184-15.71328 15.7184-41.6256 0-57.344l-1.69472-1.69984c-15.7184-15.71328-41.6256-15.71328-57.34912 0l-311.3472 311.77728-311.35232-311.77728c-15.7184-15.71328-41.63072-15.71328-57.344 0l-1.69984 1.69984a40.0128 40.0128 0 0 0 0 57.344L452.92544 523.776l-311.35232 311.35744c-15.71328 15.71328-15.71328 41.63072 0 57.33888l1.69984 1.69984c15.71328 15.7184 41.6256 15.7184 57.344 0l311.35232-311.35232 311.3472 311.35232c15.72352 15.7184 41.63072 15.7184 57.34912 0l1.69472-1.69984c15.7184-15.70816 15.7184-41.6256 0-57.33888l-311.3472-311.35744z" p-id="4999" fill="currentColor"></path></svg>
</div> </div>

View File

@ -10,7 +10,7 @@ import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchScenariosLsit,addScenarios,updateScenarios,deleteScenarios,deleteBatchScenarios} from "@/api/business/scenario"; import { searchScenariosLsit,addScenarios,updateScenarios,deleteScenarios,deleteBatchScenarios} from "@/api/business/scenario";
import { getActiveAlgorithms } from "@/api/business/scenario"; import { getActiveAlgorithms } from "@/api/business/scenario";
import ConditionModel from '@/views/component/scenario/condition.vue' import ConditionModel from '@/views/component/scenario/condition.vue'
import { simulationInit,simulationRun } from "@/api/business/project"; import { simRun,simulationRun } from "@/api/business/project";
import Page from '@/components/Pagination/page.vue' import Page from '@/components/Pagination/page.vue'
import { getDictItemById } from '@/api/dict'; import { getDictItemById } from '@/api/dict';
import Createscenario from '@/views/component/scenario/createscenario.vue' import Createscenario from '@/views/component/scenario/createscenario.vue'
@ -262,6 +262,7 @@ function closeCreatescenario(){
} }
function confirmationAnalysis(row: any) { function confirmationAnalysis(row: any) {
ElMessageBox.confirm("确定对"+ row.name +"故情景分析进行模拟吗?", "确认模拟", { ElMessageBox.confirm("确定对"+ row.name +"故情景分析进行模拟吗?", "确认模拟", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
@ -272,43 +273,19 @@ function confirmationAnalysis(row: any) {
projectId: row.projectId, projectId: row.projectId,
scenarioId: row.scenarioId, scenarioId: row.scenarioId,
}; };
simulationInit(params).then((res:any) => { simRun(params).then((res:any) => {
if (res.code == '0') { if (res.code == '0') {
let data = {
data: res.data
}
simulationRun(row.projectId, row.scenarioId, data || {}).then((res:any) => {
if(res.code == '0'){
ElMessage({
type: "success",
message: "模拟计算成功",
});
gettableData();
setTimeout(() => {
resultClick(row)
// window.open(webUrl + '/#/viewanalysis?projectId='+ row.projectId +'&scenarioId='+ row.scenarioId, '_blank');
}, 1000);
}else{
ElMessage({
type: "error",
message: "模拟运行失败,请检查后端服务是否正常",
});
}{}
}).catch((error) => {
console.error('模拟运行失败:', error);
ElMessage({ ElMessage({
type: "error", message: '模拟计算成功',
message: "模拟运行失败,请检查后端服务是否正常", type: 'success',
}); })
}) gettableData();
}else{ }else{
ElMessage({ ElMessage({
type: "error", message: '模拟计算失败',
message: "模拟初始化失败", type: 'error',
}); })
} }
}); });
}) })
} }