|
|
@@ -4,6 +4,7 @@ import dayjs from 'dayjs'
|
|
|
import CountTo from '@/components/count-to1.vue'
|
|
|
import { IotReportApi } from '@/api/pms/report'
|
|
|
import { useDebounceFn } from '@vueuse/core'
|
|
|
+import download from '@/utils/download'
|
|
|
|
|
|
// 定义时间类型
|
|
|
type TimeType = 'year' | 'month' | 'day'
|
|
|
@@ -201,6 +202,18 @@ function handleReset() {
|
|
|
handleTimeChange('year')
|
|
|
selectType(undefined)
|
|
|
}
|
|
|
+
|
|
|
+const exportLoading = ref(false)
|
|
|
+
|
|
|
+const handleExport = async () => {
|
|
|
+ exportLoading.value = true
|
|
|
+ try {
|
|
|
+ const data = await IotReportApi.exportCosts(query.value)
|
|
|
+ download.excel(data, '运维成本.xls')
|
|
|
+ } finally {
|
|
|
+ exportLoading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -300,7 +313,18 @@ function handleReset() {
|
|
|
{{ item.label }}
|
|
|
</el-button>
|
|
|
</el-button-group>
|
|
|
- <el-button size="default" @click="handleReset">重置</el-button>
|
|
|
+ <div class="flex items-center gap-2">
|
|
|
+ <el-button size="default" @click="handleReset">重置</el-button>
|
|
|
+ <el-button
|
|
|
+ size="default"
|
|
|
+ plain
|
|
|
+ type="success"
|
|
|
+ @click="handleExport"
|
|
|
+ :loading="exportLoading"
|
|
|
+ >
|
|
|
+ <Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="bg-white dark:bg-[#1d1e1f] shadow rounded-lg p-4 flex flex-col mt-4">
|