Sfoglia il codice sorgente

统计是否显示

魏熙美 5 anni fa
parent
commit
8c2273b17b
1 ha cambiato i file con 35 aggiunte e 11 eliminazioni
  1. 35
    11
      src/views/indexEcharts/index.vue

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

@@ -1,34 +1,34 @@
1 1
 <template>
2 2
 <div class="chart-index">
3 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 5
       <card label="总用户">{{echartsInfo.selectUserCount}}</card>
6 6
     </el-col>
7
-    <el-col :span="8">
7
+    <el-col :span="8" v-if="checkedReport.includes('total_number_of_registered_users')">
8 8
       <card label="总注册用户">{{echartsInfo.selectRegisteredCount}}</card>
9 9
     </el-col>
10
-    <el-col :span="8">
10
+    <el-col :span="8" v-if="checkedReport.includes('total_number_of_registered_users')">
11 11
       <card label="最近7天新增" @click.native="toNewUsers" class="under-line" >{{echartsInfo.selectRecentlyCount}}</card>
12 12
     </el-col>
13 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 16
  <el-row :gutter="20">
17
-    <el-col :span="12">
17
+    <el-col :span="12" v-if="checkedReport.includes('active_users')">
18 18
       <user-active></user-active>
19 19
     </el-col>
20
-    <el-col :span="12">
20
+    <el-col :span="12"  v-if="checkedReport.includes('conversion_rate')">
21 21
       <user-conversion></user-conversion>
22 22
     </el-col>
23
-    <el-col :span="12">
23
+    <el-col :span="12" v-if="checkedReport.includes('sex_ratio')">
24 24
       <user-sex></user-sex>
25 25
     </el-col>
26
-    <el-col :span="12">
26
+    <el-col :span="12" v-if="checkedReport.includes('urban_distribution')">
27 27
       <user-city></user-city>
28 28
     </el-col>
29 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 32
 </div>
33 33
 </template>
34 34
 
@@ -37,6 +37,7 @@ import { createNamespacedHelpers } from "vuex";
37 37
 import apis from "../../config/api";
38 38
 import { mapState } from "vuex";
39 39
 import Echarts from "echarts";
40
+const { mapActions: mapReportActions } = createNamespacedHelpers("report");
40 41
 const {
41 42
   mapState: mapIndexEchartsState,
42 43
   mapActions: mapIndexEchartsActions
@@ -56,6 +57,12 @@ export default {
56 57
   },
57 58
   data() {
58 59
     return {
60
+        pageNavi: {
61
+            current: 1,
62
+            size: 200,
63
+            total: 0
64
+        },
65
+        checkedReport: [] // 是否展示报表
59 66
     };
60 67
   },
61 68
   computed: {
@@ -65,6 +72,7 @@ export default {
65 72
   },
66 73
   methods: {
67 74
     ...mapIndexEchartsActions(["getIndexEcharts", "setDetailNull"]),
75
+    ...mapReportActions(["getReportList", "getReportCheckedList", "saveCheckedReport"]),
68 76
     initPage() {
69 77
       this.setDetailNull();
70 78
       this.getIndexEcharts().then(window.console.log);;
@@ -78,9 +86,25 @@ export default {
78 86
     toBehaviorAnalysis() {
79 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 105
   mounted() {
83 106
     this.initPage();
107
+    this.getCheckedList()
84 108
   }
85 109
 };
86 110
 </script>