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
a2dec90e
authored
Dec 14, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】IoT:设备管理界面增加批量删除功能
parent
8f1c660d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
src/api/iot/device/index.ts
+6
-1
src/views/iot/device/device/index.vue
+36
-1
No files found.
src/api/iot/device/index.ts
View file @
a2dec90e
...
@@ -82,11 +82,16 @@ export const DeviceApi = {
...
@@ -82,11 +82,16 @@ export const DeviceApi = {
return
await
request
.
put
({
url
:
`/iot/device/update-status`
,
data
})
return
await
request
.
put
({
url
:
`/iot/device/update-status`
,
data
})
},
},
// 删除设备
// 删除
单个
设备
deleteDevice
:
async
(
id
:
number
)
=>
{
deleteDevice
:
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/iot/device/delete?id=`
+
id
})
return
await
request
.
delete
({
url
:
`/iot/device/delete?id=`
+
id
})
},
},
// 删除多个设备
deleteDeviceList
:
async
(
ids
:
number
[])
=>
{
return
await
request
.
delete
({
url
:
`/iot/device/delete-list`
,
params
:
{
ids
:
ids
.
join
(
','
)
}
})
},
// 导出设备
// 导出设备
exportDeviceExcel
:
async
(
params
:
any
)
=>
{
exportDeviceExcel
:
async
(
params
:
any
)
=>
{
return
await
request
.
download
({
url
:
`/iot/device/export-excel`
,
params
})
return
await
request
.
download
({
url
:
`/iot/device/export-excel`
,
params
})
...
...
src/views/iot/device/device/index.vue
View file @
a2dec90e
...
@@ -113,13 +113,29 @@
...
@@ -113,13 +113,29 @@
>
>
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
</el-button>
</el-button>
<el-button
type=
"danger"
plain
@
click=
"handleDeleteList"
:disabled=
"selectedIds.length === 0"
v-hasPermi=
"['iot:device:delete']"
>
<Icon
icon=
"ep:delete"
class=
"mr-5px"
/>
批量删除
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</ContentWrap>
</ContentWrap>
<!-- 列表 -->
<!-- 列表 -->
<ContentWrap>
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"true"
>
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"true"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
label=
"DeviceName"
align=
"center"
prop=
"deviceName"
>
<el-table-column
label=
"DeviceName"
align=
"center"
prop=
"deviceName"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
<el-link
@
click=
"openDetail(scope.row.id)"
>
{{
scope
.
row
.
deviceName
}}
</el-link>
<el-link
@
click=
"openDetail(scope.row.id)"
>
{{
scope
.
row
.
deviceName
}}
</el-link>
...
@@ -231,6 +247,7 @@ const queryFormRef = ref() // 搜索的表单
...
@@ -231,6 +247,7 @@ const queryFormRef = ref() // 搜索的表单
const
exportLoading
=
ref
(
false
)
// 导出加载状态
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
getList
=
async
()
=>
{
const
getList
=
async
()
=>
{
...
@@ -253,6 +270,7 @@ const handleQuery = () => {
...
@@ -253,6 +270,7 @@ const handleQuery = () => {
/** 重置按钮操作 */
/** 重置按钮操作 */
const
resetQuery
=
()
=>
{
const
resetQuery
=
()
=>
{
queryFormRef
.
value
.
resetFields
()
queryFormRef
.
value
.
resetFields
()
selectedIds
.
value
=
[]
// 清空选择
handleQuery
()
handleQuery
()
}
}
...
@@ -305,4 +323,21 @@ const handleExport = async () => {
...
@@ -305,4 +323,21 @@ const handleExport = async () => {
exportLoading
.
value
=
false
exportLoading
.
value
=
false
}
}
}
}
/** 多选框选中数据 */
const
handleSelectionChange
=
(
selection
:
DeviceVO
[])
=>
{
selectedIds
.
value
=
selection
.
map
((
item
)
=>
item
.
id
)
}
/** 批量删除按钮操作 */
const
handleDeleteList
=
async
()
=>
{
try
{
await
message
.
delConfirm
()
// 执行批量删除
await
DeviceApi
.
deleteDeviceList
(
selectedIds
.
value
)
message
.
success
(
t
(
'common.delSuccess'
))
// 刷新列表
await
getList
()
}
catch
{}
}
</
script
>
</
script
>
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