diff --git a/src/api/detail.js b/src/api/detail.js
index d9f4294..2cc4dfe 100644
--- a/src/api/detail.js
+++ b/src/api/detail.js
@@ -102,6 +102,24 @@ export const robotApi = {
url: `/api/v1/events/alertFront/${messageId}`,
method: 'get',
})
+ },
+ // 查看全部告警事件接口
+ getAlarmEventList: (number) => {
+ return service({
+ url: `/api/v1/events/getAllAlertMessage/${number}`,
+ method: 'get',
+ })
+ },
+ // 查看全部告警事件接口(支持分页)
+ getAlarmDetailList: (params) => {
+ return service({
+ url: `/api/v1/events/getAllAlertMessage/${params.number}`,
+ method: 'get',
+ params: {
+ offset: params.offset,
+ limit: params.limit
+ }
+ })
}
}
diff --git a/src/assets/img/empty_robot.png b/src/assets/img/empty_robot.png
new file mode 100644
index 0000000..6571382
Binary files /dev/null and b/src/assets/img/empty_robot.png differ
diff --git a/src/components/RobotStatusList.vue b/src/components/RobotStatusList.vue
index c8a4628..06de22b 100644
--- a/src/components/RobotStatusList.vue
+++ b/src/components/RobotStatusList.vue
@@ -7,9 +7,9 @@
type="text"
placeholder="请输入机器人搜索"
v-model="searchText"
- @input="handleSearchInput"
+ @keyup.enter="handleSearchInput"
>
-
+
重试
-
-
🔍
-
没有找到机器人
+
+
@@ -68,10 +70,23 @@ import { ref, onMounted, onUnmounted, computed, watch } from 'vue'
import { useRouter } from 'vue-router'
import BatteryIndicator from './common/BatteryIndicator.vue'
import CustomSelect from './common/CustomSelect.vue'
+import EmptyState from './common/EmptyState.vue'
import { homeApi } from '../api/index'
+import emptyRobot from '../assets/img/empty_robot.png'
const router = useRouter()
+// 防抖函数
+const debounce = (fn, delay) => {
+ let timer = null
+ return function(...args) {
+ if (timer) clearTimeout(timer)
+ timer = setTimeout(() => {
+ fn.apply(this, args)
+ }, delay)
+ }
+}
+
// 搜索和筛选
const searchText = ref('')
const filterOptions = ['全部', '在线', '离线', '故障']
@@ -83,14 +98,14 @@ const loading = ref(false)
const error = ref(null)
// 获取机器人列表
-const fetchRobotList = async () => {
+const fetchRobotList = async (searchNumber = null) => {
loading.value = true
error.value = null
try {
const res = await homeApi.getRobotList({
tenantInfoId: '4fff5d4bcc4b4239941ff077a0da8958', // 租户id
- number: null, // 机器人名
+ number: searchNumber, // 机器人名,用于搜索
status: null, // 是否故障
onlineStatus: null // 在线状态
})
@@ -210,8 +225,9 @@ const groupedRobots = computed(() => {
return grouped.filter(group => group.robots.length > 0)
})
-const handleSearchInput = (e) => {
- searchText.value = e.target.value
+const handleSearchInput = () => {
+ console.log('点击搜索:', searchText.value)
+ searchRobots()
}
const handleWheel = (e) => {
@@ -258,7 +274,14 @@ onUnmounted(() => {
// 监听筛选条件变化,重新获取数据
watch(selectedFilter, () => {
console.log('筛选条件变化:', selectedFilter.value)
+ searchRobots() // 重新搜索,应用筛选条件
})
+
+// 搜索机器人
+const searchRobots = () => {
+ console.log('搜索机器人:', searchText.value)
+ fetchRobotList(searchText.value)
+}
\ No newline at end of file
diff --git a/src/components/common/CustomSelect.vue b/src/components/common/CustomSelect.vue
index 7b3a3d2..415284f 100644
--- a/src/components/common/CustomSelect.vue
+++ b/src/components/common/CustomSelect.vue
@@ -53,6 +53,10 @@ const props = defineProps({
variant: {
type: String,
default: 'default' // 可选值:'default', 'search'
+ },
+ font: {
+ type: String,
+ default: 'default' // 可选值:'default', 'small'
}
})
@@ -108,6 +112,7 @@ const selectOption = (option) => {
.select-text {
color: #B9E8FF;
margin-right: 25px;
+ font-size: v-bind("font === 'small' ? '12px' : '14px'");
}
.arrow-icon {
@@ -137,7 +142,7 @@ const selectOption = (option) => {
color: #B9E8FF;
cursor: pointer;
white-space: nowrap;
- font-size: v-bind("size === 'small' ? '12px' : '12px'");
+ font-size: v-bind("font === 'small' ? '12px' : '12px'");
line-height: v-bind("size === 'small' ? '18px' : '20px'");
}
diff --git a/src/components/common/TitleBlock.vue b/src/components/common/TitleBlock.vue
index fdd7b59..904c8b9 100644
--- a/src/components/common/TitleBlock.vue
+++ b/src/components/common/TitleBlock.vue
@@ -14,7 +14,7 @@ import small_title from '../../assets/img/small_title.png';
const props = defineProps({
title: String
});
-console.log(props.title,"--------------");
+
const titleBgSrc = computed(() => {
if (props.title === '最新告警') {
return title2;
diff --git a/src/components/dialog/AlarmDetailModal.vue b/src/components/dialog/AlarmDetailModal.vue
index 722da8c..faa5983 100644
--- a/src/components/dialog/AlarmDetailModal.vue
+++ b/src/components/dialog/AlarmDetailModal.vue
@@ -164,8 +164,8 @@
@@ -271,15 +271,17 @@ const updateRemark = (e) => {