zhibin il y a 6 ans
Parent
commit
d5e2c6edf1
2 fichiers modifiés avec 23 ajouts et 4 suppressions
  1. 1 1
      src/page/layout/slide.vue
  2. 22 3
      src/page/statistics/index.vue

+ 1 - 1
src/page/layout/slide.vue

@@ -60,7 +60,7 @@ export default {
         ],
         top: 154
       },
-      { text: '设备管理', link: {name: 'Statistics'}, top: 42 }
+      { text: '数据统计', link: {name: 'Statistics'}, top: 42 }
       // ,
       // {
       //   text: 'BBS',

+ 22 - 3
src/page/statistics/index.vue

@@ -1,8 +1,17 @@
 <template>
 
-  <div>
+  <div v-loading="loadding">
     <div class="card-layer">
       <div class="filter">
+        <el-date-picker
+          v-model="date"
+          type="daterange"
+          align="right"
+          unlink-panels
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
         <el-select v-model="searchKey" clearable filterable placeholder="所有场景">
           <el-option
             v-for="item in keyoptions"
@@ -54,15 +63,18 @@ const data = {
 		"siteId": "13790587",
 		"method": "visit/toppage/a",
 		"start_date": "20160501",
-		"end_date": "20190813",
+		"end_date": (new Date()).format('yyyyMMdd'),
 		"metrics": "pv_count,visitor_count",
-		"search_word": "123"
+    "search_word": "123",
+    "order": "desc"
 	}
 }
 
 export default {
   data () {
     return {
+      date: null,
+      loadding: true,
       body: {...data},
       result: null,
       searchKey: null,
@@ -207,10 +219,17 @@ export default {
   },
   methods: {
     async referData() {
+      this.loadding = true
       this.result = (await this.$http.post('https://api.baidu.com/json/tongji/v1/ReportService/getData', JSON.stringify(this.body))).body.data[0].result
+      this.loadding = false
     }
   },
   watch: {
+    date () {
+      this.body.body.start_date = this.date[0].format('yyyyMMdd')
+      this.body.body.end_date = this.date[1].format('yyyyMMdd')
+      this.referData()
+    },
     openType () {
       this.case1.setOption(this.openType)
     },