|
|
@@ -88,7 +88,7 @@
|
|
|
<el-card shadow="never" class="table-card">
|
|
|
<div class="card-title">
|
|
|
<span>{{ title }}点位清单</span>
|
|
|
- <el-button link type="primary" :loading="exportLoading" @click="exportData">批量导出</el-button>
|
|
|
+ <el-button v-hasPermi="[exportPermission]" link type="primary" :loading="exportLoading" @click="exportData">批量导出</el-button>
|
|
|
</div>
|
|
|
<el-table :data="page.records" stripe border v-loading="loading" @row-click="showTrend">
|
|
|
<template #empty>
|
|
|
@@ -161,11 +161,11 @@
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import {computed, nextTick, onBeforeUnmount, onMounted, ref} from 'vue'
|
|
|
- import {DataAnalysis, Monitor, Warning} from '@element-plus/icons-vue'
|
|
|
+ import {DataAnalysis, Monitor, Refresh, Warning} from '@element-plus/icons-vue'
|
|
|
import {ElMessage} from 'element-plus'
|
|
|
import {saveAs} from 'file-saver'
|
|
|
import * as echarts from 'echarts'
|
|
|
- import {normalizeMonitoringRecord, normalizePage, unwrapResponse} from '@/utils/waterSupplyModel'
|
|
|
+ import {normalizeMonitoringRecord, normalizePage, readMonitoringExportError, unwrapResponse} from '@/utils/waterSupplyModel'
|
|
|
import {buildMonitoringQuery, buildTrendQuery} from '@/utils/waterSupplyMonitoringQuery'
|
|
|
|
|
|
const props = defineProps({
|
|
|
@@ -178,6 +178,7 @@
|
|
|
load: {type: Function, required: true},
|
|
|
trend: {type: Function, required: true},
|
|
|
exportApi: {type: Function, required: true},
|
|
|
+ exportPermission: {type: String, required: true},
|
|
|
metric: {type: String, default: 'value'},
|
|
|
monitorType: {type: String, default: ''}
|
|
|
})
|
|
|
@@ -310,6 +311,11 @@
|
|
|
const blob = response instanceof Blob
|
|
|
? response
|
|
|
: new Blob([response], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'})
|
|
|
+ const exportError = await readMonitoringExportError(blob)
|
|
|
+ if (exportError) {
|
|
|
+ ElMessage.error(exportError)
|
|
|
+ return
|
|
|
+ }
|
|
|
if (!blob.size) throw new Error('导出文件为空')
|
|
|
saveAs(blob, `${props.title}数据_${new Date().toISOString().slice(0, 10)}.xlsx`)
|
|
|
ElMessage.success('导出完成')
|