Browse Source

fix date fordate

liutian 2 years ago
parent
commit
7f54327b32

+ 8 - 1
.eslintrc.js

@@ -15,6 +15,13 @@ module.exports = {
     'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
     'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
     'vue/multi-word-component-names': 'off',
-    '@typescript-eslint/no-var-requires': 0 // require部分没有通过import引入
+    '@typescript-eslint/no-var-requires': 0, // require部分没有通过import引入
+    '@typescript-eslint/no-this-alias': [
+      'error',
+      {
+        'allowDestructuring': false, // Disallow `const { props, state } = this`; true by default
+        'allowedNames': ['self'] // Allow `const self = this`; `[]` by default
+      }
+    ]
   }
 }

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "axios": "^1.1.3",
     "clipboard": "^2.0.11",
     "crypto-js": "^4.1.1",
+    "dayjs": "^1.11.6",
     "echarts": "^5.4.0",
     "element-ui": "^2.15.12",
     "pinia": "^2.0.24",

+ 0 - 3
src/assets/scss/element-variables.scss

@@ -192,9 +192,6 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
 }
 // 表格 - API Keys页
 .el-table {
-  .el-table__body-wrapper {
-    overflow: visible;
-  }
   th.el-table__cell {
     padding: 16px 0;
     > .cell {

+ 1 - 1
src/components/progress/Progress.vue

@@ -3,7 +3,7 @@
     <div class="progress-content">
       <div class="text">
         <span><span :class="{'full': usedAmount > totalAmount*0.9}">{{ usedAmount }}</span> / {{ totalAmount }} <br class="min"/>processed files this month.</span>
-        <a> More details</a>
+        <router-link to="/billing/plan"> More details</router-link>
       </div>
       <div @click="refresh" class="refresh">
         <img src="@/assets/images/common/refresh.svg" alt="refresh" :class="{'rotate360': rotate}" @animationend="rotateReset">

+ 20 - 7
src/views/projects/dashboard.vue

@@ -21,7 +21,7 @@
               :class="{'picked' : datePickerValue.length !== 0}"
               ref="date-picker">
             </el-date-picker> -->
-            <span @click="selectTime(4)">{{( datePickerValue.length === 2 ? formatterDate(datePickerValue[0]) + '-' + formatterDate(datePickerValue[1]) : 'Custom' )}}</span>
+            <span @click="selectTime(4)">{{( datePickerValue.length === 2 ? fillerDate(datePickerValue[0]) + ' - ' + fillerDate(datePickerValue[1]) : 'Custom' )}}</span>
             <Calender v-show="showCalender" @checkedDate="checkedDate"></Calender>
           </li>
         </ul>
@@ -117,6 +117,7 @@
 </template>
 
 <script>
+import dayjs from 'dayjs'
 import Progress from '@/components/progress/Progress.vue'
 import Calender from '@/components/calendar/calendar.vue'
 import {
@@ -172,6 +173,9 @@ export default {
     }
   },
   methods: {
+    fillerDate (val) {
+      return dayjs(val).format('MMM D,YYYY')
+    },
     // 选择时间段
     selectTime (val) {
       this.timeSelected = val
@@ -203,6 +207,7 @@ export default {
       if (myChart == null) {
         myChart = this.$echarts.init(this.$refs.chart)
       }
+      const self = this
       myChart.setOption({
         title: {
           text: 'Successful Requests',
@@ -249,7 +254,8 @@ export default {
         },
         grid: {
           left: 50,
-          right: 10
+          right: 50,
+          containLabel: true
         },
         xAxis: {
           data: this.xData,
@@ -267,6 +273,9 @@ export default {
           },
           axisLabel: {
             formatter: function (value) {
+              if (self.timeSelected === 1) {
+                return value.split(' ')[2]
+              }
               return value.split(' ')[1].split(',')[0]
             }
           }
@@ -440,7 +449,7 @@ export default {
             this.projects.push(res.data[i])
           }
         } else {
-          this.$message.error('Failed to connect.')
+          this.$message.error(res.msg)
         }
       }).catch(err => {
         console.log(err)
@@ -456,7 +465,7 @@ export default {
             this.tools.push(res.data[i])
           }
         } else {
-          this.$message.error('Failed to connect.')
+          this.$message.error(res.msg)
         }
       }).catch(err => {
         console.log(err)
@@ -476,7 +485,7 @@ export default {
         if (res.code === '200') {
           this.analysisData = res.data
         } else {
-          this.$message.error('Failed to connect.')
+          this.$message.error(res.msg)
         }
       }).catch(err => {
         console.log(err)
@@ -497,13 +506,17 @@ export default {
           this.xData = []
           this.yData = []
           res.data.forEach(item => {
-            this.xData.push(this.formatterDate(item.xdata))
+            if (this.timeSelected === 1) {
+              this.xData.push(this.formatterDate(item.xdata))
+            } else {
+              this.xData.push(this.fillerDate(item.xdata))
+            }
             this.yData.push(item.ydata.replace(/[^\d.]/g, ''))
           })
           this.yDataUnit = res.data[0].ydata.replace(/[\d.]/g, '')
           this.drawLine()
         } else {
-          this.$message.error('Failed to connect.')
+          this.$message.error(res.msg)
         }
       }).catch(err => {
         console.log(err)