yuhan 1 éve%!(EXTRA string=óta)
szülő
commit
5af200f305

+ 16 - 7
src/views/module_kzks/dashboard/Analysis.vue

@@ -300,7 +300,7 @@
     created() {
       this.initLogInfo();
       this.getZhibiaoCollect()
-      this.setNowDate()
+      this.setNowDate('month')
     },
     methods: {
       getZhibiaoCollect(){
@@ -330,18 +330,25 @@
           this.loading = false
         })
       },
-      setNowDate(){
+      setNowDate(type){
         const now = new Date()
         const year = now.getFullYear(); // 年
         const month = now.getMonth() + 1; // 月
         const beginDate = `${year}-01`
         const endDate = `${year}-${month}`
-        console.log(month)
         this.dateValue = [beginDate, endDate]
-        this.searchParams = {
-          time: 'month',
-          beginDate: beginDate,
-          endDate: endDate,
+        if(type === 'month'){
+          this.searchParams = {
+            time: 'month',
+            beginDate: beginDate,
+            endDate: endDate,
+          }
+        } else if (type === 'year') {
+          this.searchParams = {
+            time: 'year',
+            beginDate: year - 1,
+            endDate: year,
+          }
         }
         this.getDataByDate()
       },
@@ -422,11 +429,13 @@
       },
       // 查询类型选择:按年、按月
       searchTypeChange(type){
+        // this.resetParams()
         this.searchTypeMonth = type === 'month' ? 'primary' : 'link'
         this.searchTypeYear = type === 'year' ? 'primary' : 'link'
         this.searchFormat = type === 'month' ? 'YYYY-MM' : 'YYYY'
         this.searchPlaceholder = type === 'month' ? ['开始月份', '结束月份'] : ['开始年份', '结束年份']
         this.searchMode = [type, type]
+        this.setNowDate(type)
       },
       handlePanelChange(value, mode) {
         // console.log(value, this.searchMode)

+ 2 - 0
src/views/module_kzks/dashboard/components/twoYAxisChart.vue

@@ -35,6 +35,7 @@ export default {
           this.setSeriesData(newValue)
         }
       },
+      deep: true,
       // immediate: true
     }
   },
@@ -146,6 +147,7 @@ export default {
       var seriesData = data ? data : this.seriesData
       // console.log(seriesData)
       // var option = this.uOption
+      this.uOption.xAxis.data = this.xAxisData
       this.uOption.series = seriesData.map((res, index) => {
         return {
           name: res.name,