diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts
index f9e388f2..536f52a6 100644
--- a/src/api/iot/device/index.ts
+++ b/src/api/iot/device/index.ts
@@ -87,6 +87,11 @@ export const DeviceApi = {
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) => {
return await request.get({ url: `/iot/device/count?productId=` + productId })
diff --git a/src/views/iot/device/device/index.vue b/src/views/iot/device/device/index.vue
index 824f41ac..522ab918 100644
--- a/src/views/iot/device/device/index.vue
+++ b/src/views/iot/device/device/index.vue
@@ -104,6 +104,15 @@
新增
+
+ 导出
+
@@ -117,7 +126,7 @@
-
+
{{ products.find((p) => p.id === scope.row.productId)?.name || '-' }}
@@ -127,6 +136,15 @@
+
+
+
+
+ {{ deviceGroups.find((g) => g.id === id)?.name }}
+
+
+
+
@@ -139,15 +157,6 @@
:formatter="dateFormatter"
width="180px"
/>
-
-
-
-
- {{ deviceGroups.find((g) => g.id === id)?.name }}
-
-
-
-
([]) // 产品列表
const deviceGroups = ref([]) // 设备分组列表
@@ -279,4 +290,19 @@ onMounted(async () => {
// 获取分组列表
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
+ }
+}