瀏覽代碼

检测证书管理证书编号改为序列号

yanghao 1 周之前
父節點
當前提交
d9e3ff8012
共有 2 個文件被更改,包括 30 次插入2 次删除
  1. 3 0
      src/api/pms/stat/index.ts
  2. 27 2
      src/views/pms/stat/rhkb/deviceList.vue

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

@@ -162,6 +162,9 @@ export const IotStatApi = {
   getRhRate: async (params: any) => {
     return await request.get({ url: `/rq/stat/rh/device/utilizationRate`, params })
   },
+  exportRhDashboard: async (params: any) => {
+    return await request.download({ url: `/rq/stat/exportRhDashboard`, params })
+  },
   getRhTotalUtilizationRate: async (params: any) => {
     return await request.get({ url: `/rq/stat/rh/device/totalUtilizationRate`, params })
   },

+ 27 - 2
src/views/pms/stat/rhkb/deviceList.vue

@@ -1,5 +1,6 @@
 <script lang="ts" setup>
 import { IotStatApi } from '@/api/pms/stat'
+import download from '@/utils/download'
 import dayjs from 'dayjs'
 import type { Ref } from 'vue'
 
@@ -42,6 +43,7 @@ const props = withDefaults(
 
 const createDate = ref(DEFAULT_DATE)
 const loading = ref(false)
+const exportLoading = ref(false)
 const list = ref<RhDeviceListRow[]>([])
 const teamDialogVisible = ref(false)
 const teamLoading = ref(false)
@@ -70,6 +72,21 @@ function handleDateChange() {
   getList()
 }
 
+const message = useMessage()
+
+async function handleExport() {
+  try {
+    await message.exportConfirm()
+
+    exportLoading.value = true
+    const res = await IotStatApi.exportRhDashboard({ createTime: createTime.value })
+
+    download.excel(res, `瑞恒看板-${createDate.value}.xlsx`)
+  } finally {
+    exportLoading.value = false
+  }
+}
+
 async function handleRowClick(row: RhDeviceListRow) {
   currentProjectDeptName.value = row.projectDeptName || '项目部'
   teamDialogVisible.value = true
@@ -126,7 +143,7 @@ onMounted(() => {
         </div>
         项目部统计
       </div>
-      <div class="device-list-panel__picker">
+      <div class="device-list-panel__tools">
         <el-date-picker
           v-model="createDate"
           value-format="YYYY-MM-DD"
@@ -135,6 +152,9 @@ onMounted(() => {
           :clearable="false"
           class="device-list-panel__picker-input"
           @change="handleDateChange" />
+        <el-button type="success" plain :loading="exportLoading" @click="handleExport">
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
       </div>
     </div>
     <div class="device-list-panel__body flex flex-col flex-1 min-h-0">
@@ -225,7 +245,12 @@ onMounted(() => {
   margin-top: 0;
 }
 
-.device-list-panel__picker,
+.device-list-panel__tools {
+  display: flex;
+  align-items: center;
+  gap: calc(8px * var(--kb-scale, 1));
+}
+
 .device-list-panel__picker-input {
   width: calc(160px * var(--kb-scale, 1)) !important;
 }