Ver Fonte

运维成本

Zimo há 6 dias atrás
pai
commit
a3524201ca
2 ficheiros alterados com 28 adições e 1 exclusões
  1. 3 0
      src/api/pms/report/index.ts
  2. 25 1
      src/views/report-statistics/costs.vue

+ 3 - 0
src/api/pms/report/index.ts

@@ -13,5 +13,8 @@ export const IotReportApi = {
   },
   getOrderPage: async (params: any) => {
     return await request.get({ url: `/rq/report/order/page`, params })
+  },
+  exportCosts: async (params) => {
+    return await request.download({ url: `/rq/report/repair/report/export-excel`, params })
   }
 }

+ 25 - 1
src/views/report-statistics/costs.vue

@@ -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">