vbea %!s(int64=2) %!d(string=hai) anos
pai
achega
25670ae084

+ 3 - 0
Strides-Admin/src/http/api/incident.js

@@ -26,6 +26,9 @@ const incident = {
   },
   downloadLog() {
     return download('base/download/log')
+  },
+  exportError(data) {
+    return download("error/table/download", data)
   }
 }
 

+ 27 - 2
Strides-Admin/src/views/incident/error_table.vue

@@ -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'

+ 28 - 0
Strides-Admin/src/views/transaction/transactions.vue

@@ -20,6 +20,18 @@
               :label="item"
               :value="item" />
           </el-select>
+          <el-select
+            class="filter-view-item"
+            v-model="filter.pageVo.filter"
+            placeholder="Charging Status"
+            @change="handleFilter"
+            clearable>
+            <el-option
+              v-for="(item, index) in filterOptions"
+              :key="index"
+              :label="item.name"
+              :value="item.value"/>
+          </el-select>
           <div style="flex: 1; max-width: 500px;">
             <el-input
               class="filter-view-item"
@@ -245,6 +257,7 @@ export default {
           dateRange: [],
         }
       },
+      filterOptions: [],
       userTypeOptions: [],
       listLoading: true,
       tableList: [],
@@ -256,6 +269,7 @@ export default {
     }
   },
   created() {
+    this.getFilters();
     this.getUserTypeOption();
     this.handleFilter();
   },
@@ -264,6 +278,20 @@ export default {
       this.filter.pageNo = 1;
       this.getList();
     },
+    getFilters() {
+      api.getTransactionFilters().then(res => {
+        if (res.data) {
+          this.filterOptions = res.data
+          this.filter.pageVo.filter = res.data[0].value
+          this.getList()
+        } else {
+          this.$message({
+            message: error,
+            type: 'error'
+          })
+        }
+      })
+    },
     getUserTypeOption() {
       apiUser.getUserTypeOptions().then(res => {
         if (res.data) {