Browse Source

统计是否显示

魏熙美 5 years ago
parent
commit
8c2273b17b
1 changed files with 35 additions and 11 deletions
  1. 35
    11
      src/views/indexEcharts/index.vue

+ 35
- 11
src/views/indexEcharts/index.vue View File

1
 <template>
1
 <template>
2
 <div class="chart-index">
2
 <div class="chart-index">
3
   <el-row class="top-info"  :gutter="20">
3
   <el-row class="top-info"  :gutter="20">
4
-    <el-col :span="8">
4
+    <el-col :span="8" v-if="checkedReport.includes('total_number_of_users')">
5
       <card label="总用户">{{echartsInfo.selectUserCount}}</card>
5
       <card label="总用户">{{echartsInfo.selectUserCount}}</card>
6
     </el-col>
6
     </el-col>
7
-    <el-col :span="8">
7
+    <el-col :span="8" v-if="checkedReport.includes('total_number_of_registered_users')">
8
       <card label="总注册用户">{{echartsInfo.selectRegisteredCount}}</card>
8
       <card label="总注册用户">{{echartsInfo.selectRegisteredCount}}</card>
9
     </el-col>
9
     </el-col>
10
-    <el-col :span="8">
10
+    <el-col :span="8" v-if="checkedReport.includes('total_number_of_registered_users')">
11
       <card label="最近7天新增" @click.native="toNewUsers" class="under-line" >{{echartsInfo.selectRecentlyCount}}</card>
11
       <card label="最近7天新增" @click.native="toNewUsers" class="under-line" >{{echartsInfo.selectRecentlyCount}}</card>
12
     </el-col>
12
     </el-col>
13
   </el-row>
13
   </el-row>
14
-  <user-source mode="report" subtitle="最近七天" @click.native="toUserSource"></user-source>
15
-  <user-behavior class="marginTB" mode="lines" :select-building="true" @click.native="toBehaviorAnalysis" subtitle="最近七天"></user-behavior>
14
+  <user-source mode="report" subtitle="最近七天" @click.native="toUserSource"  v-if="checkedReport.includes('user_source')"></user-source>
15
+  <user-behavior class="marginTB" mode="lines" :select-building="true" @click.native="toBehaviorAnalysis" subtitle="最近七天" v-if="checkedReport.includes('user_behavior')"></user-behavior>
16
  <el-row :gutter="20">
16
  <el-row :gutter="20">
17
-    <el-col :span="12">
17
+    <el-col :span="12" v-if="checkedReport.includes('active_users')">
18
       <user-active></user-active>
18
       <user-active></user-active>
19
     </el-col>
19
     </el-col>
20
-    <el-col :span="12">
20
+    <el-col :span="12"  v-if="checkedReport.includes('conversion_rate')">
21
       <user-conversion></user-conversion>
21
       <user-conversion></user-conversion>
22
     </el-col>
22
     </el-col>
23
-    <el-col :span="12">
23
+    <el-col :span="12" v-if="checkedReport.includes('sex_ratio')">
24
       <user-sex></user-sex>
24
       <user-sex></user-sex>
25
     </el-col>
25
     </el-col>
26
-    <el-col :span="12">
26
+    <el-col :span="12" v-if="checkedReport.includes('urban_distribution')">
27
       <user-city></user-city>
27
       <user-city></user-city>
28
     </el-col>
28
     </el-col>
29
   </el-row>
29
   </el-row>
30
-  <new-users class="marginTB" mode="table"></new-users>
31
-  <intentional-customers class="marginTB"></intentional-customers>
30
+  <new-users class="marginTB" mode="table" v-if="checkedReport.includes('number_of_new_users')"></new-users>
31
+  <intentional-customers class="marginTB" v-if="checkedReport.includes('intentional_user')"></intentional-customers>
32
 </div>
32
 </div>
33
 </template>
33
 </template>
34
 
34
 
37
 import apis from "../../config/api";
37
 import apis from "../../config/api";
38
 import { mapState } from "vuex";
38
 import { mapState } from "vuex";
39
 import Echarts from "echarts";
39
 import Echarts from "echarts";
40
+const { mapActions: mapReportActions } = createNamespacedHelpers("report");
40
 const {
41
 const {
41
   mapState: mapIndexEchartsState,
42
   mapState: mapIndexEchartsState,
42
   mapActions: mapIndexEchartsActions
43
   mapActions: mapIndexEchartsActions
56
   },
57
   },
57
   data() {
58
   data() {
58
     return {
59
     return {
60
+        pageNavi: {
61
+            current: 1,
62
+            size: 200,
63
+            total: 0
64
+        },
65
+        checkedReport: [] // 是否展示报表
59
     };
66
     };
60
   },
67
   },
61
   computed: {
68
   computed: {
65
   },
72
   },
66
   methods: {
73
   methods: {
67
     ...mapIndexEchartsActions(["getIndexEcharts", "setDetailNull"]),
74
     ...mapIndexEchartsActions(["getIndexEcharts", "setDetailNull"]),
75
+    ...mapReportActions(["getReportList", "getReportCheckedList", "saveCheckedReport"]),
68
     initPage() {
76
     initPage() {
69
       this.setDetailNull();
77
       this.setDetailNull();
70
       this.getIndexEcharts().then(window.console.log);;
78
       this.getIndexEcharts().then(window.console.log);;
78
     toBehaviorAnalysis() {
86
     toBehaviorAnalysis() {
79
       this.$router.push({ name: "behaviorAnalysis" });
87
       this.$router.push({ name: "behaviorAnalysis" });
80
     },
88
     },
89
+    getCheckedList() { // 获取是否展示报表
90
+          const pageNumber = this.pageNavi.current || 1;
91
+          const pageSize = this.pageNavi.size;
92
+          this.getReportCheckedList({
93
+              pageNumber,
94
+              pageSize
95
+          }).then(res => {
96
+             const { records, ...pageNavi } = res;
97
+
98
+             this.checkedReport = (records || []).map((x) => x.reportCode);
99
+             this.pageNavi = pageNavi;
100
+          }).catch(err => {
101
+                  this.$notify.error(err.msg || err.message);
102
+          });
103
+    }
81
   },
104
   },
82
   mounted() {
105
   mounted() {
83
     this.initPage();
106
     this.initPage();
107
+    this.getCheckedList()
84
   }
108
   }
85
 };
109
 };
86
 </script>
110
 </script>