Kaynağa Gözat

#13092 Add "log" from old juice+ into Error table

vbea 3 yıl önce
ebeveyn
işleme
af444f51c2

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

@@ -23,6 +23,9 @@ const incident = {
   },
   },
   exportConnectivity(data) {
   exportConnectivity(data) {
     return download('charger-connectivity/export', data)
     return download('charger-connectivity/export', data)
+  },
+  downloadLog() {
+    return download('base/download/log')
   }
   }
 }
 }
 
 

+ 1 - 1
Strides-Admin/src/styles/btn.scss

@@ -98,6 +98,6 @@
   border-radius: 4px;
   border-radius: 4px;
 }
 }
 
 
-.el-button.el-button--content {
+.el-button.el-button--content:not(.is-disabled) {
   color: #232323;
   color: #232323;
 }
 }

+ 48 - 0
Strides-Admin/src/views/incident/error_table.vue

@@ -16,6 +16,15 @@
             Search
             Search
           </el-button>
           </el-button>
         </div>
         </div>
+        <div class="filter-flex-button">
+          <el-button
+            type="primary"
+            icon="el-icon-download"
+            :loading="logLoading"
+            @click="handleDownloadLog">
+            LOG
+          </el-button>
+        </div>
       </div>
       </div>
     </div>
     </div>
     <el-table
     <el-table
@@ -103,6 +112,7 @@ export default {
         search: "",
         search: "",
       },
       },
       listLoading: true,
       listLoading: true,
+      logLoading: false,
       tableList: [],
       tableList: [],
       total: 0,
       total: 0,
       listQuery: {
       listQuery: {
@@ -124,6 +134,24 @@ export default {
       this.listLoading = true;
       this.listLoading = true;
       this.getList();
       this.getList();
     },
     },
+    handleDownloadLog() {
+      this.logLoading = true;
+      api.downloadLog().then(res => {
+        if (res && res.size > 0) {
+          const name = 'Log-' + new Date().getTime() + '.log'
+          this.downloadFile(res, name);
+        } else {
+          this.$message.error('Empty files');
+        }
+      }).catch(err => {
+        this.$message({
+          type: 'error',
+          message: err
+        })
+      }).finally(() => {
+        this.logLoading = false
+      })
+    },
     getList() {
     getList() {
       this.listLoading = true
       this.listLoading = true
       const params = {
       const params = {
@@ -147,6 +175,26 @@ export default {
       }).finally(() => {
       }).finally(() => {
         this.listLoading = false
         this.listLoading = 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)
+      }
     }
     }
   }
   }
 }
 }

+ 25 - 7
Strides-Admin/src/views/login/otp.vue

@@ -16,8 +16,16 @@
         :loading="loading"
         :loading="loading"
         type="content"
         type="content"
         class="forgot-button"
         class="forgot-button"
-        @click="sendOTP">
-        RESEND OTP
+        @click="sendOTP"
+        v-if="resendTime == 0">
+        SEND OTP
+      </el-button>
+      <el-button
+        type="content"
+        class="forgot-button"
+        disabled
+        v-else>
+        {{resendTime}} s
       </el-button>
       </el-button>
     </div>
     </div>
   </div>
   </div>
@@ -45,7 +53,8 @@
       return {
       return {
         otp: "",
         otp: "",
         loading: false,
         loading: false,
-        loadingV: false
+        loadingV: false,
+        resendTime: 0
       };
       };
     },
     },
     mounted() {
     mounted() {
@@ -58,13 +67,14 @@
           email: this.loginInfo.email,
           email: this.loginInfo.email,
           type: this.isReset ? "reset" : "login"
           type: this.isReset ? "reset" : "login"
         }).then(res => {
         }).then(res => {
-          /*if (res.data.resendTime) {
-            
-          }*/
+          this.resendTime = res.data.resendTime || 60
           this.$message({
           this.$message({
             type: 'success',
             type: 'success',
             message: "Send OTP successfully!"
             message: "Send OTP successfully!"
           })
           })
+          setTimeout(() => {
+            this.contantTimer();
+          }, 500);
         }).catch(err => {
         }).catch(err => {
           this.$message({
           this.$message({
             type: 'error',
             type: 'error',
@@ -104,6 +114,14 @@
         }).finally(() => {
         }).finally(() => {
           this.loadingV = false;
           this.loadingV = false;
         })
         })
+      },
+      contantTimer() {
+        if (this.resendTime > 0) {
+          this.resendTime -= 1;
+          setTimeout(() => {
+            this.contantTimer();
+          }, 1000)
+        }
       }
       }
     }
     }
   }
   }
@@ -125,7 +143,7 @@
   .forgot-button {
   .forgot-button {
     width:100%;
     width:100%;
     padding: 15px;
     padding: 15px;
-    margin: 0 0 20px;
     font-weight: bold;
     font-weight: bold;
+    margin: 0 0 20px !important;
   }
   }
 </style>
 </style>

+ 1 - 1
Strides-Admin/vue.config.js

@@ -115,7 +115,7 @@ module.exports = {
                   chunks: 'initial' // only package third parties that are initially dependent
                   chunks: 'initial' // only package third parties that are initially dependent
                 },
                 },
                 elementUI: {
                 elementUI: {
-                  name: 'chunk-elementUI', // split elementUI into a single package
+                  name: 'chunk-theme', // split elementUI into a single package
                   priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
                   priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
                   test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
                   test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
                 },
                 },