Kaynağa Gözat

配方统计修改筛选时间为7天

duanxiaoduan 1 yıl önce
ebeveyn
işleme
9fa1b5f370

+ 12 - 2
src/views/statisticalAnalysis/formulaStatistics/index.vue

@@ -91,11 +91,21 @@
     },
 
     created() {
-      // this.getChart1()
+      this.getTimeFn()
       this.getChart1()
     },
 
-    methods: {
+    methods: {
+      getTimeFn() {
+        const that = this
+        const start = new Date()
+        const end = new Date()
+        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
+        end.setTime(end.getTime() - 3600 * 1000 * 24 * 1)
+        that.startTime = parseTime(start, '{y}-{m}-{d}')
+        that.endTime = parseTime(end, '{y}-{m}-{d}')
+        that.inputDatetime = [start, end]
+      },
       handleBefore() {
         if (this.inputDatetime !== '' && this.inputDatetime !== null) {
           var start = new Date(this.inputDatetime[0].setDate(this.inputDatetime[0].getDate() - 1))