Skip to content

Commit 736b82d

Browse files
committed
【功能优化】Bpm:设备日志的展示
1 parent 3d65f1c commit 736b82d

File tree

8 files changed

+32
-14
lines changed

8 files changed

+32
-14
lines changed

src/api/iot/device/device/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ export const DeviceApi = {
151151

152152
// 查询设备日志分页
153153
getDeviceLogPage: async (params: any) => {
154-
// TODO @super:/iot/log-page 或者 /iot/log/page
155-
return await request.get({ url: `/iot/device/data/log/page`, params })
154+
return await request.get({ url: `/iot/device/log/page`, params })
156155
}
157156
}

src/views/iot/device/device/detail/DeviceDataDetail.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- TODO 芋艿:待 review -->
12
<template>
23
<Dialog title="查看数据" v-model="dialogVisible">
34
<ContentWrap>
@@ -57,7 +58,7 @@ import { DeviceApi, DeviceHistoryDataVO, DeviceVO } from '@/api/iot/device/devic
5758
import { ProductVO } from '@/api/iot/product/product'
5859
import { beginOfDay, dateFormatter, endOfDay, formatDate } from '@/utils/formatTime'
5960
60-
const props = defineProps<{ product: ProductVO; device: DeviceVO }>()
61+
defineProps<{ product: ProductVO; device: DeviceVO }>()
6162
6263
/** IoT 设备 数据详情 */
6364
defineOptions({ name: 'IoTDeviceDataDetail' })

src/views/iot/device/device/detail/DeviceDetailsHeader.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- 设备信息(头部) -->
12
<template>
23
<div>
34
<div class="flex items-start justify-between">

src/views/iot/device/device/detail/DeviceDetailsInfo.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- 设备信息 -->
12
<template>
23
<ContentWrap>
34
<el-collapse v-model="activeNames">

src/views/iot/device/device/detail/DeviceDetailsLog.vue

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
<!-- 设备日志 -->
12
<template>
23
<ContentWrap>
34
<!-- 搜索区域 -->
45
<el-form :model="queryParams" inline>
56
<el-form-item>
6-
<el-select v-model="queryParams.type" placeholder="所有" class="!w-120px">
7+
<el-select v-model="queryParams.type" placeholder="所有" class="!w-160px">
78
<el-option label="所有" value="" />
89
<!-- TODO @super:搞成枚举 -->
910
<el-option label="状态" value="state" />
@@ -13,13 +14,22 @@
1314
</el-select>
1415
</el-form-item>
1516
<el-form-item>
16-
<el-input v-model="queryParams.keyword" placeholder="日志识符" class="!w-200px" />
17+
<el-input v-model="queryParams.identifier" placeholder="日志识符" class="!w-200px" />
1718
</el-form-item>
1819
<el-form-item>
1920
<el-button type="primary" @click="handleQuery">
2021
<Icon icon="ep:search" class="mr-5px" /> 搜索
2122
</el-button>
22-
<el-switch v-model="autoRefresh" class="ml-10px" /> 定时刷新
23+
<el-switch
24+
size="large"
25+
width="80"
26+
v-model="autoRefresh"
27+
class="ml-20px"
28+
inline-prompt
29+
active-text="定时刷新"
30+
inactive-text="定时刷新"
31+
style="--el-switch-on-color: #13ce66"
32+
/>
2333
</el-form-item>
2434
</el-form>
2535

@@ -31,7 +41,8 @@
3141
</template>
3242
</el-table-column>
3343
<el-table-column label="类型" align="center" prop="type" width="120" />
34-
<el-table-column label="名称(标识符)" align="center" prop="subType" width="120" />
44+
<!-- TODO @super:标识符需要翻译 -->
45+
<el-table-column label="标识符" align="center" prop="identifier" width="120" />
3546
<el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true" />
3647
</el-table>
3748

@@ -55,21 +66,19 @@ const props = defineProps<{
5566
deviceKey: string
5667
}>()
5768
58-
//TODO:后续看看使用什么查询条件 目前后端是留了时间范围 type subType
5969
// 查询参数
6070
const queryParams = reactive({
6171
deviceKey: props.deviceKey,
62-
// type: '',
63-
// keyword: '',
72+
type: '',
73+
identifier: '',
6474
pageNo: 1,
6575
pageSize: 10
6676
})
6777
6878
// 列表数据
6979
const loading = ref(false)
7080
const total = ref(0)
71-
// TODO @super:字段的风格,还是类似一般 table 见面哈
72-
const logList = ref([])
81+
const logList = ref([]) // TODO @super:logList -> list,简洁一点。因为当前就一个 table 哈
7382
const autoRefresh = ref(false)
7483
let timer: any = null // TODO @super:autoRefreshEnable,autoRefreshTimer;对应上
7584
@@ -140,7 +149,7 @@ watch(autoRefresh, (newValue) => {
140149
}
141150
})
142151
143-
/** 监听设备 ID 变化 */
152+
/** 监听设备标识变化 */
144153
watch(
145154
() => props.deviceKey,
146155
(newValue) => {

src/views/iot/device/device/detail/DeviceDetailsModel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- 设备物模型:运行状态(属性)、事件管理、服务调用 -->
12
<template>
23
<ContentWrap>
34
<el-tabs v-model="activeTab">

src/views/iot/device/device/detail/DeviceDetailsSimulator.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- 模拟设备 -->
12
<template>
23
<ContentWrap>
34
<el-row :gutter="20">
@@ -17,9 +18,11 @@
1718
:stripe="true"
1819
>
1920
<!-- TODO @super:每个 colum 搞下宽度,避免 table 每一列最后有个 . -->
21+
<!-- TODO @super:可以左侧 fixed -->
2022
<el-table-column align="center" label="功能名称" prop="name" />
2123
<el-table-column align="center" label="标识符" prop="identifier" />
2224
<el-table-column align="center" label="数据类型" prop="identifier">
25+
<!-- TODO @super:不用翻译,可以减少宽度的占用 -->
2326
<template #default="{ row }">
2427
{{ dataTypeOptionsLabel(row.property?.dataType) ?? '-' }}
2528
</template>
@@ -76,6 +79,7 @@
7679
{{ `${item.name}-${item.value}` }}
7780
</div>
7881
</div>
82+
<!-- TODO @super:要不要兜底下,没翻译的类型,直接展示 json? -->
7983
</template>
8084
<!-- 服务 -->
8185
<div v-if="row.type === ThingModelType.SERVICE">
@@ -87,12 +91,14 @@
8791
</div>
8892
</template>
8993
</el-table-column>
94+
<!-- TODO @super:可以右侧 fixed -->
9095
<el-table-column label="" align="center" width="80">
9196
<template #default="scope">
9297
<el-input v-model="scope.row.simulateValue" class="!w-60px" />
9398
</template>
9499
</el-table-column>
95100
</el-table>
101+
<!-- TODO @super:发送按钮,可以放在右侧哈。因为我们的 simulateValue 就在最右侧 -->
96102
<div class="mt-10px">
97103
<el-button
98104
type="primary"
@@ -109,6 +115,7 @@
109115
<!-- TODO @super:待实现 -->
110116
<el-tab-pane label="事件上报" name="event">
111117
<ContentWrap>
118+
<!-- TODO @super:因为事件是每个 event 去模拟,而不是类似属性的批量上传。所以,可以每一列后面有个“模拟”按钮。另外,“值”使用 textarea,高度 3 -->
112119
<!-- <el-table v-loading="loading" :data="eventList" :stripe="true">
113120
<el-table-column label="功能名称" align="center" prop="name" />
114121
<el-table-column label="标识符" align="center" prop="identifier" />

src/views/iot/device/device/detail/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<el-tab-pane label="子设备管理" v-if="product.deviceType === DeviceTypeEnum.GATEWAY" />
1818
<el-tab-pane label="设备影子" />
1919
<el-tab-pane label="设备日志" name="log">
20-
<!-- TODO @super:字段类型,:device-key。idea 会告警,应该是 string -->
2120
<DeviceDetailsLog v-if="activeTab === 'log'" :device-key="device.deviceKey" />
2221
</el-tab-pane>
2322
<el-tab-pane label="模拟设备" name="simulator">

0 commit comments

Comments
 (0)