Bladeren bron

Complete incident modules

vbea 3 jaren geleden
bovenliggende
commit
e5fd886fe3

+ 0 - 20
Strides-Admin/src/http/api/error.js

@@ -1,20 +0,0 @@
-import { get, post } from '../http'
-
-const error = {
-
-// {
-//   "pageSize": 10,
-//   "pageNo": 1,
-//   "pageVo": {
-//     "criteria": "test"
-//   }
-// }
-  fetchErrorPages(data) {
-    return post('error/table/pages', data)
-  },
-  getConnectivityPages(data) {
-    return post('charger-connectivity/pages', data)
-  }
-}
-
-export default error;

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

@@ -0,0 +1,29 @@
+import { get, post, download } from '../http'
+
+const incident = {
+
+// {
+//   "pageSize": 10,
+//   "pageNo": 1,
+//   "pageVo": {
+//     "criteria": "test"
+//   }
+// }
+  fetchErrorPages(data) {
+    return post('error/table/pages', data)
+  },
+  getConnectivityTabs() {
+    return get('charger-connectivity/notification')
+  },
+  getConnectivityPages(data) {
+    return post('charger-connectivity/pages', data)
+  },
+  viewConnectivityInfo(data) {
+    return post('charger-connectivity/view/pages', data)
+  },
+  exportConnectivity(data) {
+    return download('charger-connectivity/export', data)
+  }
+}
+
+export default incident;

+ 2 - 2
Strides-Admin/src/router/ChargeRouter.js

@@ -45,7 +45,7 @@ export default {
       }
     },
     {
-      path: 'add-charge-stations',
+      path: 'add-station',
       component: () => import('@/views/charge/AddStation'),
       name: 'add-charge-stations',
       meta: {
@@ -55,7 +55,7 @@ export default {
       hidden: true
     },
     {
-      path: 'edit-charge-stations',
+      path: 'edit-station/:id',
       component: () => import('@/views/charge/AddStation'),
       name: 'edit-charge-stations',
       meta: {

+ 1 - 1
Strides-Admin/src/views/Reports.vue

@@ -36,7 +36,7 @@
           <el-form-item
             label="Site:"
             class="row-item"
-            v-if="reportFilter.reportType == 'MAF'">
+            v-if="reportFilter.reportType == 'MAF' || reportFilter.reportType == 'MSS'">
             <el-select
               filterable
               remote

+ 25 - 11
Strides-Admin/src/views/charge/AddStation.vue

@@ -20,7 +20,15 @@
                   class="add-text"
                   v-model="addForm.chargeBoxId"
                   placeholder="Add text"
-                  maxlength="30"/>
+                  maxlength="30"
+                  readonly
+                  v-if="isEdit"/>
+                <el-input
+                  class="add-text"
+                  v-model="addForm.chargeBoxId"
+                  placeholder="Add text"
+                  maxlength="30"
+                  v-else/>
               </el-form-item>
             </el-col>
           </el-row>
@@ -336,7 +344,7 @@
 </template>
 
 <script>
-  import { mapState } from 'vuex'
+  //import { mapState } from 'vuex'
   import site from '../../http/api/site'
   import station from '../../http/api/charge'
   import provider from '../../http/api/provider'
@@ -456,12 +464,9 @@
         isEdit: false
       }
     },
-    computed: {
-      ...mapState('charge', ['stationId'])
-    },
     created() {
       this.getRegisterOptions()
-      if (this.stationId && this.$route.name == "edit-charge-stations") {
+      if (this.$route.params.id) {
         this.isEdit = true;
         this.getChargeTypes();
         this.getStationInfo();
@@ -494,13 +499,16 @@
         });
       },
       getStationInfo() {
-        station.getStationInfo({chargeBoxPk: this.stationId}).then(res => {
+        station.getStationInfo({chargeBoxPk: this.$route.params.id}).then(res => {
           if (res.data) {
             this.addForm = res.data
             delete this.addForm.address
           }
         }).catch(err => {
-           
+          this.$message({
+            message: err,
+            type: 'error'
+          })
         });
       },
       getStationUrls() {
@@ -509,7 +517,10 @@
             this.socketUrls = res.data
           }
         }).catch(err => {
-          
+          this.$message({
+            message: err,
+            type: 'error'
+          })
         })
       },
       getAllProvider() {
@@ -533,8 +544,11 @@
         this.addForm.connectorInfo.splice(index, 1);
       },
       handleClickCancleButton() {
-        this.$router.push({
-          path: "/charge/registered-charge-stations"
+        this.loading = false;
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: "/charge/registered-charge-stations"
+          })
         })
       },
       handleClickConfigUpateButton() {

+ 7 - 3
Strides-Admin/src/views/charge/RegisteredChargeStations.vue

@@ -265,12 +265,16 @@ export default {
       this[cb](item)
     },
     addStation() {
-      this.$router.push({path: '/charge/add-charge-stations'});
+      this.$router.push({
+        path: '/charge/add-station',
+      });
     },
     editStation(row) {
       //console.log('row', row);
-      this.$store.commit('charge/SET_StationId', row.chargeBoxPk)
-      this.$router.push({path: '/charge/edit-charge-stations'});
+      //this.$store.commit('charge/SET_StationId', row.chargeBoxPk)
+      this.$router.push({
+        path: '/charge/edit-station/' + row.chargeBoxPk,
+      });
     },
     softReset(row) {
       this.$confirm("Confirm soft reset?", "Reset",  {

+ 43 - 31
Strides-Admin/src/views/incident/connectivity.vue

@@ -3,13 +3,13 @@
     <div class="filter-container">
       <div class="radio-group">
         <el-radio-group
-          v-model="params.tabIndex"
+          v-model="params.pageVo.notification"
           @change="changeTab">
           <el-radio-button
-            v-for="(item,index) in dateRangeTab"
+            v-for="(item,index) in typeTabs"
             :key="index"
-            :label="index">
-            {{item.name + " (" + item.total + ")"}}
+            :label="item.value">
+            {{item.name}}
           </el-radio-button>
         </el-radio-group>
       </div>
@@ -31,7 +31,7 @@
     <el-table
       v-loading="table.loading"
       :data="table.list"
-      style="width: 100%;min-height: 65vh;">
+      style="width: 100%;min-height: 58vh;">
       <el-table-column
         label="Site ID"
         align="center"
@@ -88,7 +88,8 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import error from '@/http/api/error'
+import api from '@/http/api/incident'
+import { Base64 } from 'js-base64';
 export default {
   data() {
     return {
@@ -96,44 +97,48 @@ export default {
         pageNo: 1,
         pageSize: 10,
         pageVo: {
-          criteria: ""
-        },
-        tabIndex: 0
+          criteria: "",
+          notification: ""
+        }
       },
       table: {
         loading: false,
         list: [],
         total: 0
       },
-      dateRangeTab: [{
-        name: "Boot Notification",
-        total: 1
-      },{
-        name: "Disconnected",
-        total: 1
-      },{
-        name: "Faulted",
-        total: 1
-      },{
-        name: "Connected",
-        total: 1
-      },{
-        name: "Charging",
-        total: 1
-      },{
-        name: "Finishing",
-        total: 1
+      typeTabs: [{
+        name: "Loading...",
+        value: "-"
       }]
     }
   },
   components: { Pagination },
   created() {
-    this.getTableData()
+    this.getTabList();
   },
   methods: {
+    getTabList() {
+      this.table.loading = true;
+      api.getConnectivityTabs().then(res => {
+        if (res.data) {
+          this.typeTabs = res.data;
+          const type = window.sessionStorage.getItem("notification")
+          if (type) this.params.pageVo.notification = type;
+          this.getTableData();
+        } else {
+          this.table.loading = false;
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+        this.table.loading = false;
+      })
+    },
     getTableData() {
       this.table.loading = true;
-      error.getConnectivityPages(this.params).then(res => {
+      api.getConnectivityPages(this.params).then(res => {
         if (res.data) {
           this.table.list = res.data
           this.table.total = res.total
@@ -148,14 +153,20 @@ export default {
       })
     },
     changeTab() {
-      
+      window.sessionStorage.setItem("notification", this.params.pageVo.notification)
+      this.getTableData();
     },
     handleCommand(func, item) {
       this[func](item)
     },
     viewDetail(row) {
+      const params = {
+        sitePk: row.sitePk,
+        //siteName: row.siteName,
+        chargeBoxId: row.chargeBoxId
+      }
       this.$router.push({
-        path: "/incident/charger-connectivity/info/" + row.chargerConnectivityId
+        path: "/incident/charger-connectivity/info/" + Base64.encode(JSON.stringify(params))
       })
     }
   }
@@ -166,6 +177,7 @@ export default {
 @import '../../styles/element-ui.scss';
 .radio-group {
   padding-top: 5px;
+  user-select: none;
 }
 .radio-group ::v-deep .el-radio-button {
   padding: 5px;

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

@@ -92,7 +92,7 @@
 <script>
 import Pagination from '@/components/Pagination'
 import TableAction from '@/components/TableAction.vue'
-import error from '@/http/api/error'
+import api from '@/http/api/incident'
 
 export default {
   components: { Pagination, TableAction },
@@ -132,7 +132,7 @@ export default {
           criteria: this.filter.search,
         },
       }
-      error.fetchErrorPages(params).then((response) => {
+      api.fetchErrorPages(params).then((response) => {
         const {success, data, total } = response
         if (success) {
           this.tableList = data

+ 129 - 52
Strides-Admin/src/views/incident/info.vue

@@ -1,6 +1,6 @@
 <template>
-  <div class="card-container">
-    <div class="card-content" v-loading="loading">
+  <div class="app-container">
+    <div class="card-content" v-if="false">
       <el-form
         :model="form"
         :rules="rule"
@@ -11,21 +11,25 @@
           label="Site Name:">
           <el-input
             class="add-text"
-            v-model="form.siteName"
+            v-model="table.list[0].siteName"
             placeholder="Add text"
             maxlength="100"
-            readonly/>
+            readonly
+            v-if="table.total"/>
         </el-form-item>
         <el-form-item
           label="Station ID:">
-          <el-input
-            class="add-text"
-            v-model="form.chargeBoxId"
-            placeholder="Add text"
-            maxlength="100"
-            readonly/>
+          <div class="flexcwr">
+            <el-input
+              class="add-text"
+              v-model="params.pageVo.chargeBoxId"
+              style="margin-bottom: 10px;"
+              placeholder="Add text"
+              maxlength="100"
+              readonly/>
+          </div>
         </el-form-item>
-        <el-form-item
+        <!--el-form-item
           label="Connector: ">
           <div class="flexcwr">
             <el-input
@@ -42,48 +46,56 @@
               Export
             </el-button>
           </div>
-        </el-form-item>
+        </el-form-item-->
       </el-form>
-      <el-table
-        class="info-table"
-        :data="tableList">
-        <el-table-column
-          label="Timestamp"
-          align="center"
-          prop="abf">
-        </el-table-column>
-        <el-table-column
-          label="Notification"
-          align="center"
-          prop="abf">
-        </el-table-column>
-        <el-table-column
-          label="Connector ID"
-          align="center"
-          prop="abf">
-        </el-table-column>
-        <el-table-column
-          label="Connector Status"
-          align="center"
-          prop="abf">
-        </el-table-column>
-        <el-table-column
-          label="Error Code"
-          align="center"
-          prop="abf">
-        </el-table-column>
-        <el-table-column
-          label="Active Transaction"
-          align="center"
-          prop="abf">
-        </el-table-column>
-      </el-table>
+    </div>
+    <div class="filter-container right">
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="onExport">
+        Export
+      </el-button>
+    </div>
+    <el-table
+      class="info-table"
+      :data="table.list">
+      <el-table-column
+        label="Site Name"
+        align="center"
+        prop="siteName">
+      </el-table-column>
+      <el-table-column
+        label="Station ID"
+        align="center"
+        prop="chargeBoxId">
+      </el-table-column>
+      <el-table-column
+        label="Notification"
+        align="center"
+        prop="notification">
+      </el-table-column>
+      <el-table-column
+        label="Timestamp"
+        align="center"
+        prop="timestamp">
+      </el-table-column>
+    </el-table>
+    <div class="right">
+      <pagination
+        v-show="table.total > 0"
+        :total="table.total"
+        :page.sync="params.pageNo"
+        :limit.sync="params.pageSize"
+        @pagination="getDetail" />
     </div>
   </div>
 </template>
 
 <script>
-import error from '@/http/api/error'
+import api from '@/http/api/incident'
+import { Base64 } from 'js-base64';
+import Pagination from '@/components/Pagination'
 export default {
   data() {
     return {
@@ -94,18 +106,83 @@ export default {
       rule: {
         
       },
-      tableList: []
+      params: {
+        pageNo: 1,
+        pageSize: 10,
+        pageVo: {
+          sitePk: "",
+          chargeBoxId: ""
+        }
+      },
+      table: {
+        list: [],
+        total: 0,
+        loading: false
+      }
     }
   },
+  components: { Pagination },
   created() {
-    this.getDetail();
+    if (this.$route.params.id) {
+      const params = JSON.parse(Base64.decode(this.$route.params.id));
+      this.params.pageVo = params;
+      this.getDetail();
+    }
   },
   methods: {
     getDetail() {
-      
+      this.table.loading = true;
+      api.viewConnectivityInfo(this.params).then(res => {
+        if (res.data) {
+          this.table.list = res.data
+          this.table.total = res.total
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.table.loading = false
+      })
     },
     onExport() {
-      
+      this.loading = true;
+      api.exportConnectivity(this.params.pageVo).then(res => {
+        if (res && res.size > 0) {
+          const name = 'Export-' + this.params.pageVo.chargeBoxId + '-' + new Date().getTime() + '.xls'
+          this.downloadFile(res, name);
+        } else {
+          this.$message.error('Empty files');
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    downloadFile(res, fileName) {
+      const blob = new Blob([res], {
+        type: 'application/pdf;charset=utf-8'
+      })
+      // let href = window.URL.createObjectURL(blob)
+      if ('download' in document.createElement('a')) {
+        // 非IE下载
+        const elink = document.createElement('a')
+        elink.download = fileName
+        elink.style.display = 'none'
+        elink.href = URL.createObjectURL(blob)
+        document.body.appendChild(elink)
+        elink.click()
+        URL.revokeObjectURL(elink.href) // 释放URL 对象
+        document.body.removeChild(elink)
+      } else {
+        // IE10+下载
+        navigator.msSaveBlob(blob, fileName)
+      }
     }
   }
 }
@@ -139,7 +216,7 @@ export default {
   }
   .info-table {
     width: 100%;
-    min-height: 60vh;
+    min-height: 65vh;
     margin-top: 20px;
   }
   

+ 4 - 2
Strides-Admin/src/views/provider/addProvider.vue

@@ -177,7 +177,7 @@
             message: 'Add service provider successfully',
             type: 'success'
           })
-          this.$router.go(-1)
+          this.handleClickCancleButton();
         }).catch(err => {
           this.loading = false;
           this.$message({
@@ -187,7 +187,9 @@
         });
       },
       handleClickCancleButton() {
-        this.$router.go(-1)
+        this.$router.push({
+          path: "/service-provider-management/index"
+        })
       }
     }
   }

+ 5 - 1
Strides-Admin/src/views/provider/detail.vue

@@ -260,7 +260,11 @@
       },
       handleClickCancleButton() {
         this.loading = false;
-        this.$router.push("/service-provider-management/index")
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: "/service-provider-management/index"
+          })
+        });
       }
     }
   }