Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c73a672
authored
Jan 29, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能修改】IoT:设备状态从 status 到 state,移除已禁用
parent
b9193dd8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
31 deletions
+22
-31
src/api/iot/device/device/index.ts
+3
-14
src/utils/dict.ts
+3
-3
src/views/iot/device/device/detail/DeviceDetailsInfo.vue
+3
-3
src/views/iot/device/device/index.vue
+13
-11
No files found.
src/api/iot/device/device/index.ts
View file @
3c73a672
...
...
@@ -10,10 +10,9 @@ export interface DeviceVO {
deviceType
:
number
// 设备类型
nickname
:
string
// 设备备注名称
gatewayId
:
number
// 网关设备 ID
status
:
number
// 设备状态
statusLastUpdateTime
:
Date
// 设备状态最后更新时间
lastOnlineTime
:
Date
// 最后上线时间
lastOfflineTime
:
Date
// 最后离线时间
state
:
number
// 设备状态
onlineTime
:
Date
// 最后上线时间
offlineTime
:
Date
// 最后离线时间
activeTime
:
Date
// 设备激活时间
createTime
:
Date
// 创建时间
ip
:
string
// 设备的 IP 地址
...
...
@@ -31,11 +30,6 @@ export interface DeviceVO {
groupIds
?:
number
[]
// 添加分组 ID
}
export
interface
DeviceUpdateStatusVO
{
id
:
number
// 设备 ID,主键,自增
status
:
number
// 设备状态
}
// IoT 设备数据 VO
export
interface
DeviceDataVO
{
deviceId
:
number
// 设备编号
...
...
@@ -93,11 +87,6 @@ export const DeviceApi = {
return
await
request
.
put
({
url
:
`/iot/device/update`
,
data
})
},
// 修改设备状态
updateDeviceStatus
:
async
(
data
:
DeviceUpdateStatusVO
)
=>
{
return
await
request
.
put
({
url
:
`/iot/device/update-status`
,
data
})
},
// 修改设备分组
updateDeviceGroup
:
async
(
data
:
{
ids
:
number
[];
groupIds
:
number
[]
})
=>
{
return
await
request
.
put
({
url
:
`/iot/device/update-group`
,
data
})
...
...
src/utils/dict.ts
View file @
3c73a672
/**
* 数据字典工具类
*/
import
{
useDictStoreWithOut
}
from
'@/store/modules/dict'
import
{
ElementPlusInfoType
}
from
'@/types/elementPlus'
import
{
useDictStoreWithOut
}
from
'@/store/modules/dict'
import
{
ElementPlusInfoType
}
from
'@/types/elementPlus'
const
dictStore
=
useDictStoreWithOut
()
...
...
@@ -235,7 +235,7 @@ export enum DICT_TYPE {
IOT_PRODUCT_DEVICE_TYPE
=
'iot_product_device_type'
,
// IOT 产品设备类型
IOT_DATA_FORMAT
=
'iot_data_format'
,
// IOT 数据格式
IOT_PROTOCOL_TYPE
=
'iot_protocol_type'
,
// IOT 接入网关协议
IOT_DEVICE_STAT
US
=
'iot_device_status
'
,
// IOT 设备状态
IOT_DEVICE_STAT
E
=
'iot_device_state
'
,
// IOT 设备状态
IOT_THING_MODEL_TYPE
=
'iot_thing_model_type'
,
// IOT 产品功能类型
IOT_DATA_TYPE
=
'iot_data_type'
,
// IOT 数据类型
IOT_THING_MODEL_UNIT
=
'iot_thing_model_unit'
,
// IOT 物模型单位
...
...
src/views/iot/device/device/detail/DeviceDetailsInfo.vue
View file @
3c73a672
...
...
@@ -23,13 +23,13 @@
{{
formatDate
(
device
.
activeTime
)
}}
</el-descriptions-item>
<el-descriptions-item
label=
"最后上线时间"
>
{{
formatDate
(
device
.
lastO
nlineTime
)
}}
{{
formatDate
(
device
.
o
nlineTime
)
}}
</el-descriptions-item>
<el-descriptions-item
label=
"当前状态"
>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STAT
US
"
:value=
"device.status"
/>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STAT
E
"
:value=
"device.status"
/>
</el-descriptions-item>
<el-descriptions-item
label=
"最后离线时间"
:span=
"3"
>
{{
formatDate
(
device
.
lastO
fflineTime
)
}}
{{
formatDate
(
device
.
o
fflineTime
)
}}
</el-descriptions-item>
<el-descriptions-item
label=
"MQTT 连接参数"
>
<el-button
type=
"primary"
@
click=
"openMqttParams"
>
查看
</el-button>
...
...
src/views/iot/device/device/index.vue
View file @
3c73a672
...
...
@@ -64,7 +64,7 @@
class=
"!w-240px"
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STAT
US
)"
v-for=
"dict in getIntDictOptions(DICT_TYPE.IOT_DEVICE_STAT
E
)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
...
...
@@ -161,7 +161,7 @@
<div
class=
"absolute top-0 left-0 right-0 h-[50px] pointer-events-none"
:class=
"[
item.stat
us
=== DeviceStatusEnum.ONLINE
item.stat
e
=== DeviceStatusEnum.ONLINE
? 'bg-gradient-to-b from-[#eefaff] to-transparent'
: 'bg-gradient-to-b from-[#fff1f1] to-transparent'
]"
...
...
@@ -179,7 +179,7 @@
<div
class=
"w-1 h-1 rounded-full mr-1.5"
:class=
"
item.stat
us
=== DeviceStatusEnum.ONLINE
item.stat
e
=== DeviceStatusEnum.ONLINE
? 'bg-[var(--el-color-success)]'
: 'bg-[var(--el-color-danger)]'
"
...
...
@@ -187,9 +187,9 @@
</div>
<el-text
class=
"!text-xs font-bold"
:type=
"item.stat
us
=== DeviceStatusEnum.ONLINE ? 'success' : 'danger'"
:type=
"item.stat
e
=== DeviceStatusEnum.ONLINE ? 'success' : 'danger'"
>
{{
getDictLabel
(
DICT_TYPE
.
IOT_DEVICE_STAT
US
,
item
.
status
)
}}
{{
getDictLabel
(
DICT_TYPE
.
IOT_DEVICE_STAT
E
,
item
.
state
)
}}
</el-text>
</div>
</div>
...
...
@@ -199,9 +199,9 @@
<div
class=
"flex-1"
>
<div
class=
"mb-2.5 last:mb-0"
>
<span
class=
"text-[#717c8e] mr-2.5"
>
所属产品
</span>
<span
class=
"text-[#0070ff]"
>
{{
products
.
find
((
p
)
=>
p
.
id
===
item
.
productId
)?.
name
}}
</span>
<span
class=
"text-[#0070ff]"
>
{{
products
.
find
((
p
)
=>
p
.
id
===
item
.
productId
)?.
name
}}
</span>
</div>
<div
class=
"mb-2.5 last:mb-0"
>
<span
class=
"text-[#717c8e] mr-2.5"
>
设备类型
</span>
...
...
@@ -209,7 +209,9 @@
</div>
<div
class=
"mb-2.5 last:mb-0"
>
<span
class=
"text-[#717c8e] mr-2.5"
>
DeviceKey
</span>
<span
class=
"text-[#0b1d30] inline-block align-middle overflow-hidden text-ellipsis whitespace-nowrap max-w-[130px]"
>
<span
class=
"text-[#0b1d30] inline-block align-middle overflow-hidden text-ellipsis whitespace-nowrap max-w-[130px]"
>
{{
item
.
deviceKey
}}
</span>
</div>
...
...
@@ -306,13 +308,13 @@
</el-table-column>
<el-table-column
label=
"设备状态"
align=
"center"
prop=
"status"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STAT
US
"
:value=
"scope.row.status"
/>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STAT
E
"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"最后上线时间"
align=
"center"
prop=
"
lastO
nlineTime"
prop=
"
o
nlineTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment