事件报告导出
This commit is contained in:
@@ -81,9 +81,6 @@ export function deleteSystemConfig( data) {
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//新增系统配置
|
||||
export function addSystemConfig(data) {
|
||||
|
||||
@@ -2,13 +2,35 @@ import createAxios from '@/utils/request'
|
||||
import { genFileId, ElMessage, ElNotification } from 'element-plus'
|
||||
|
||||
//事件报告
|
||||
// export function getEventReport(data) {
|
||||
// return createAxios({
|
||||
// url: '/event-boot/report/getEventReport',
|
||||
// method: 'post',
|
||||
// data
|
||||
// })
|
||||
// }
|
||||
|
||||
export function getEventReport(data) {
|
||||
return createAxios({
|
||||
url: '/event-boot/report/getEventReport',
|
||||
url: '/event-boot/report/createEventReport',
|
||||
method: 'post',
|
||||
data
|
||||
data,
|
||||
responseType: 'blob'
|
||||
}).then(async res => {
|
||||
let load: any = await readJsonBlob(res)
|
||||
if (load.code) {
|
||||
if (load.data.code == 'A0011') {
|
||||
ElMessage.warning('下载失败!')
|
||||
} else {
|
||||
ElMessage.warning(load.data.message)
|
||||
}
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 生成报告
|
||||
export function getAreaReport(data) {
|
||||
return createAxios({
|
||||
|
||||
@@ -427,7 +427,9 @@ const makeUp = () => {
|
||||
tableRef.value
|
||||
.getRef()
|
||||
.getCheckboxRecords()
|
||||
.find((item: any) => item.level == '6') || []
|
||||
.filter((item: any) => item.level == '6') || []
|
||||
|
||||
|
||||
|
||||
if (list.length == 0) {
|
||||
return ElMessage({
|
||||
@@ -435,6 +437,16 @@ const makeUp = () => {
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
|
||||
// 检查是否有 comFlag 等于 0 的项
|
||||
const hasOfflineDevice = list.some((item: any) => item.comFlag === 0)
|
||||
|
||||
if (hasOfflineDevice) {
|
||||
return ElMessage({
|
||||
message: '请选择在线监测点进行补招',
|
||||
type: 'warning'
|
||||
})
|
||||
}
|
||||
timeData.value = []
|
||||
timePopUp.value = true
|
||||
}
|
||||
@@ -455,7 +467,8 @@ const makeUpSubmit = () => {
|
||||
reCallEndTime: timeData.value[1],
|
||||
reCallStartTime: timeData.value[0]
|
||||
}
|
||||
|
||||
console.log('2222',form)
|
||||
return
|
||||
socket(form)
|
||||
timePopUp.value = false
|
||||
logPopUp.value = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="default-main">
|
||||
<TableHeader date-picker area showExport>
|
||||
<TableHeader date-picker area >
|
||||
<template v-slot:select>
|
||||
<el-form-item label="统计类型">
|
||||
<el-radio-group v-model="tableStore.table.params.comFlag">
|
||||
@@ -48,7 +48,7 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
<!-- <el-button icon="el-icon-Download" type="primary" @click="exportEvent">导出</el-button> -->
|
||||
<el-button icon="el-icon-Download" type="primary" @click="exportEvent" :loading="loading">导出</el-button>
|
||||
</template>
|
||||
</TableHeader>
|
||||
<Table ref="tableRef" />
|
||||
@@ -61,6 +61,7 @@ import Table from '@/components/table/index.vue'
|
||||
import TableHeader from '@/components/table/header/index.vue'
|
||||
import { useDictData } from '@/stores/dictData'
|
||||
import { getEventReport } from '@/api/event-boot/report'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
defineOptions({
|
||||
name: 'Operationmanagement/terminalmanagement'
|
||||
@@ -70,7 +71,7 @@ const triggerType = dictData.getBasicData('Event_Statis')
|
||||
const sign: any = dictData.getBasicData('power_flag')
|
||||
const tableRef = ref()
|
||||
|
||||
|
||||
const loading = ref(false)
|
||||
const monitorList = [
|
||||
{ value: 0, label: '非网公司' },
|
||||
{ value: 1, label: '网公司' },
|
||||
@@ -162,20 +163,48 @@ onMounted(() => {
|
||||
tableStore.index()
|
||||
})
|
||||
const exportEvent = () => {
|
||||
let form: any = JSON.parse(JSON.stringify(tableStore.table.params))
|
||||
form.pageNum = 1
|
||||
form.pageSize = tableStore.table.total
|
||||
getEventReport(form).then(res => {
|
||||
tableRef.value.getRef().exportData({
|
||||
filename: '事件报告', // 文件名字
|
||||
sheetName: 'Sheet1',
|
||||
type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
useStyle: true,
|
||||
data: res.data.records, // 数据源 // 过滤那个字段导出
|
||||
columnFilterMethod: function (column, $columnIndex) {
|
||||
return !(column.$columnIndex === 0)
|
||||
// let form: any = JSON.parse(JSON.stringify(tableStore.table.params))
|
||||
// form.pageNum = 1
|
||||
// form.pageSize = tableStore.table.total
|
||||
// getEventReport(form).then(res => {
|
||||
// tableRef.value.getRef().exportData({
|
||||
// filename: '事件报告', // 文件名字
|
||||
// sheetName: 'Sheet1',
|
||||
// type: 'xlsx', //导出文件类型 xlsx 和 csv
|
||||
// useStyle: true,
|
||||
// data: res.data.records, // 数据源 // 过滤那个字段导出
|
||||
// columnFilterMethod: function (column, $columnIndex) {
|
||||
// return !(column.$columnIndex === 0)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
|
||||
|
||||
const ids = tableStore.table.data.map((item: any) => item.eventId);
|
||||
loading.value = true
|
||||
|
||||
ElMessage('生成报告中,请稍等!')
|
||||
getEventReport(ids)
|
||||
.then((res: any) => {
|
||||
if (res == undefined) {
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
let blob = new Blob([res], {
|
||||
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
|
||||
})
|
||||
|
||||
const url = window.URL.createObjectURL(blob)
|
||||
const link = document.createElement('a') // 创建a标签
|
||||
link.href = url
|
||||
link.download = '事件报告' // 设置下载的文件名
|
||||
document.body.appendChild(link)
|
||||
link.click() //执行下载
|
||||
document.body.removeChild(link)
|
||||
loading.value = false
|
||||
}) .catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user