新增模型管理模块
This commit is contained in:
parent
293407919a
commit
4c494a3ede
@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
//获取所有项目列表
|
||||||
|
export function searchAlgorithmsModelPage(queryParams:any){
|
||||||
|
return request({
|
||||||
|
url: '/algorithm-models/search' ,
|
||||||
|
method: 'get',
|
||||||
|
params:queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// //新增项目
|
||||||
|
// export function addAlgorithms(data:any){
|
||||||
|
// return request({
|
||||||
|
// url:'/algorithms' ,
|
||||||
|
// method: 'Post',
|
||||||
|
// data: data
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// //更新项目信息
|
||||||
|
// export function updateAlgorithms (queryParams:any){
|
||||||
|
// return request({
|
||||||
|
// url:'/algorithms' ,
|
||||||
|
// method: 'PUT',
|
||||||
|
// data: queryParams
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//单个删除项目
|
||||||
|
export function deleteAlgorithms (queryParams:any){
|
||||||
|
return request({
|
||||||
|
url:'/algorithm-models/'+queryParams.id ,
|
||||||
|
method: 'delete'
|
||||||
|
// params: queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//多选删除项目
|
||||||
|
export function deleteBatchAlgorithms (queryParams:any){
|
||||||
|
return request({
|
||||||
|
url:'/algorithm-models',
|
||||||
|
method: 'delete',
|
||||||
|
data: queryParams
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -19,8 +19,6 @@ const queryParams = ref({
|
|||||||
const total = ref()
|
const total = ref()
|
||||||
//定义表格数据
|
//定义表格数据
|
||||||
|
|
||||||
const customAttrsData:any = ref([])
|
|
||||||
|
|
||||||
const tableData: any = ref([]);
|
const tableData: any = ref([]);
|
||||||
const multipleSelection = ref([]);
|
const multipleSelection = ref([]);
|
||||||
// 表格加载
|
// 表格加载
|
||||||
@ -45,30 +43,6 @@ function handleSelectionChange(val: any) {
|
|||||||
multipleSelection.value = val;
|
multipleSelection.value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理数字输入的过滤
|
|
||||||
function handleNumberInput(field: string) {
|
|
||||||
// 过滤输入,只允许数字和小数点
|
|
||||||
info.value[field] = info.value[field].replace(/[^\d.]/g, '');
|
|
||||||
// 确保只有一个小数点
|
|
||||||
const parts = info.value[field].split('.');
|
|
||||||
if (parts.length > 2) {
|
|
||||||
info.value[field] = parts[0] + '.' + parts.slice(1).join('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 处理数字输入的过滤
|
|
||||||
function tableNumberInput(index:any, field: string) {
|
|
||||||
// 过滤输入,只允许数字和小数点
|
|
||||||
customAttrsData.value[index][field] = customAttrsData.value[index][field].replace(/[^\d.]/g, '');
|
|
||||||
// 确保只有一个小数点
|
|
||||||
const parts = customAttrsData.value[index][field].split('.');
|
|
||||||
if (parts.length > 2) {
|
|
||||||
customAttrsData.value[index][field] = parts[0] + '.' + parts.slice(1).join('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const infoForm = ref();
|
const infoForm = ref();
|
||||||
//搜索内容及点击搜索按钮
|
//搜索内容及点击搜索按钮
|
||||||
@ -80,6 +54,14 @@ const info: any = ref({
|
|||||||
description: "",
|
description: "",
|
||||||
version: "",
|
version: "",
|
||||||
principle: "",
|
principle: "",
|
||||||
|
status:1,
|
||||||
|
algorithmType: "",
|
||||||
|
inputParams: "",
|
||||||
|
outputParams: "",
|
||||||
|
inferBaseUrl: "",
|
||||||
|
trainBaseUrl: "",
|
||||||
|
supportedDeviceTypes: "",
|
||||||
|
defaultHyperParams: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
@ -90,8 +72,15 @@ function addClick() {
|
|||||||
description: "",
|
description: "",
|
||||||
version: "",
|
version: "",
|
||||||
principle: "",
|
principle: "",
|
||||||
|
status:1,
|
||||||
|
algorithmType: "",
|
||||||
|
inputParams: "",
|
||||||
|
outputParams: "",
|
||||||
|
inferBaseUrl: "",
|
||||||
|
trainBaseUrl: "",
|
||||||
|
supportedDeviceTypes: "",
|
||||||
|
defaultHyperParams: "",
|
||||||
};
|
};
|
||||||
customAttrsData.value = []
|
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
//新建算法数据-确认按钮/修改按钮
|
//新建算法数据-确认按钮/修改按钮
|
||||||
@ -102,11 +91,18 @@ function confirmClick(formEl: any) {
|
|||||||
if (!info.value.algorithmId) {
|
if (!info.value.algorithmId) {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
algorithmType: info.value.algorithmType,
|
||||||
name: info.value.name,
|
name: info.value.name,
|
||||||
description: info.value.description,
|
description: info.value.description,
|
||||||
version: info.value.version,
|
version: info.value.version,
|
||||||
principle: info.value.principle,
|
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) => {
|
addAlgorithms(params).then((res) => {
|
||||||
gettableData();
|
gettableData();
|
||||||
@ -139,45 +135,12 @@ function handleClose() {
|
|||||||
//新建算法数据
|
//新建算法数据
|
||||||
const rules = ref({
|
const rules = ref({
|
||||||
name: [{ required: true, message: "请输入算法数据名称", trigger: "blur" }],
|
name: [{ required: true, message: "请输入算法数据名称", trigger: "blur" }],
|
||||||
uConcentration: [
|
algorithmType: [{ required: true, message: "请选择算法类型", trigger: "change" }]
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
uo2Density: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
uEnrichment: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
puConcentration: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
puo2Density: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
puIsotope: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
hno3Acidity: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
h2c2o4Concentration: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
organicRatio: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
moistureContent: [
|
|
||||||
{ pattern: /^\d+(\.\d+)?$/, message: "请输入有效的数字或小数", trigger: "blur" }
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
//修改算法数据
|
//修改算法数据
|
||||||
function editClick(row: any) {
|
function editClick(row: any) {
|
||||||
title.value = "修改算法数据";
|
title.value = "修改算法数据";
|
||||||
info.value = JSON.parse(JSON.stringify(row));
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
|
|
||||||
if(row.customAttrs != null){
|
|
||||||
customAttrsData.value = JSON.parse(row.customAttrs);
|
|
||||||
}
|
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,13 +205,22 @@ function dateFormat(row: any) {
|
|||||||
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tabActive = ref(0);
|
|
||||||
function tabClick(index: any) {
|
|
||||||
tabActive.value = index;
|
|
||||||
}
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
gettableData();
|
gettableData();
|
||||||
});
|
});
|
||||||
|
function changeStatus(row: any) {
|
||||||
|
let params = {
|
||||||
|
algorithmId: row.algorithmId,
|
||||||
|
status: row.status,
|
||||||
|
};
|
||||||
|
updateAlgorithms(params).then((res) => {
|
||||||
|
gettableData();
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: "更新成功",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -280,6 +252,20 @@ onMounted(() => {
|
|||||||
{{ dateFormat(scope.row.updatedAt) }}
|
{{ dateFormat(scope.row.updatedAt) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="updatedAt" label="是否激活" width="90" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
@change="changeStatus(scope.row)"
|
||||||
|
/>
|
||||||
|
<span v-if="scope.row.status == 1" style="color: #409eff">是</span>
|
||||||
|
<span v-else style="color: #909399;">否</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column fixed="right" label="操作" width="80" align="center">
|
<el-table-column fixed="right" label="操作" width="80" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span
|
<span
|
||||||
@ -299,40 +285,42 @@ onMounted(() => {
|
|||||||
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
|
||||||
:modal="false" draggable :before-close="handleClose" :title="title"
|
:modal="false" draggable :before-close="handleClose" :title="title"
|
||||||
append-to-body width="1145px" height="600px">
|
append-to-body width="1145px" height="600px">
|
||||||
<div class="Algorithms_dialog_tabbox" >
|
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px"
|
||||||
<div class="Algorithms_dialog_tabbox_item" :class="{'Algorithms_dialog_tabbox_active': tabActive === 0}"
|
|
||||||
@click="tabClick(0)">
|
|
||||||
<img v-if="tabActive === 0" src="@/assets/algorithm/tab1_selected.png" alt="">
|
|
||||||
<img v-else src="@/assets/algorithm/tab1.png" alt="">
|
|
||||||
<span>基本信息</span>
|
|
||||||
</div>
|
|
||||||
<div class="Algorithms_dialog_tabbox_item" :class="{'Algorithms_dialog_tabbox_active': tabActive === 1}"
|
|
||||||
@click="tabClick(1)">
|
|
||||||
<img v-if="tabActive === 1" src="@/assets/algorithm/tab2_selected.png" alt="">
|
|
||||||
<img v-else src="@/assets/algorithm/tab2.png" alt="">
|
|
||||||
<span>调用参数</span>
|
|
||||||
</div>
|
|
||||||
<div class="Algorithms_dialog_tabbox_item" :class="{'Algorithms_dialog_tabbox_active': tabActive === 2}"
|
|
||||||
@click="tabClick(2)" >
|
|
||||||
<img v-if="tabActive === 2" src="@/assets/algorithm/tab2_selected.png" alt="">
|
|
||||||
<img v-else src="@/assets/algorithm/tab2.png" alt="">
|
|
||||||
<span>输出参数</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<el-form ref="infoForm" :model="info" :rules="rules" label-width="220px"
|
|
||||||
style="margin-top: 20px;">
|
style="margin-top: 20px;">
|
||||||
<el-form-item label="算法名称" prop="name" style="width: 100%;" label-width="80px">
|
<el-form-item label="算法名称" prop="name" style="width: 100%;" >
|
||||||
<el-input v-model="info.name" style="width: 100%" placeholder="输入算法名称"></el-input>
|
<el-input v-model="info.name" style="width: 100%" placeholder="输入算法名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="算法描述" style="width: 100%;" label-width="80px">
|
<el-form-item label="算法类型" prop="algorithmType" style="width: 100%;" >
|
||||||
<el-input type="textarea" v-model="info.description" :rows="6" style="width: 100%" placeholder="请输入算法描述"></el-input>
|
<el-input v-model="info.algorithmType" style="width: 100%" placeholder="输入算法类型"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="版本" style="width: 100%;" label-width="80px">
|
<el-form-item label="调用参数" style="width: 100%;" >
|
||||||
|
<el-input type="textarea" v-model="info.inputParams" :rows="2" style="width: 100%" placeholder="请输入调用参数"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="输出参数" style="width: 100%;" >
|
||||||
|
<el-input type="textarea" v-model="info.outputParams" :rows="2" style="width: 100%" placeholder="请输入输出参数"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="推理URL" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.inferBaseUrl" style="width: 100%" placeholder="输入推理URL"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="训练URL" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.trainBaseUrl" style="width: 100%" placeholder="输入训练URL"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="支持设备类型" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.supportedDeviceTypes" style="width: 100%" placeholder="输入设备类型"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="默认超参" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.defaultHyperParams" style="width: 100%" placeholder="输入默认超参"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="版本" style="width: 100%;" >
|
||||||
<el-input v-model="info.version" style="width: 100%" placeholder="输入版本"></el-input>
|
<el-input v-model="info.version" style="width: 100%" placeholder="输入版本"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="算法原理" style="width: 100%;" label-width="80px">
|
<el-form-item label="算法描述" style="width: 100%;" >
|
||||||
<el-input type="textarea" v-model="info.principle" :rows="8" style="width: 100%" placeholder="请输入算法原理"></el-input>
|
<el-input type="textarea" v-model="info.description" :rows="2" style="width: 100%" placeholder="请输入算法描述"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="算法原理" style="width: 100%;" >
|
||||||
|
<el-input type="textarea" v-model="info.principle" :rows="2" style="width: 100%" placeholder="请输入算法原理"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<span class="dialog-footer"
|
<span class="dialog-footer"
|
||||||
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
|
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
|
||||||
|
|||||||
@ -0,0 +1,543 @@
|
|||||||
|
<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 { searchAlgorithmsModelPage} from "@/api/business/algorithmModel";
|
||||||
|
|
||||||
|
import Page from '@/components/Pagination/page.vue'
|
||||||
|
|
||||||
|
import { getDictItemById } from '@/api/dict';
|
||||||
|
const menuData:any = ref([]);
|
||||||
|
const algorithmData: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 queryParams:any = ref({
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
versionTag: '',
|
||||||
|
algorithmType: '',
|
||||||
|
isCurrent: null,
|
||||||
|
deviceType: ''
|
||||||
|
|
||||||
|
});
|
||||||
|
//分页 总条数
|
||||||
|
const total = ref()
|
||||||
|
//定义表格数据
|
||||||
|
|
||||||
|
const tableData: any = ref([]);
|
||||||
|
const multipleSelection = ref([]);
|
||||||
|
// 表格加载
|
||||||
|
const loading = ref(false)
|
||||||
|
function gettableData() {
|
||||||
|
let params = {
|
||||||
|
name: input.value,
|
||||||
|
pageNum: queryParams.value.current,
|
||||||
|
pageSize: queryParams.value.size,
|
||||||
|
versionTag: queryParams.value.versionTag,
|
||||||
|
deviceType: queryParams.value.deviceType,
|
||||||
|
algorithmType: queryParams.value.algorithmType,
|
||||||
|
isCurrent: queryParams.value.isCurrent
|
||||||
|
};
|
||||||
|
loading.value = true;
|
||||||
|
searchAlgorithmsModelPage(params).then((result:any) => {
|
||||||
|
tableData.value = result.records;
|
||||||
|
total.value = result.total;
|
||||||
|
loading.value = false;
|
||||||
|
}).catch((err) => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAlgorithmList() {
|
||||||
|
let params = {
|
||||||
|
name: "",
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 999,
|
||||||
|
};
|
||||||
|
loading.value = true;
|
||||||
|
searchAlgorithmsPage(params).then((result:any) => {
|
||||||
|
algorithmData.value = result.records;
|
||||||
|
}).catch((err) => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//表格多选事件
|
||||||
|
function handleSelectionChange(val: any) {
|
||||||
|
multipleSelection.value = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|
||||||
|
if (!info.value.algorithmId) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
} else if (info.value.algorithmId) {
|
||||||
|
const params = {
|
||||||
|
algorithmId: info.value.algorithmId,
|
||||||
|
name: info.value.name,
|
||||||
|
description: info.value.description,
|
||||||
|
version: info.value.version,
|
||||||
|
principle: info.value.principle,
|
||||||
|
}
|
||||||
|
updateAlgorithms(params).then((res) => {
|
||||||
|
gettableData();
|
||||||
|
dialogVisible.value = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//新建角色-取消按钮
|
||||||
|
function handleClose() {
|
||||||
|
dialogVisible.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 editClick(row: any) {
|
||||||
|
title.value = "修改算法数据";
|
||||||
|
info.value = JSON.parse(JSON.stringify(row));
|
||||||
|
dialogVisible.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() {
|
||||||
|
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
let id = [] as any[];
|
||||||
|
multipleSelection.value.forEach((item: any) => {
|
||||||
|
id.push(item.algorithmId)
|
||||||
|
})
|
||||||
|
let params = {
|
||||||
|
ids: id,
|
||||||
|
};
|
||||||
|
deleteBatchAlgorithms(params.ids).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(() => {
|
||||||
|
menuInit()
|
||||||
|
getAlgorithmList()
|
||||||
|
gettableData();
|
||||||
|
});
|
||||||
|
function changeStatus(row: any) {
|
||||||
|
let params = {
|
||||||
|
algorithmId: row.algorithmId,
|
||||||
|
status: row.status,
|
||||||
|
};
|
||||||
|
updateAlgorithms(params).then((res) => {
|
||||||
|
gettableData();
|
||||||
|
ElMessage({
|
||||||
|
type: "success",
|
||||||
|
message: "更新成功",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const isEchartsModel = ref(false) // 是否显示echarts模型
|
||||||
|
|
||||||
|
function changeShowResult(isShow:boolean){ // 切换显示结果模型
|
||||||
|
isEchartsModel.value = isShow
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="algorithmModel-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; width: 80%;">
|
||||||
|
<el-input v-model="queryParams.versionTag" placeholder="请输入版本号" @keyup.enter="gettableData" style="width: 200px" clearable />
|
||||||
|
<el-select v-model="queryParams.algorithmType" placeholder="请选择算法" style="width: 200px;margin-left: 10px" clearable @change="gettableData">
|
||||||
|
<el-option v-for="item in algorithmData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
|
</el-select>
|
||||||
|
<el-select v-model="queryParams.deviceType" placeholder="请选择设备"style="width: 200px;margin-left: 10px" clearable @change="gettableData">
|
||||||
|
<el-option v-for="item in menuData" :key="item.itemCode" :label="item.dictName + '(' + item.itemCode + ')'" :value="item.itemCode" />
|
||||||
|
</el-select>
|
||||||
|
<el-select v-model="queryParams.isCurrent" placeholder="请选择是否激活"
|
||||||
|
style="width: 200px;margin-left: 10px" clearable @change="gettableData">
|
||||||
|
<el-option key="1" label="是" value="1" />
|
||||||
|
<el-option key="0" label="否" value="0" />
|
||||||
|
</el-select>
|
||||||
|
<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> -->
|
||||||
|
<el-button :type="multipleSelection.length > 0 ? 'primary' : ''"
|
||||||
|
:disabled="multipleSelection.length <= 0" @click="delClick">删除</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 270px);margin-bottom: 10px;" border
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
: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="algorithmType" label="算法类型" width="110"></el-table-column>
|
||||||
|
<el-table-column prop="deviceType" label="设备类型" width="130"></el-table-column>
|
||||||
|
<el-table-column prop="versionTag" label="版本" width="110"></el-table-column>
|
||||||
|
<el-table-column prop="trainedAt" label="训练完成时间" width="170"></el-table-column>
|
||||||
|
<el-table-column prop="modelPath" label="模型文件路径 " min-width="140"></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">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.isCurrent"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
size="small"
|
||||||
|
style="margin-right: 5px"
|
||||||
|
@change="changeStatus(scope.row)"
|
||||||
|
/>
|
||||||
|
<span v-if="scope.row.isCurrent == 1" style="color: #409eff">是</span>
|
||||||
|
<span v-else style="color: #909399;">否</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column fixed="right" label="操作" width="80" 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="editClick(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">
|
||||||
|
<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-item label="算法类型" style="width: 100%;" >
|
||||||
|
<el-select v-model="info.algorithmType" placeholder="请选择算法" style="width: 100%" :disabled="true">
|
||||||
|
<el-option v-for="item in algorithmData" :key="item.algorithmType" :label="item.name" :value="item.algorithmType" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备类型" style="width: 100%;" >
|
||||||
|
<el-select v-model="info.deviceType" placeholder="请选择设备" style="width: 100%" :disabled="true">
|
||||||
|
<el-option v-for="item in menuData" :key="item.itemCode" :label="item.dictName + '(' + item.itemCode + ')'" :value="item.itemCode" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="训练完成时间" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.trainedAt" style="width: 100%" placeholder="请输入训练完成时间" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="模型文件路径" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.modelPath" style="width: 100%" placeholder="输入模型文件路径" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="训练评估指标" style="width: 100%;" >
|
||||||
|
<el-input v-model="info.metrics" style="width: 100%" placeholder="输入训练评估指标" :disabled="true"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="特征图快照" style="width: 100%;" >
|
||||||
|
<el-input type="textarea" :rows="6" v-model="info.featureMapSnapshot" 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="file:///E:/python_coding/keffCenter/models/GPR/CylindricalTank/V1/error.jpg" alt="" style="width: 100%; height: 100%;object-fit:contain;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.algorithmModel-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
|
||||||
|
}
|
||||||
|
.algorithmModel-box .el-button{
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.el-dialog .el-button{
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.algorithmModel-box .el-select__wrapper{
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
.el-dialog .el-select__wrapper{
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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');
|
||||||
|
}
|
||||||
|
.adddevice_navigation_right:hover{
|
||||||
|
color: #266fff ;
|
||||||
|
}
|
||||||
|
.adddevice_navigation_activeright{
|
||||||
|
background-image: url('@/assets/x6/navright_active.png');
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user