Browse Source

feat:预警信息导出

main
buaixuexideshitongxue 1 month ago
parent
commit
ee35158c34
  1. 14
      src/api/warning/index.ts
  2. 15
      src/views/warning/index.vue

14
src/api/warning/index.ts

@ -3,7 +3,7 @@ import request from "@/api/request";
//分页查询
export function warningPage(body) {
return request.post({
url: '/warning/getPage',
url: '/warning/business/page',
body
});
}
@ -53,3 +53,15 @@ export function auditEndWarningApi(body){
body
})
}
//导出预警列表
export function excelWarningList(body) {
return request.post({
url: '/warning/business/excelWarningList',
body,
config: {
excelName: '预警监督项目列表.xlsx'
},
showErrorMsg: true
})
}

15
src/views/warning/index.vue

@ -1,11 +1,12 @@
<!--审计预警监督-->
<script setup>
import {warningPage} from "@/api/warning/index";
import {warningPage, excelWarningList} from "@/api/warning/index";
import {timeFormat} from "@/utils/util";
import {useRoute} from "vue-router";
const route = useRoute()
const loading =ref(false)
const exportLoading = ref(false)
const total =ref(10)
const tableData =ref([])
const activeTab = ref(route.query.specialArea === 'cwlnt' ? 'cwlnt' : route.query.warningState === '1' ? '1' : '0')
@ -64,6 +65,17 @@ const editFun = (row) =>{
query: routeQuery
});
}
const handleExcel = async ()=>{
if (exportLoading.value) return;
try {
exportLoading.value = true;
await excelWarningList(query.value);
} catch (e) {
console.error('导出失败', e);
} finally {
exportLoading.value = false;
}
}
getList()
watch(()=>route.query.load,(val)=>{
@ -133,6 +145,7 @@ watch(()=>route.query.load,(val)=>{
</el-form>
<div class="flex end">
<div>
<el-button type="primary" :loading="exportLoading" @click="handleExcel">导出</el-button>
<el-button type="primary" @click="getList">
<template #icon>
<icon name="el-icon-Search"/>

Loading…
Cancel
Save