Pārlūkot izejas kodu

工单完成情况导出

Zimo 17 stundas atpakaļ
vecāks
revīzija
d0168275a7

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

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

+ 25 - 1
src/views/report-statistics/work-order-completion.vue

@@ -6,6 +6,7 @@ import MiniBarChart from '@/components/WorkOrderCompletionBar/index.vue'
 import CountTo from '@/components/count-to1.vue'
 import { IotReportApi } from '@/api/pms/report'
 import { rangeShortcuts } from '@/utils/formatTime'
+import download from '@/utils/download'
 
 // 定义时间类型
 type TimeType = 'year' | 'month' | 'day'
@@ -256,6 +257,23 @@ const handleClear = () => {
 const handleChange = () => {
   activeTimeType.value = undefined
 }
+
+const message = useMessage()
+
+const exportLoading = ref(false)
+
+async function handleExport() {
+  try {
+    await message.exportConfirm()
+
+    exportLoading.value = true
+    const res = await IotReportApi.exportOrderPage(query.value)
+
+    download.excel(res, '工单完成情况.xlsx')
+  } finally {
+    exportLoading.value = false
+  }
+}
 </script>
 
 <template>
@@ -384,7 +402,13 @@ const handleChange = () => {
           <el-button size="default" @click="handleReset">重置</el-button>
           <!-- @click="handleExport"
             :loading="exportLoading" -->
-          <el-button size="default" plain type="success">
+          <el-button
+            @click="handleExport"
+            :loading="exportLoading"
+            size="default"
+            plain
+            type="success"
+          >
             <Icon icon="ep:download" class="mr-5px" /> 导出
           </el-button>
         </div>