添加模型训练模块,类型管理和模型管理位置更换

This commit is contained in:
limengnan 2026-03-11 11:51:52 +08:00
parent beae418be5
commit 632fd0f725
6 changed files with 482 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

View File

@ -80,11 +80,13 @@ function handleClose() {
emit("closeConnectingwireModel",false);
}
function confirmClick() {
connectingwireInfo.value.color = customizeInfo.value.color
emit("closeConnectingwireModel", connectingwireInfo.value);
}
const customizeInfo:any = ref({
label: "自定义",
strokeDasharray: ""
strokeDasharray: "",
color: "#a2b1c3",
})
function connectingwireInput(e:any) {
connectingwireInfo.value.strokeDasharray = e
@ -135,7 +137,8 @@ onMounted(() => {
</div>
</div>
<div style="margin-top: 20px;margin-bottom: 10px;">颜色</div>
<el-color-picker-panel v-model="customizeInfo.color" />
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>

View File

@ -186,15 +186,15 @@ onMounted(() => {
rowHeight: 120,
},
},
{
collapsable: false,
title: '管线',
name: 'group3',
graphHeight: 400,
layoutOptions: {
rowHeight: 120,
},
},
// {
// collapsable: false,
// title: '线',
// name: 'group3',
// graphHeight: 400,
// layoutOptions: {
// rowHeight: 120,
// },
// },
],
layoutOptions: {
@ -416,17 +416,32 @@ onMounted(() => {
//
// node.attr('text/text', '')
// node.attr('label/text', '')
isAdddevice.value = true
}
})
graph.on('edge:selected', ({ edge }) => {
edge.addTools({
name: 'button-remove',
args: {
x: 0,
y: 0,
offset: { x: 10, y: 10 },
},
})
});
graph.on('edge:unselected', ({ edge }) => {
edge.removeTools()
})
// #endregion
// #region
@ -933,12 +948,15 @@ function preWork() {
}
const left = ref(0)
const top = ref(0)
const isMenuShow = ref(false)
const isMenuShow = ref(false) //
const selectedNode:any = ref(null)
function deleteNode() { //
graph.removeNode(selectedNode.value)
isMenuShow.value = false
}
function copyNode() { //
if (selectedNode.value) {
try {
@ -1001,9 +1019,12 @@ const connectingwireInfo:any = ref({
strokeDasharray: "0",
arrow: "1",
strokeWidth: 1,
color: "#a2b1c3",
})
const lineLine:any = ref( "#a2b1c3")
function closeConnectingwireModel(e:any){ // 线
if(e != false){
lineLine.value = e.color
let lineStyle:any = {
strokeDasharray: 0,
targetMarker: {},
@ -1046,7 +1067,7 @@ function closeConnectingwireModel(e:any){ // 关闭连接线弹窗
return new Shape.Edge({
attrs: {
line: {
stroke: '#A2B1C3',
stroke: lineLine.value,
strokeWidth: e.strokeWidth,
strokeDasharray: lineStyle.strokeDasharray,
targetMarker: lineStyle.targetMarker,
@ -1446,6 +1467,7 @@ function saveDesign() { // 保存设计
<img src="@/assets/x6/del.png" alt="图标" title="删除" style="cursor: pointer;"
@click="deleteNode">
</div>
<div class="line-style-box">
<!-- <div class="DisplaySettingsButton">显示设置</div> -->
<div class="expansionandcontraction-box" v-if="isExpansionandcontraction == false" @click="isExpansionandcontraction = true">

View File

@ -0,0 +1,439 @@
<script lang="ts">
export default {
name: "模型训练",
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchAlgorithmsPage,addAlgorithms,updateAlgorithms,deleteAlgorithms,deleteBatchAlgorithms} from "@/api/business/algorithm";
import { getDictItemById } from '@/api/dict';
import Page from '@/components/Pagination/page.vue'
const apiUrl = import.meta.env.VITE_APP_BASE_API; //
//
const queryParams = ref({
current: 1,
size: 10,
querystr: ''
});
//
const total = ref()
//
const tableData: any = ref([]);
//
const loading = ref(false)
function gettableData() {
let params = {
name: input.value,
pageNum: queryParams.value.current,
pageSize: queryParams.value.size,
};
loading.value = true;
searchAlgorithmsPage(params).then((result:any) => {
tableData.value = result.records;
total.value = result.total;
loading.value = false;
}).catch((err) => {
loading.value = false;
});
}
const algorithmData: any = ref([]);
function getAlgorithmList() { //
let params = {
name: "",
pageNum: 1,
pageSize: 999,
};
loading.value = true;
searchAlgorithmsPage(params).then((result:any) => {
algorithmData.value = result.records;
}).catch((err) => {
});
}
const menuData:any = ref([]);
//
function menuInit() { //
let params = {
dictId: 'fe2c3418b8998f4e64d56ab46bfe0fed',
size:99,
current:1
}
getDictItemById(params).then((result: any) => {
menuData.value = result.data.records;
}).catch((err: any) => {
});
}
const infoForm = ref();
//
const input = ref("");
//
const title = ref("");
const info: any = ref({
name: "",
description: "",
version: "",
principle: "",
status:1,
algorithmType: "",
inputParams: "",
outputParams: "",
inferBaseUrl: "",
trainBaseUrl: "",
supportedDeviceTypes: "",
defaultHyperParams: "",
});
const dialogVisible = ref(false);
function addClick() {
title.value = "新增训练任务";
info.value = {
name: "",
description: "",
version: "",
principle: "",
status:1,
algorithmType: "",
inputParams: "",
outputParams: "",
inferBaseUrl: "",
trainBaseUrl: "",
supportedDeviceTypes: "",
defaultHyperParams: "",
};
dialogVisible.value = true;
}
//-/
function confirmClick(formEl: any) {
formEl.validate((valid: any) => {
if (valid) {
const params = {
algorithmType: info.value.algorithmType,
name: info.value.name,
description: info.value.description,
version: info.value.version,
principle: info.value.principle,
inputParams: info.value.inputParams,
outputParams: info.value.outputParams,
inferBaseUrl: info.value.inferBaseUrl,
trainBaseUrl: info.value.trainBaseUrl,
supportedDeviceTypes: info.value.supportedDeviceTypes,
defaultHyperParams: info.value.defaultHyperParams,
status: info.value.status,
}
addAlgorithms(params).then((res) => {
gettableData();
dialogVisible.value = false;
});
}
});
}
//-
function handleClose() {
dialogVisible.value = false;
dialogViewVisible.value = false;
if (infoForm.value != null) infoForm.value.resetFields();
}
//
const rules = ref({
name: [{ required: true, message: "请输入训练任务名称", trigger: "blur" }],
algorithmType: [{ required: true, message: "请选择算法类型", trigger: "change" }]
});
//
function viewClick(row: any) {
title.value = "查看详情";
info.value = JSON.parse(JSON.stringify(row));
dialogViewVisible.value = true;
}
//
function delAloneClick(row: any) {
ElMessageBox.confirm("确定删除此训练任务吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let params = {
id: row.algorithmId,
};
deleteAlgorithms(params).then(() => {
gettableData();
ElMessage({
type: "success",
message: "删除成功",
});
});
})
}
//
function delClick(row:any) {
ElMessageBox.confirm("确定删除已选择训练任务吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
deleteBatchAlgorithms(row.id).then(() => {
gettableData();
ElMessage({
message: "删除成功",
type: "success",
});
});
});
}
function dateFormat(row: any) {
const daterc = row;
if (daterc != null) {
var date = new Date(daterc);
var year = date.getFullYear();
var month =
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
//
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
}
onMounted(() => {
getAlgorithmList() //
menuInit() //
gettableData();
});
function changeStatus(row: any) {
// let params = {
// algorithmId: row.algorithmId,
// status: row.status,
// };
// updateAlgorithms(params).then((res) => {
// gettableData();
// ElMessage({
// type: "success",
// message: "",
// });
// });
}
function releaseClick(row: any) {
title.value = "发布模型";
info.value = JSON.parse(JSON.stringify(row));
// dialogVisible.value = true;
}
const isEchartsModel = ref(false) // echarts
function changeShowResult(isShow:boolean){ //
isEchartsModel.value = isShow
}
const dialogViewVisible = ref(false) //
</script>
<template>
<div class="Algorithms-box">
<div class="conductproject-bg-box">
<div
style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;margin-bottom: 10px">
<div style="display: flex;display: -webkit-flex;">
<el-input v-model="input" placeholder="请输入训练任务名称" @keyup.enter="gettableData" style="width: 200px" clearable />
<el-button type="primary" style="margin-left: 10px" @click="gettableData">搜索</el-button>
</div>
<div style="display: flex;display: -webkit-flex;">
<el-button type="primary" @click="addClick">
新增</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 260px);margin-bottom: 10px;" border
:header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
<el-table-column prop="name" label="任务名称" width="180"></el-table-column>
<el-table-column prop="version" label="算法类型" width="100"></el-table-column>
<el-table-column prop="description" label="设备类型" min-width="100"></el-table-column>
<el-table-column prop="description" label="任务状态" min-width="100"></el-table-column>
<el-table-column prop="updatedAt" label="创建时间" width="200">
<template #default="scope">
{{ dateFormat(scope.row.updatedAt) }}
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="100" align="center">
<template #default="scope">
<span
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/table/view.png" alt="" title="查看详情"
@click="viewClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/annotation.png" alt="" title="发布模型"
@click="releaseClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/table/del.png" alt="" title="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span>
</template>
</el-table-column>
</el-table>
<Page :total="total" v-model:size="queryParams.size" v-model:current="queryParams.current" @pagination="gettableData()" ></Page>
</div>
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" :title="title"
append-to-body width="1145px" height="600px">
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px"
style="margin-top: 20px;">
<el-form-item label="训练名称名称" prop="name" style="width: 100%;" >
<el-input v-model="info.task_name" style="width: 100%" placeholder="输入算法名称"></el-input>
</el-form-item>
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="confirmClick(infoForm)"> </el-button>
</span>
</el-form>
</el-dialog>
<el-dialog v-model="dialogViewVisible" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" :title="'模型详情'"
append-to-body width="1145px" height="600px">
<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 @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>
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px"
style="margin-top: 20px;" v-if="!isEchartsModel">
<el-form-item label="版本" style="width: 100%;" >
<el-input v-model="info.versionTag" style="width: 100%" placeholder="输入算法名称" :disabled="true"></el-input>
</el-form-item>
</el-form>
<div v-else style="width: 100%; height: calc(100% - 50px);">
<img :src="apiUrl +'/models/'+ info.metricsImagePath" alt="" style="width: 100%; height: 100%;object-fit:contain;">
</div>
</div>
</el-dialog>
</div>
</template>
<style scoped>
.Algorithms-box {
padding-right: 10px;
}
:deep(.el-tree-node__content) {
font-size: 15px;
font-weight: 500;
width: 100%;
height: 40px;
}
.dialog-footer {
display: block;
margin-top: 20px;
}
.conductproject-bg-box {
padding: 20px;
width: 100%;
height: calc(100vh - 130px);
overflow: auto;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 3px;
box-sizing: border-box;
}
.Algorithms_dialog_tabbox{
display: flex;
border-bottom: 1px solid #e4e7ed;
padding-bottom: 10px;
}
.Algorithms_dialog_tabbox_item{
position: relative;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.Algorithms_dialog_tabbox_item span{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Arial Normal', 'Arial';
font-weight: 400;
font-style: normal;
font-size: 14px;
color: #363636;
}
.Algorithms_dialog_tabbox_item span:hover{
color: #266fff;
}
.Algorithms_dialog_tabbox_active span{
color: #fff !important;
}
</style>
<style>
.el-dialog {
padding: 0 !important;
border-radius: 10px !important;
border: 1px solid #363636 !important;
}
.el-dialog .el-dialog__header{
display: flex;
display: -webkit-flex;
justify-content: flex-start;-webkit-justify-content: flex-start;
align-items: center;-webkit-align-items: center;
padding: 10px 20px;
background-color: #f1f3f8 !important;
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
color: #1B1B1B;
text-align: left;
border-radius: 10px 10px 0 0;
height: 50px;
}
.el-dialog .el-dialog__close{
font-size: 22px;
color: rgb(80, 80, 80);
}
.el-dialog .el-dialog__headerbtn{
display: flex;
align-items: center;
}
.el-dialog .el-dialog__body{
padding: 20px 40px !important;
}
.el-dialog .el-input{
--el-input-inner-height: 38px
}
.Algorithms-box .el-button{
height: 36px;
}
.el-dialog .el-button{
height: 40px;
}
</style>