update code

main
haha 2024-07-06 22:58:31 +08:00
parent e77b7c344a
commit ca6becb79e
9 changed files with 511 additions and 95 deletions

View File

@ -49,6 +49,6 @@ export default {
add, add,
deleteConnect, deleteConnect,
detail, detail,
updatAll updatAll,
updateInfo updateInfo
} }

View File

@ -0,0 +1,70 @@
import request from "@/utils/request";
//获取硬件类型列表
const cmptHardwareType=()=>{
return request({
url: `/const/cmpt_hardware_type`,
method: "get"
});
}
//获取推理任务类型
const infrTaskType=()=>{
return request({
url: `/const/infr_task_type`,
method: "get"
});
}
//获取模型文件类型列表
const modlFileType=()=>{
return request({
url: `/const/modl_file_type`,
method: "get"
});
}
//获取模型框架名称列表
const modlFramework=()=>{
return request({
url: `/const/modl_framework`,
method: "get"
});
}
//获取模型主类型和子类型列表
const modlMainType=()=>{
return request({
url: `/const/modl_main_type`,
method: "get"
});
}
//获取模型网络类型列表
const modlNetType=()=>{
return request({
url: `/const/modl_net_type`,
method: "get"
});
}
//获取算子主类型列表
const operMainType=()=>{
return request({
url: `/const/oper_main_type`,
method: "get"
});
}
//获取用户权限类型
const userRole=()=>{
return request({
url: `/const/user_role`,
method: "get"
});
}
export default {
cmptHardwareType,
infrTaskType,
modlFileType,
modlFramework,
modlMainType,
modlNetType,
operMainType,
userRole
}

View File

@ -5,7 +5,14 @@ const serverState=()=>{
method: "get" method: "get"
}); });
} }
//获取用户操作状态通知
const userOperationNotice=()=>{
return request({
url: "/logs/user_operation/notice",
method: "get"
});
}
export default { export default {
serverState serverState,
userOperationNotice
} }

View File

@ -0,0 +1,58 @@
import request from "@/utils/request";
//获取模型列表
const list=(data)=>{
return request({
url: `/models`,
method: "get",
params:data
});
}
//创建模型
const add=(data)=>{
return request({
url: `/models`,
method: "post",
data:data
});
}
//创建模型
const deleteModel=(id)=>{
return request({
url: `/models/${id}`,
method: "delete"
});
}
//获取模型详细信息
const findOne=(id)=>{
return request({
url: `/models/${id}`,
method: "get"
});
}
//获取模型适配的算子信息
const adaptOperators=(id)=>{
return request({
url: `/models/${id}/adapt_operators`,
method: "get"
});
}
//请求下载模型文件
const download=(id)=>{
return request({
url: `/models/${id}/download`,
method: "get"
});
}
export default {
list,
add,
deleteModel,
findOne,
adaptOperators,
download
}

View File

@ -1,33 +1,32 @@
<template> <template>
<div class="index-notice"> <div class="index-notice" v-if="loadNotice!=null">
<div v-for="(it,idx) in noticeList" :key="idx" class="notice-item"> <div v-for="(it,idx) in noticeList" :key="idx" class="notice-item">
<div style="font-size: 12px;color: #333;"> <div style="font-size: 12px;color: #333;" v-if="1==2">
<svg-icon class="icon-info" icon-class="info" v-if="it.type=='info'" color="orange"></svg-icon> <svg-icon class="icon-info" icon-class="info" v-if="it.type=='info'" color="orange"></svg-icon>
<svg-icon class="icon-warn" icon-class="warn" v-if="it.type=='warn'" color="red"></svg-icon> <svg-icon class="icon-warn" icon-class="warn" v-if="it.type=='warn'" color="red"></svg-icon>
{{ it.type=="info"?"系统信息":"告警信息" }} {{ it.type=="info"?"系统信息":"告警信息" }}
</div> </div>
<div style="color: #666;padding: 0px 12px;"> <div style="color: #666;padding: 0px 12px;">
{{ it.msg }} {{ it.operation_result }}
</div> </div>
<div style="text-align: right;color: #666;padding:0px 12px;border-bottom: solid 1px #eee;"> <div style="text-align: right;color: #666;padding:0px 12px;border-bottom: solid 1px #eee;">
{{ it.date }} {{ it.update_time }}
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang='ts' setup> <script lang='ts' setup>
import {reactive} from 'vue' import LogApi from '@/api/log'
let noticeList=reactive([ let noticeList=ref<any>(null);
{ type:'info',msg:'用户王大山修改了密码',date:'2024-05-12'}, const loadNotice=()=>{
{ type:'info',msg:'用户王大山修改了密码',date:'2024-05-12'}, LogApi.userOperationNotice().then(d=>{
{ type:'warn',msg:'设备abc服务器异常中断',date:'2024-05-12'}, noticeList.value=d.data?.data?.operation_notice_list||[]
{ type:'warn',msg:'设备abc服务器异常中断',date:'2024-05-12'}, })
{ type:'info',msg:'用户王大山修改了密码',date:'2024-05-12'}, }
{ type:'warn',msg:'设备abc服务器异常中断',date:'2024-05-12'}, onMounted(()=>{
{ type:'warn',msg:'设备abc服务器异常中断',date:'2024-05-12'}, loadNotice();
{ type:'info',msg:'用户王大山修改了密码',date:'2024-05-12'}, });
])
</script> </script>
<style lang='scss'> <style lang='scss'>
.index-notice{ .index-notice{

View File

@ -9,23 +9,23 @@
<div class="chart-bar"> <div class="chart-bar">
<div class="bar-title">内存</div> <div class="bar-title">内存</div>
<div class="chart-line"> <div class="chart-line">
<div class="chart-line-inner" :style="'width:'+serverInfo.memory_usage*100.0/16.0/1024.0+'%'"></div> <div class="chart-line-inner" :style="'width:'+serverInfo.memory_usage*100.0/serverInfo.memory_total+'%'"></div>
</div> </div>
<div class="bar-title">75%</div> <div class="bar-title">{{serverInfo.memory_usage*100.0/serverInfo.memory_total}}%</div>
</div> </div>
<div class="chart-bar"> <div class="chart-bar">
<div class="bar-title">CPU</div> <div class="bar-title">CPU</div>
<div class="chart-line"> <div class="chart-line">
<div class="chart-line-inner" :style="'width:'+serverInfo.cpu_usage+'%'"></div> <div class="chart-line-inner" :style="'width:'+serverInfo.cpu_usage+'%'"></div>
</div> </div>
<div class="bar-title">45%</div> <div class="bar-title"> {{serverInfo.cpu_usage}}% </div>
</div> </div>
<div class="chart-bar"> <div class="chart-bar">
<div class="bar-title">硬盘</div> <div class="bar-title">硬盘</div>
<div class="chart-line"> <div class="chart-line">
<div class="chart-line-inner" :style="'width:'+serverInfo.storage_usage+'%'"></div> <div class="chart-line-inner" :style="'width:'+serverInfo.storage_usage+'%'"></div>
</div> </div>
<div class="bar-title">65%</div> <div class="bar-title">{{serverInfo.storage_usage}}%</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -120,6 +120,7 @@ import ServiceStatus from './components/ServiceStatus.vue'
import DeviceAPI from "@/api/device"; import DeviceAPI from "@/api/device";
import InfoApi from '@/api/info' import InfoApi from '@/api/info'
let svTemp = ref(55.5) let svTemp = ref(55.5)
let rd = () => { return +("" + Math.random()).substring(3, 5) }; let rd = () => { return +("" + Math.random()).substring(3, 5) };
let rd2 = () => { return +("" + Math.random()).substring(3, 4) }; let rd2 = () => { return +("" + Math.random()).substring(3, 4) };
@ -173,6 +174,7 @@ const loadInfo=()=>{
}) })
} }
onMounted(() => { onMounted(() => {
winWidth.value = window.outerWidth; winWidth.value = window.outerWidth;
window.onresize = () => { window.onresize = () => {
@ -182,7 +184,7 @@ onMounted(() => {
} }
loadDevice(); loadDevice();
loadInfo(); loadInfo();
}); });
</script> </script>

View File

@ -5,7 +5,7 @@
<el-button type="primary" @click="doUploadModel" ><i-ep-plus />上传模型</el-button> <el-button type="primary" @click="doUploadModel" ><i-ep-plus />上传模型</el-button>
<el-form ref="queryFormRef" :model="queryParams" :inline="true" style="flex-grow: 1;text-align: right;"> <el-form ref="queryFormRef" :model="queryParams" :inline="true" style="flex-grow: 1;text-align: right;">
<el-form-item label="" prop="keywords"> <el-form-item label="" prop="keywords">
<el-input v-model="queryParams.keywords" placeholder="请输入模型名称" clearable style="width: 200px" <el-input v-model="queryParams.model_name" placeholder="请输入模型名称" clearable style="width: 200px"
@keyup.enter="handleQuery" /> @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -20,13 +20,13 @@
<el-card shadow="never" class="table-container"> <el-card shadow="never" class="table-container">
<el-table v-loading="loading" :data="tableData" stripe @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tableData" stripe @selection-change="handleSelectionChange">
<el-table-column label="模型名称" align="left" prop="name" width="300"/> <el-table-column label="模型名称" align="left" prop="model_name" width="300"/>
<el-table-column label="网络名称" align="left" prop="netName" /> <el-table-column label="网络名称" align="left" prop="model_network" />
<el-table-column label="模型类型" align="left" prop="modelType" /> <el-table-column label="模型类型" align="left" prop="modl_sub_type_name" />
<el-table-column label="版本" align="left" prop="ver" /> <el-table-column label="版本" align="left" prop="model_version" />
<el-table-column label="说明" width="300" align="left" prop="desc" /> <el-table-column label="说明" width="300" align="left" prop="model_desc" />
<el-table-column label="上传时间" width="120" align="left" prop="upTime" /> <el-table-column label="上传时间" width="120" align="left" prop="create_time" />
<el-table-column label="上传用户" width="100" align="left" prop="upUser" /> <el-table-column label="上传用户" width="100" align="left" prop="user_name" />
<el-table-column label="操作" fixed="right" width="250"> <el-table-column label="操作" fixed="right" width="250">
<template #default="scope"> <template #default="scope">
<el-button text type="primary" size="small" <el-button text type="primary" size="small"
@ -50,6 +50,7 @@ defineOptions({
name: "calculateIndex", name: "calculateIndex",
inheritAttrs: false, inheritAttrs: false,
}); });
import ModelApi from '@/api/models'
import { UserQuery } from "@/api/user/model"; import { UserQuery } from "@/api/user/model";
@ -58,12 +59,13 @@ const router = useRouter();
const loading = ref(false); // const loading = ref(false); //
const removeIds = ref([]); // ID const removeIds = ref([]); // ID
const queryParams = reactive<UserQuery>({ let queryParams = reactive<any>({
pageNum: 1, page_num: 1,
pageSize: 10, page_size: 10,
model_name:''
}); });
const dateTimeRange = ref(""); const dateTimeRange = ref("");
const total = ref(100); // let total = ref(100); //
watch(dateTimeRange, (newVal) => { watch(dateTimeRange, (newVal) => {
if (newVal) { if (newVal) {
@ -72,61 +74,13 @@ watch(dateTimeRange, (newVal) => {
} }
}); });
const tableData = [ let tableData = ref([])
{
id:"1",
name: "模型名称模型名称模型名称查看",
netName: "VIT",
modelType: "图像分类",
desc:'进行10种类型 的目标分类模型查看',
ver: "1.0",
upTime: "2024-02-02",
upUser:'USER'
},
{
id:"2",
name: "模型名称模型名称模型名称查看",
netName: "Mobile-VIT",
modelType: "图像分类",
ver: "1.0",
desc:'进行10种类型 的目标分类模型查看',
upTime: "2024-02-02",
upUser:'USER'
},
{
id:"3",
name: "模型名称模型名称模型名称查看",
netName: "VIT",
modelType: "图像分类",
ver: "1.0",
desc:'进行人员检测的模型',
upTime: "2024-02-02",
upUser:'USER'
},
{
id:"4",
name: "模型名称模型名称模型名称查看",
netName: "Mobile-VIT",
modelType: "图像分类",
ver: "1.0",
desc:'进行10种类型 的目标分类模型查看',
upTime: "2024-02-02",
upUser:'USER'
},
{
id:"5",
name: "模型名称模型名称模型名称查看",
netName: "VIT",
modelType: "图像分类",
ver: "1.0",
desc:'进行人员检测的模型',
upTime: "2024-02-02",
upUser:'USER'
}
];
/** 查询 */ /** 查询 */
function handleQuery() { function handleQuery() {
ModelApi.list(queryParams).then(d=>{
total.value=d.data.data.total||0;
tableData.value=d.data.data.model_list||[];
});
loading.value = true; loading.value = true;
ElMessage.success("查询成功"); ElMessage.success("查询成功");
loading.value = false; loading.value = false;
@ -141,16 +95,14 @@ function doUploadModel(){
function resetQuery() { function resetQuery() {
queryFormRef.value.resetFields(); queryFormRef.value.resetFields();
dateTimeRange.value = ""; dateTimeRange.value = "";
queryParams.pageNum = 1; queryParams.page_num = 1;
queryParams.deptId = undefined; queryParams.model_name='';
queryParams.startTime = undefined;
queryParams.endTime = undefined;
handleQuery(); handleQuery();
} }
/** 行选中 */ /** 行选中 */
function handleSelectionChange(selection: any) { function handleSelectionChange(selection: any) {
removeIds.value = selection.map((item: any) => item.id); removeIds.value = selection.map((item: any) => item.model_id);
} }
/** 删除数据 */ /** 删除数据 */
@ -165,7 +117,7 @@ function handleDelete(row: { [key: string]: any }) {
} }
const doShowModelDetail=(row:any)=>{ const doShowModelDetail=(row:any)=>{
router.replace({path:"/modelMgr/modelDetail",query:{id:row.id,from:'model'}}) router.replace({path:"/modelMgr/modelDetail",query:{id:row.model_id,from:'model'}})
} }
/** /**
* 打开弹窗 * 打开弹窗
@ -188,7 +140,7 @@ function handleExport() {
} }
onMounted(() => { onMounted(() => {
//handleQuery(); handleQuery();
}); });
</script> </script>

File diff suppressed because one or more lines are too long