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
646f212d
authored
Dec 14, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】IoT:设备管理界面增加卡片视图和列表视图切换功能
parent
cc45fd54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
0 deletions
+110
-0
src/assets/svgs/iot/card-fill.svg
+2
-0
src/views/iot/device/device/index.vue
+108
-0
No files found.
src/assets/svgs/iot/card-fill.svg
0 → 100644
View file @
646f212d
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"14"
height=
"14"
fill=
"none"
class=
"design-iconfont"
viewBox=
"0 0 12 12"
><path
fill=
"url(#a)"
fill-rule=
"evenodd"
d=
"M1 0a1 1 0 0 0-1 1v3.538a1 1 0 0 0 1 1h3.538a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1H1Zm0 6.462a1 1 0 0 0-1 1V11a1 1 0 0 0 1 1h3.538a1 1 0 0 0 1-1V7.462a1 1 0 0 0-1-1H1ZM6.462 1a1 1 0 0 1 1-1H11a1 1 0 0 1 1 1v3.538a1 1 0 0 1-1 1H7.462a1 1 0 0 1-1-1V1Zm1 5.462a1 1 0 0 0-1 1V11a1 1 0 0 0 1 1H11a1 1 0 0 0 1-1V7.462a1 1 0 0 0-1-1H7.462Z"
clip-rule=
"evenodd"
/><defs><linearGradient
id=
"a"
x1=
"0"
x2=
"12"
y1=
"0"
y2=
"12"
gradientUnits=
"userSpaceOnUse"
><stop
stop-color=
"#1B3149"
/><stop
offset=
"1"
stop-color=
"#717D8A"
/></linearGradient></defs></svg>
\ No newline at end of file
src/views/iot/device/device/index.vue
View file @
646f212d
...
@@ -86,6 +86,16 @@
...
@@ -86,6 +86,16 @@
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
class=
"float-right !mr-0 !mb-0"
>
<el-button-group>
<el-button
:type=
"viewMode === 'card' ? 'primary' : 'default'"
@
click=
"viewMode = 'card'"
>
<Icon
icon=
"ep:grid"
/>
</el-button>
<el-button
:type=
"viewMode === 'list' ? 'primary' : 'default'"
@
click=
"viewMode = 'list'"
>
<Icon
icon=
"ep:list"
/>
</el-button>
</el-button-group>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
>
<el-button
@
click=
"handleQuery"
>
<Icon
icon=
"ep:search"
class=
"mr-5px"
/>
<Icon
icon=
"ep:search"
class=
"mr-5px"
/>
...
@@ -137,7 +147,95 @@
...
@@ -137,7 +147,95 @@
<!-- 列表 -->
<!-- 列表 -->
<ContentWrap>
<ContentWrap>
<template
v-if=
"viewMode === 'card'"
>
<el-row
:gutter=
"16"
>
<el-col
v-for=
"item in list"
:key=
"item.id"
:xs=
"24"
:sm=
"12"
:md=
"12"
:lg=
"6"
class=
"mb-4"
>
<el-card
class=
"h-full transition-colors"
:body-style=
"
{ padding: '0' }">
<div
class=
"p-4"
>
<!-- 标题区域 -->
<div
class=
"flex items-center mb-3"
>
<div
class=
"mr-2.5 flex items-center"
>
<el-image
:src=
"defaultIconUrl"
class=
"w-[18px] h-[18px]"
/>
</div>
<div
class=
"text-[16px] font-600"
>
{{
item
.
deviceName
}}
</div>
</div>
<!-- 信息区域 -->
<div
class=
"flex items-center text-[14px]"
>
<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>
</div>
<div
class=
"mb-2.5 last:mb-0"
>
<span
class=
"text-[#717c8e] mr-2.5"
>
设备类型
</span>
<dict-tag
:type=
"DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE"
:value=
"item.deviceType"
/>
</div>
<div
class=
"mb-2.5 last:mb-0"
>
<span
class=
"text-[#717c8e] mr-2.5"
>
DeviceKey
</span>
<span
class=
"text-[#0b1d30]"
>
{{
item
.
deviceKey
}}
</span>
</div>
</div>
<div
class=
"w-[100px] h-[100px]"
>
<el-image
:src=
"defaultPicUrl"
class=
"w-full h-full"
/>
</div>
</div>
<!-- 分隔线 -->
<el-divider
class=
"!my-3"
/>
<!-- 按钮组 -->
<div
class=
"flex items-center px-0"
>
<el-button
class=
"flex-1 !px-2 !h-[32px] text-[13px]"
type=
"primary"
plain
@
click=
"openForm('update', item.id)"
v-hasPermi=
"['iot:device:update']"
>
<Icon
icon=
"ep:edit-pen"
class=
"mr-1"
/>
编辑
</el-button>
<el-button
class=
"flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
type=
"warning"
plain
@
click=
"openDetail(item.id)"
>
<Icon
icon=
"ep:view"
class=
"mr-1"
/>
详情
</el-button>
<el-button
class=
"flex-1 !px-2 !h-[32px] !ml-[10px] text-[13px]"
type=
"info"
plain
@
click=
"openLog(item.id)"
>
<Icon
icon=
"ep:tickets"
class=
"mr-1"
/>
日志
</el-button>
<div
class=
"mx-[10px] h-[20px] w-[1px] bg-[#dcdfe6]"
></div>
<el-button
class=
"!px-2 !h-[32px] text-[13px]"
type=
"danger"
plain
@
click=
"handleDelete(item.id)"
v-hasPermi=
"['iot:device:delete']"
>
<Icon
icon=
"ep:delete"
/>
</el-button>
</div>
</div>
</el-card>
</el-col>
</el-row>
</
template
>
<!-- 列表视图 -->
<el-table
<el-table
v-else
v-loading=
"loading"
v-loading=
"loading"
:data=
"list"
:data=
"list"
:stripe=
"true"
:stripe=
"true"
...
@@ -192,6 +290,7 @@
...
@@ -192,6 +290,7 @@
>
>
查看
查看
</el-button>
</el-button>
<el-button
link
type=
"primary"
@
click=
"openLog(scope.row.id)"
>
日志
</el-button>
<el-button
<el-button
link
link
type=
"primary"
type=
"primary"
...
@@ -211,6 +310,7 @@
...
@@ -211,6 +310,7 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<!-- 分页 -->
<!-- 分页 -->
<Pagination
<Pagination
:total=
"total"
:total=
"total"
...
@@ -260,6 +360,9 @@ const exportLoading = ref(false) // 导出加载状态
...
@@ -260,6 +360,9 @@ const exportLoading = ref(false) // 导出加载状态
const
products
=
ref
<
ProductVO
[]
>
([])
// 产品列表
const
products
=
ref
<
ProductVO
[]
>
([])
// 产品列表
const
deviceGroups
=
ref
<
DeviceGroupVO
[]
>
([])
// 设备分组列表
const
deviceGroups
=
ref
<
DeviceGroupVO
[]
>
([])
// 设备分组列表
const
selectedIds
=
ref
<
number
[]
>
([])
// 选中的设备编号数组
const
selectedIds
=
ref
<
number
[]
>
([])
// 选中的设备编号数组
const
viewMode
=
ref
<
'card'
|
'list'
>
(
'card'
)
// 视图模式状态
const
defaultPicUrl
=
ref
(
'/src/assets/imgs/iot/device.png'
)
// 默认设备图片
const
defaultIconUrl
=
ref
(
'/src/assets/svgs/iot/card-fill.svg'
)
// 默认设备图标
/** 查询列表 */
/** 查询列表 */
const
getList
=
async
()
=>
{
const
getList
=
async
()
=>
{
...
@@ -349,6 +452,11 @@ const openGroupForm = () => {
...
@@ -349,6 +452,11 @@ const openGroupForm = () => {
groupFormRef
.
value
.
open
(
selectedIds
.
value
)
groupFormRef
.
value
.
open
(
selectedIds
.
value
)
}
}
/** 打开日志 */
const
openLog
=
(
id
:
number
)
=>
{
push
({
name
:
'IoTDeviceDetail'
,
params
:
{
id
},
query
:
{
tab
:
'log'
}
})
}
/** 初始化 **/
/** 初始化 **/
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
getList
()
getList
()
...
...
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