Forráskód Böngészése

feat: 告警历史新增设备id搜索与回显;

liujia 1 hónapja
szülő
commit
e54e7ae
2 módosított fájl, 21 hozzáadás és 1 törlés
  1. 7 0
      src/views/alarm/history/const.ts
  2. 14 1
      src/views/alarm/history/index.vue

+ 7 - 0
src/views/alarm/history/const.ts

@@ -1,5 +1,12 @@
 export const columns = [
   {
+    title: '设备ID',
+    dataIndex: 'clientId',
+    key: 'createTime',
+    align: 'center',
+    width: 200,
+  },
+  {
     title: '发生时间',
     dataIndex: 'createTime',
     key: 'createTime',

+ 14 - 1
src/views/alarm/history/index.vue

@@ -2,6 +2,16 @@
   <div class="alarmHistoryPage">
     <div class="searchBar">
       <a-form layout="inline" @keydown.enter="searchHandler">
+        <a-form-item label="设备ID">
+          <a-input
+            v-model:value.trim="searchState.clientId"
+            placeholder="设备ID"
+            :maxlength="12"
+            show-count
+            allow-clear
+          />
+        </a-form-item>
+
         <a-form-item label="创建时间">
           <range-picker
             v-model:start="searchState.createTimeStart"
@@ -92,7 +102,7 @@
       :data="alarmPlanDataWithType"
       :area="{
         width: 400,
-        height: 400,
+        length: 400,
         ranges: [-200, 200, -200, 200],
       }"
       @success="fetchList"
@@ -124,6 +134,7 @@ interface SearchData {
   createTimeEnd: string // 创建时间结束
   type?: ID // 事件类型 一般滞留
   eventType?: ID // 事件类型 异常滞留
+  clientId?: ID // 设备ID
 }
 
 const defaultSearch: SearchData = {
@@ -131,6 +142,7 @@ const defaultSearch: SearchData = {
   createTimeEnd: '',
   type: null,
   eventType: null,
+  clientId: null,
 }
 
 const [searchState, resetHandler] = useSearch(defaultSearch, { afterReset: () => searchHandler() })
@@ -186,6 +198,7 @@ const fetchList = async () => {
       createTimeStart: searchState.createTimeStart,
       createTimeEnd: searchState.createTimeEnd,
       eventType: searchState.eventType as ID,
+      clientId: searchState.clientId,
     })
     console.log('✅ 获取告警统计数据成功', res)
     const { rows, total } = res.data