Skip to content

Commit 7be9c3e

Browse files
committed
【代码优化】IoT:去除 Simulation 关键字,定义更清晰
1 parent d27cb80 commit 7be9c3e

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ export enum DeviceStateEnum {
5656
OFFLINE = 2 // 离线
5757
}
5858

59-
// IoT 模拟设备上行数据 Request VO
60-
export interface IotDeviceSimulationUpstreamReqVO {
59+
// IoT 设备上行 Request VO
60+
export interface IotDeviceUpstreamReqVO {
6161
id: number // 设备编号
6262
type: string // 消息类型
6363
identifier: string // 标识符
6464
data: any // 请求参数
6565
}
6666

67-
// IoT 模拟设备下行数据 Request VO
68-
export interface IotDeviceSimulationDownstreamReqVO {
67+
// IoT 设备下行 Request VO
68+
export interface IotDeviceDownstreamReqVO {
6969
id: number // 设备编号
7070
type: string // 消息类型
7171
identifier: string // 标识符
@@ -129,14 +129,14 @@ export const DeviceApi = {
129129
return await request.download({ url: `/iot/device/get-import-template` })
130130
},
131131

132-
// 模拟设备上行
133-
simulationDeviceUpstream: async (data: IotDeviceSimulationUpstreamReqVO) => {
134-
return await request.post({ url: `/iot/device/simulation-upstream`, data })
132+
// 设备上行
133+
upstreamDevice: async (data: IotDeviceUpstreamReqVO) => {
134+
return await request.post({ url: `/iot/device/upstream`, data })
135135
},
136136

137-
// 模拟设备下行
138-
simulationDeviceDownstream: async (data: IotDeviceSimulationDownstreamReqVO) => {
139-
return await request.post({ url: `/iot/device/simulation-downstream`, data })
137+
// 设备下行
138+
downstreamDevice: async (data: IotDeviceDownstreamReqVO) => {
139+
return await request.post({ url: `/iot/device/downstream`, data })
140140
},
141141

142142
// 获取设备属性最新数据

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,7 @@
100100
</el-table>
101101
<!-- TODO @super:发送按钮,可以放在右侧哈。因为我们的 simulateValue 就在最右侧 -->
102102
<div class="mt-10px">
103-
<el-button
104-
type="primary"
105-
@click="handlePropertyReport"
106-
v-hasPermi="['iot:device:simulation']"
107-
>
108-
发送
109-
</el-button>
103+
<el-button type="primary" @click="handlePropertyReport"> 发送 </el-button>
110104
</div>
111105
</ContentWrap>
112106
</el-tab-pane>
@@ -331,7 +325,7 @@ const handlePropertyReport = async () => {
331325
})
332326
333327
try {
334-
await DeviceApi.simulationDeviceUpstream({
328+
await DeviceApi.upstreamDevice({
335329
id: props.device.id,
336330
type: 'property',
337331
identifier: 'report',
@@ -375,7 +369,7 @@ const handlePropertyReport = async () => {
375369
/** 处理设备状态 */
376370
const handleDeviceState = async (state: number) => {
377371
try {
378-
await DeviceApi.simulationDeviceUpstream({
372+
await DeviceApi.upstreamDevice({
379373
id: props.device.id,
380374
type: 'state',
381375
identifier: 'report',

0 commit comments

Comments
 (0)