Răsfoiți Sursa

Amend err to error, resolve route permission

vbea 2 ani în urmă
părinte
comite
7cc9fbc83e

+ 1 - 0
Strides-Admin/src/settings.js

@@ -15,6 +15,7 @@ module.exports = {
   defaultCalling: '65',
   dashboardVersion: 2,
   enableWebPos: true,
+  enableTopup: false,
   /**
    * @type {string}
    * @description API url base service

+ 7 - 4
Strides-Admin/src/store/modules/permission.js

@@ -64,8 +64,8 @@ const actions = {
   }
 }
 
-function filterRoutes(routes) {
-  //console.log("路由遍历", routes);
+function filterRoutes(routes, parent) {
+  //console.log("路由遍历", routes, parent);
   routes.forEach((route) => {
     const authRoute = state.addRoutes.find(authRoute => (authRoute[permission.RESOURCE_KEY] === route.path))
     if (authRoute) {
@@ -75,11 +75,14 @@ function filterRoutes(routes) {
       } else {
         route.meta = { onlyView: authRoute.onlyView }
       }
+      if (parent) {
+        parent.hidden = false;
+      }
     } else {
-      route.hidden = true
+      route.hidden = true;
     }
     if (route.children) {
-      filterRoutes(route.children)
+      filterRoutes(route.children, route)
     }
   })
 }

+ 1 - 1
Strides-Admin/src/views/campaign/detail.vue

@@ -326,7 +326,7 @@ export default {
         if (res.data) {
           this.userTypeOptions = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 2 - 2
Strides-Admin/src/views/company/index.vue

@@ -215,7 +215,7 @@ export default {
         if (res.data) {
           this.groupTypes = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -227,7 +227,7 @@ export default {
         if (res.data) {
           this.countryList = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 2 - 2
Strides-Admin/src/views/feedback/FeedbackManagement.vue

@@ -126,7 +126,7 @@
           if (res.data) {
             this.typeOptions = res.data
           }
-        }).catch(err => {
+        }).catch(error => {
           this.$message({
             message: error,
             type: 'error'
@@ -139,7 +139,7 @@
           this.listLoading = false;
           this.total = res.total;
           this.tableList = res.data
-        }).catch(err => {
+        }).catch(error => {
           this.listLoading = false;
           this.total = 0;
           this.tableList = [];

+ 27 - 24
Strides-Admin/src/views/financial/CreditActionDialog.vue

@@ -117,37 +117,37 @@
       <div
         class="flexcc"
         style="padding-top: 20px;"
-        v-if="isApprove"
-        v-show="form.creditActionStatus == 'Pending Approval'">
+        v-if="!isApprove">
         <el-button
-          class="cancel-button button-reject"
-          @click="onApprove('Rejected')"
-          :disabled="loadingBtn">
-          REJECT
+          class="cancel-button"
+          @click="hideDialog">
+          CANCEL
         </el-button>
         <el-button
-          type="accent"
-          @click="onApprove('Approved')"
-          :disabled="loadingBtn">
-          APPROVE
+          type="primary"
+          @click="onSubmit"
+          :loading="loadingBtn">
+          SUBMIT
         </el-button>
       </div>
       <div
         class="flexcc"
         style="padding-top: 20px;"
-        v-else>
+        v-else-if="form.creditActionStatus == 'Pending Approval' && form.permission">
         <el-button
-          class="cancel-button"
-          @click="hideDialog">
-          CANCEL
+          class="cancel-button button-reject"
+          @click="onApprove('Rejected')"
+          :disabled="loadingBtn">
+          REJECT
         </el-button>
         <el-button
-          type="primary"
-          @click="onSubmit"
-          :loading="loadingBtn">
-          SUBMIT
+          type="accent"
+          @click="onApprove('Approved')"
+          :disabled="loadingBtn">
+          APPROVE
         </el-button>
       </div>
+      
     </el-form>
   </el-dialog>
 </template>
@@ -176,7 +176,8 @@ export default {
         creditActionId: "",
         creditActionType: "",
         creditActionAmount: "",
-        creditActionRemarks: ""
+        creditActionRemarks: "",
+        permission: false
       },
       rules: {
         userPk: {
@@ -230,7 +231,10 @@ export default {
           if (this.request) {
             this.isApprove = true;
             this.approve.creditActionId = this.request;
-            this.getActionInfo();
+            this.loading = true;
+            setTimeout(() => {
+              this.getActionInfo();
+            }, 300);
           } else {
             this.isApprove = false;
             this.form = {
@@ -265,7 +269,7 @@ export default {
         } else {
           this.options.user = []
         }
-      }).catch(() => {
+      }).catch(err => {
         this.$message({
           message: err,
           type: 'error',
@@ -283,14 +287,13 @@ export default {
         }
       }).catch(err => {
         this.$message({
-          message: error,
+          message: err,
           type: 'error'
         })
         this.options.action = []
       })
     },
     getActionInfo() {
-      this.loading = true;
       financial.viewCreditApply(this.approve.creditActionId).then(res => {
         if (res.data) {
           this.form = res.data;
@@ -299,7 +302,7 @@ export default {
         this.loading = false;
       }).catch(err => {
         this.$message({
-          message: error,
+          message: err,
           type: 'error'
         })
         this.loading = false;

+ 5 - 11
Strides-Admin/src/views/financial/CreditAmendment.vue

@@ -64,11 +64,7 @@
         <template slot-scope="{row}">
           <div
             class="link-type"
-            @click="onClickEdit(row)"
-            v-if="$route.meta.onlyView">
-            {{row.creditActionId}}
-          </div>
-          <div v-else>
+            @click="onClickEdit(row)">
             {{row.creditActionId}}
           </div>
         </template>
@@ -178,7 +174,7 @@ export default {
         }
       }).catch(err => {
         this.$message({
-          message: error,
+          message: err,
           type: 'error'
         })
         this.options.action = []
@@ -193,7 +189,7 @@ export default {
         }
       }).catch(err => {
         this.$message({
-          message: error,
+          message: err,
           type: 'error'
         })
         this.options.status = []
@@ -225,10 +221,8 @@ export default {
       this.dialog.visible = true;
     },
     onClickEdit(row) {
-      if (this.$route.meta.onlyView) {
-        this.dialog.request = row.creditActionId;
-        this.dialog.visible = true;
-      }
+      this.dialog.request = row.creditActionId;
+      this.dialog.visible = true;
     },
     hideDialog(e) {
       this.dialog.request = "";

+ 1 - 1
Strides-Admin/src/views/financial/IdleFee.vue

@@ -200,7 +200,7 @@ export default {
         if (res.data) {
           this.userTypeOptions = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 1 - 1
Strides-Admin/src/views/financial/index.vue

@@ -238,7 +238,7 @@ export default {
         if (res.data) {
           this.userTypeOptions = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 2 - 2
Strides-Admin/src/views/financial/transactions.vue

@@ -138,7 +138,7 @@ export default {
         if (res.data) {
           this.options.paymentStatus = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -150,7 +150,7 @@ export default {
         if (res.data) {
           this.options.creditType = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 2 - 2
Strides-Admin/src/views/ocpp/OCPPOperations.vue

@@ -530,7 +530,7 @@
           }
           this.siteLoading = false;
           this.changeSite();
-        }).catch(err => {
+        }).catch(error => {
           this.siteLoading = false;
           this.$message({
             message: error,
@@ -552,7 +552,7 @@
             this.total = res.total;
             this.stationList = res.data;
           }
-        }).catch(err => {
+        }).catch(error => {
           this.$message({
             message: error,
             type: 'error'

+ 1 - 1
Strides-Admin/src/views/rfid/index.vue

@@ -189,7 +189,7 @@ export default {
         if (res.data) {
           this.userTypes = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 1 - 1
Strides-Admin/src/views/settlement/AccountSetle.vue

@@ -170,7 +170,7 @@ export default {
         if (res.data) {
           this.options.types = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 4 - 4
Strides-Admin/src/views/settlement/DetailAccount.vue

@@ -375,7 +375,7 @@ export default {
         } else {
           this.options.accountType = []
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -390,7 +390,7 @@ export default {
         } else {
           this.options.billingType = []
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -403,7 +403,7 @@ export default {
         if (res.data) {
           this.options.itemType = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -418,7 +418,7 @@ export default {
             this.addAdditionalItem();
           }
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 1 - 1
Strides-Admin/src/views/site/components/WhiteListFleet.vue

@@ -110,7 +110,7 @@ export default {
         if (this.fleetWhitelist.length === 0) {
           this.handleClickAddWhiteFleetButton()
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$notify({
           type: 'error',
           message: error,

+ 5 - 7
Strides-Admin/src/views/transaction/transactions.vue

@@ -298,11 +298,6 @@ export default {
           this.filterOptions = res.data
           this.filter.pageVo.filter = res.data[0].value
           this.getList()
-        } else {
-          this.$message({
-            message: error,
-            type: 'error'
-          })
         }
       })
     },
@@ -340,7 +335,7 @@ export default {
         if (res.data) {
           this.userTypeOptions = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -379,7 +374,10 @@ export default {
           this.$message.error('Empty files');
         }
       } catch (err) {
-        
+        this.$message({
+          type: "error",
+          message: err
+        })
       } finally {
         this.listLoading = false;
       }

+ 10 - 8
Strides-Admin/src/views/user/detail.vue

@@ -134,11 +134,7 @@
             <el-col :xs="24" :md="12">
               <el-form-item
                 label="Credit Amount:">
-                <el-input
-                  class="input-text"
-                  :value="userForm.currencySymbol + ' ' + userForm.credit"
-                  readonly/>
-                <div class="flexc input-text" v-if="false">
+                <div class="flexc input-text" v-if="enableTopup">
                   <el-input
                     class="input-text-1"
                     :value="userForm.currencySymbol + ' ' + userForm.credit"
@@ -149,6 +145,11 @@
                     TOP UP
                   </el-button>
                 </div>
+                <el-input
+                  v-else
+                  class="input-text"
+                  :value="userForm.currencySymbol + ' ' + userForm.credit"
+                  readonly/>
               </el-form-item>
             </el-col>
             <el-col :xs="24" :md="12">
@@ -309,7 +310,8 @@ export default {
         }
       },
       isEdit: false,
-      showTopup: false
+      showTopup: false,
+      enableTopup: settings.enableTopup
     }
   },
   mounted() {
@@ -331,7 +333,7 @@ export default {
         if (res.data) {
           this.options.country = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -348,7 +350,7 @@ export default {
         if (res.data) {
           this.options.userType = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 7 - 4
Strides-Admin/src/views/user/index.vue

@@ -204,7 +204,8 @@
                 Edit
               </el-dropdown-item>
               <el-dropdown-item
-                command="showTopupModal">
+                command="showTopupModal"
+                v-if="enableTopup">
                 Top Up Credits
               </el-dropdown-item>
               <el-dropdown-item
@@ -248,6 +249,7 @@ import TopUp from './views/TopUp.vue'
 import api from '@/http/api/apiUser'
 import { baseURL } from '@/http/http'
 import { getToken } from '@/utils/auth'
+import settings from '../../settings.js'
 export default {
   data() {
     return {
@@ -278,7 +280,8 @@ export default {
       actionTopup: {
         row: {},
         visible: false
-      }
+      },
+      enableTopup: settings.enableTopup
     }
   },
   computed: {
@@ -312,7 +315,7 @@ export default {
         if (res.data) {
           this.userTypes = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'
@@ -350,7 +353,7 @@ export default {
         if (res.data) {
           this.groupStatus = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 1 - 1
Strides-Admin/src/views/vehicle-model/detail.vue

@@ -112,7 +112,7 @@ export default {
       if (query) {
         api.getBrandsOptions(query).then(res => {
           cb(res.data)
-        }).catch(err => {
+        }).catch(error => {
           this.$message({
             message: error,
             type: 'error'

+ 1 - 1
Strides-Admin/src/views/vehicle-model/index.vue

@@ -113,7 +113,7 @@ export default {
         if (res.data) {
           this.brandOptions = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: 'error'

+ 3 - 3
Strides-Admin/src/views/zetting/ChargeType.vue

@@ -182,7 +182,7 @@ export default {
           }
         }
         this.getChargeTypeList();
-      }).catch(err => {
+      }).catch(error => {
         this.loading = false;
         this.$message({
           message: error,
@@ -197,7 +197,7 @@ export default {
           this.plugTypeOptions = res.data
           this.chargeType.plugType = res.data[0]
         }
-      }).catch(err => {
+      }).catch(error => {
         this.loading = false;
         this.$message({
           message: error,
@@ -211,7 +211,7 @@ export default {
         if (res.data) {
           this.settingsForm = res.data
         }
-      }).catch(err => {
+      }).catch(error => {
         this.$message({
           message: error,
           type: "error",