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
8f1c660d
authored
Dec 14, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】IoT:设备管理界面增加导出设备功能
parent
14fe6c55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
+41
-10
src/api/iot/device/index.ts
+5
-0
src/views/iot/device/device/index.vue
+36
-10
No files found.
src/api/iot/device/index.ts
View file @
8f1c660d
...
@@ -87,6 +87,11 @@ export const DeviceApi = {
...
@@ -87,6 +87,11 @@ export const DeviceApi = {
return
await
request
.
delete
({
url
:
`/iot/device/delete?id=`
+
id
})
return
await
request
.
delete
({
url
:
`/iot/device/delete?id=`
+
id
})
},
},
// 导出设备
exportDeviceExcel
:
async
(
params
:
any
)
=>
{
return
await
request
.
download
({
url
:
`/iot/device/export-excel`
,
params
})
},
// 获取设备数量
// 获取设备数量
getDeviceCount
:
async
(
productId
:
number
)
=>
{
getDeviceCount
:
async
(
productId
:
number
)
=>
{
return
await
request
.
get
({
url
:
`/iot/device/count?productId=`
+
productId
})
return
await
request
.
get
({
url
:
`/iot/device/count?productId=`
+
productId
})
...
...
src/views/iot/device/device/index.vue
View file @
8f1c660d
...
@@ -104,6 +104,15 @@
...
@@ -104,6 +104,15 @@
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
新增
</el-button>
</el-button>
<el-button
type=
"success"
plain
@
click=
"handleExport"
:loading=
"exportLoading"
v-hasPermi=
"['iot:device:export']"
>
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</ContentWrap>
</ContentWrap>
...
@@ -117,7 +126,7 @@
...
@@ -117,7 +126,7 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"备注名称"
align=
"center"
prop=
"nickname"
/>
<el-table-column
label=
"备注名称"
align=
"center"
prop=
"nickname"
/>
<el-table-column
label=
"
设备
所属产品"
align=
"center"
prop=
"productId"
>
<el-table-column
label=
"所属产品"
align=
"center"
prop=
"productId"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
{{
products
.
find
((
p
)
=>
p
.
id
===
scope
.
row
.
productId
)?.
name
||
'-'
}}
{{
products
.
find
((
p
)
=>
p
.
id
===
scope
.
row
.
productId
)?.
name
||
'-'
}}
</
template
>
</
template
>
...
@@ -127,6 +136,15 @@
...
@@ -127,6 +136,15 @@
<dict-tag
:type=
"DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE"
:value=
"scope.row.deviceType"
/>
<dict-tag
:type=
"DICT_TYPE.IOT_PRODUCT_DEVICE_TYPE"
:value=
"scope.row.deviceType"
/>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"所属分组"
align=
"center"
prop=
"groupId"
>
<
template
#
default=
"scope"
>
<template
v-if=
"scope.row.groupIds?.length"
>
<el-tag
v-for=
"id in scope.row.groupIds"
:key=
"id"
class=
"ml-5px"
size=
"small"
>
{{
deviceGroups
.
find
((
g
)
=>
g
.
id
===
id
)?.
name
}}
</el-tag>
</
template
>
</template>
</el-table-column>
<el-table-column
label=
"设备状态"
align=
"center"
prop=
"status"
>
<el-table-column
label=
"设备状态"
align=
"center"
prop=
"status"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STATUS"
:value=
"scope.row.status"
/>
<dict-tag
:type=
"DICT_TYPE.IOT_DEVICE_STATUS"
:value=
"scope.row.status"
/>
...
@@ -139,15 +157,6 @@
...
@@ -139,15 +157,6 @@
:formatter=
"dateFormatter"
:formatter=
"dateFormatter"
width=
"180px"
width=
"180px"
/>
/>
<el-table-column
label=
"所属分组"
align=
"center"
prop=
"groupId"
>
<
template
#
default=
"scope"
>
<template
v-if=
"scope.row.groupIds?.length"
>
<el-tag
v-for=
"id in scope.row.groupIds"
:key=
"id"
class=
"ml-5px"
size=
"small"
>
{{
deviceGroups
.
find
((
g
)
=>
g
.
id
===
id
)?.
name
}}
</el-tag>
</
template
>
</template>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"120px"
>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"120px"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<el-button
<el-button
...
@@ -197,6 +206,7 @@ import { DeviceApi, DeviceVO } from '@/api/iot/device'
...
@@ -197,6 +206,7 @@ import { DeviceApi, DeviceVO } from '@/api/iot/device'
import
DeviceForm
from
'./DeviceForm.vue'
import
DeviceForm
from
'./DeviceForm.vue'
import
{
ProductApi
,
ProductVO
}
from
'@/api/iot/product/product'
import
{
ProductApi
,
ProductVO
}
from
'@/api/iot/product/product'
import
{
DeviceGroupApi
,
DeviceGroupVO
}
from
'@/api/iot/device/group'
import
{
DeviceGroupApi
,
DeviceGroupVO
}
from
'@/api/iot/device/group'
import
download
from
'@/utils/download'
/** IoT 设备 列表 */
/** IoT 设备 列表 */
defineOptions
({
name
:
'IoTDevice'
})
defineOptions
({
name
:
'IoTDevice'
})
...
@@ -218,6 +228,7 @@ const queryParams = reactive({
...
@@ -218,6 +228,7 @@ const queryParams = reactive({
groupId
:
undefined
groupId
:
undefined
})
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
queryFormRef
=
ref
()
// 搜索的表单
const
exportLoading
=
ref
(
false
)
// 导出加载状态
const
products
=
ref
<
ProductVO
[]
>
([])
// 产品列表
const
products
=
ref
<
ProductVO
[]
>
([])
// 产品列表
const
deviceGroups
=
ref
<
DeviceGroupVO
[]
>
([])
// 设备分组列表
const
deviceGroups
=
ref
<
DeviceGroupVO
[]
>
([])
// 设备分组列表
...
@@ -279,4 +290,19 @@ onMounted(async () => {
...
@@ -279,4 +290,19 @@ onMounted(async () => {
// 获取分组列表
// 获取分组列表
deviceGroups
.
value
=
await
DeviceGroupApi
.
getSimpleDeviceGroupList
()
deviceGroups
.
value
=
await
DeviceGroupApi
.
getSimpleDeviceGroupList
()
})
})
/** 导出方法 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
DeviceApi
.
exportDeviceExcel
(
queryParams
)
download
.
excel
(
data
,
'物联网设备.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
</
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