|
|
@@ -33,12 +33,19 @@
|
|
|
</el-button>
|
|
|
</div>
|
|
|
<div class="filter-flex-button">
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
icon="el-icon-download"
|
|
|
:loading="logLoading"
|
|
|
@click="handleDownloadLog">
|
|
|
LOG
|
|
|
+ </el-button> -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-download"
|
|
|
+ :loading="logLoading"
|
|
|
+ @click="handleExport">
|
|
|
+ Export
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -123,7 +130,7 @@
|
|
|
<script>
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
import TableAction from '@/components/TableAction.vue'
|
|
|
-import api from '@/http/api/incident'
|
|
|
+import api from '../../http/api/incident'
|
|
|
import charge from '../../http/api/charge'
|
|
|
|
|
|
export default {
|
|
|
@@ -213,6 +220,24 @@ export default {
|
|
|
this.logLoading = false
|
|
|
})
|
|
|
},
|
|
|
+ handleExport() {
|
|
|
+ this.logLoading = true;
|
|
|
+ api.exportError(this.filter).then(res => {
|
|
|
+ if (res && res.size > 0) {
|
|
|
+ const name = 'Error Table - ' + new Date().getTime() + '.xls';
|
|
|
+ this.downloadFile(res, name);
|
|
|
+ } else {
|
|
|
+ this.$message.error('Empty files');
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: err
|
|
|
+ })
|
|
|
+ }).finally(() => {
|
|
|
+ this.logLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
downloadFile(res, fileName) {
|
|
|
const blob = new Blob([res], {
|
|
|
type: 'application/pdf;charset=utf-8'
|