实现所有监控展示

This commit is contained in:
2025-10-20 16:31:16 +08:00
parent 0cddf99456
commit b1a8611554
18 changed files with 1539 additions and 21 deletions

View File

@@ -53,6 +53,70 @@
<el-icon><Document /></el-icon>
<template #title>设备命令日志</template>
</el-menu-item>
<el-menu-item index="/monitor/feed-usage-records">
<el-icon><Food /></el-icon>
<template #title>饲料使用记录</template>
</el-menu-item>
<el-menu-item index="/monitor/medication-logs">
<el-icon><FirstAidKit /></el-icon>
<template #title>用药记录</template>
</el-menu-item>
<el-menu-item index="/monitor/pending-collections">
<el-icon><Clock /></el-icon>
<template #title>待采集请求</template>
</el-menu-item>
<el-menu-item index="/monitor/pig-batch-logs">
<el-icon><Files /></el-icon>
<template #title>猪批次日志</template>
</el-menu-item>
<el-menu-item index="/monitor/pig-purchases">
<el-icon><ShoppingCart /></el-icon>
<template #title>猪只采购记录</template>
</el-menu-item>
<el-menu-item index="/monitor/pig-sales">
<el-icon><SoldOut /></el-icon>
<template #title>猪只售卖记录</template>
</el-menu-item>
<el-menu-item index="/monitor/pig-sick-logs">
<el-icon><Warning /></el-icon>
<template #title>病猪日志</template>
</el-menu-item>
<el-menu-item index="/monitor/pig-transfer-logs">
<el-icon><Switch /></el-icon>
<template #title>猪只迁移日志</template>
</el-menu-item>
<el-menu-item index="/monitor/plan-execution-logs">
<el-icon><List /></el-icon>
<template #title>计划执行日志</template>
</el-menu-item>
<el-menu-item index="/monitor/raw-material-purchases">
<el-icon><Shop /></el-icon>
<template #title>原料采购记录</template>
</el-menu-item>
<el-menu-item index="/monitor/raw-material-stock-logs">
<el-icon><Coin /></el-icon>
<template #title>原料库存日志</template>
</el-menu-item>
<el-menu-item index="/monitor/sensor-data">
<el-icon><DataLine /></el-icon>
<template #title>传感器数据</template>
</el-menu-item>
<el-menu-item index="/monitor/task-execution-logs">
<el-icon><Finished /></el-icon>
<template #title>任务执行日志</template>
</el-menu-item>
<el-menu-item index="/monitor/user-action-logs">
<el-icon><User /></el-icon>
<template #title>用户操作日志</template>
</el-menu-item>
<el-menu-item index="/monitor/weighing-batches">
<el-icon><ScaleToOriginal /></el-icon>
<template #title>批次称重记录</template>
</el-menu-item>
<el-menu-item index="/monitor/weighing-records">
<el-icon><ScaleToOriginal /></el-icon>
<template #title>单次称重记录</template>
</el-menu-item>
</el-sub-menu>
</el-menu>
@@ -101,22 +165,16 @@
<script>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { House, Monitor, Calendar, ArrowDown, Menu, Fold, Expand, Setting, Tickets, DataAnalysis, Document } from '@element-plus/icons-vue';
import {
House, Monitor, Calendar, ArrowDown, Menu, Fold, Expand, Setting, Tickets, DataAnalysis, Document, Food,
FirstAidKit, Clock, Files, ShoppingCart, SoldOut, Warning, Switch, List, Shop, Coin, DataLine, Finished, User, ScaleToOriginal
} from '@element-plus/icons-vue';
export default {
name: 'MainLayout',
components: {
House,
Monitor,
Calendar,
ArrowDown,
Menu,
Fold,
Expand,
Setting,
Tickets,
DataAnalysis,
Document
House, Monitor, Calendar, ArrowDown, Menu, Fold, Expand, Setting, Tickets, DataAnalysis, Document, Food,
FirstAidKit, Clock, Files, ShoppingCart, SoldOut, Warning, Switch, List, Shop, Coin, DataLine, Finished, User, ScaleToOriginal
},
setup() {
const route = useRoute();
@@ -124,7 +182,6 @@ export default {
const isCollapse = ref(false);
const username = ref(localStorage.getItem('username') || '管理员');
// 监听localStorage变化实时更新用户名
const handleStorageChange = () => {
username.value = localStorage.getItem('username') || '管理员';
};
@@ -157,15 +214,31 @@ export default {
'/devices': '设备管理',
'/device-templates': '设备模板管理',
'/plans': '计划管理',
'/monitor/device-command-logs': '设备命令日志'
'/monitor/device-command-logs': '设备命令日志',
'/monitor/feed-usage-records': '饲料使用记录',
'/monitor/medication-logs': '用药记录',
'/monitor/pending-collections': '待采集请求',
'/monitor/pig-batch-logs': '猪批次日志',
'/monitor/pig-purchases': '猪只采购记录',
'/monitor/pig-sales': '猪只售卖记录',
'/monitor/pig-sick-logs': '病猪日志',
'/monitor/pig-transfer-logs': '猪只迁移日志',
'/monitor/plan-execution-logs': '计划执行日志',
'/monitor/raw-material-purchases': '原料采购记录',
'/monitor/raw-material-stock-logs': '原料库存日志',
'/monitor/sensor-data': '传感器数据',
'/monitor/task-execution-logs': '任务执行日志',
'/monitor/user-action-logs': '用户操作日志',
'/monitor/weighing-batches': '批次称重记录',
'/monitor/weighing-records': '单次称重记录',
};
return routeMap[route.path] || '猪场管理系统';
});
const logout = () => {
localStorage.removeItem('jwt_token');
localStorage.removeItem('username'); // 清除用户名
username.value = '管理员'; // 重置显示
localStorage.removeItem('username');
username.value = '管理员';
router.push('/login');
};