|
@@ -9,12 +9,9 @@
|
9
|
9
|
end-placeholder="结束日期"
|
10
|
10
|
default-value="2019-08-08">
|
11
|
11
|
</el-date-picker></p>
|
12
|
|
- <div class="grid-content" ref="thirdChart" id="thirdChart" :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" ></div>
|
13
|
|
- <el-table :data="tableData2" border center style="width: 100%">
|
14
|
|
- <el-table-column label="用户姓名" prop="name"></el-table-column>
|
15
|
|
- <el-table-column label="手机号" prop="phone"></el-table-column>
|
16
|
|
- <el-table-column label="意向楼盘" prop="building"></el-table-column>
|
17
|
|
- <el-table-column label="意向值" prop="num"></el-table-column>
|
|
12
|
+ <x-line :style="{ height: '500px',margin:'20px 0',border:'1px solid #eee', padding:'20px',borderRadius:'5px'}" :value="lineSeting"></x-line>
|
|
13
|
+ <el-table :data="tableData" border center style="width: 100%">
|
|
14
|
+ <el-table-column v-for="(item, index) in tableTitle" :key="index" :label="item" :prop="index == 0 ? 'label': item"></el-table-column>
|
18
|
15
|
</el-table>
|
19
|
16
|
|
20
|
17
|
</div>
|
|
@@ -24,14 +21,30 @@
|
24
|
21
|
import { createNamespacedHelpers } from "vuex";
|
25
|
22
|
import apis from "../../config/api";
|
26
|
23
|
import { mapState } from "vuex";
|
27
|
|
-import Echarts from "echarts";
|
28
|
24
|
|
|
25
|
+const {
|
|
26
|
+ mapState: mapIndexEchartsState,
|
|
27
|
+ mapActions: mapIndexEchartsActions
|
|
28
|
+} = createNamespacedHelpers("indexEcharts");
|
29
|
29
|
export default {
|
30
|
|
- components: {},
|
|
30
|
+ components: {
|
|
31
|
+ XLine: () => import('@/components/charts/XLine.vue'),
|
|
32
|
+ },
|
31
|
33
|
data() {
|
32
|
34
|
return {
|
33
|
|
- value: '',
|
34
|
|
- tableData2: [
|
|
35
|
+ value: "",
|
|
36
|
+ lineSeting: {
|
|
37
|
+ dataset: {
|
|
38
|
+ dimensions: ['date', 'userCount', 'authorizationCount'],
|
|
39
|
+ source: [],
|
|
40
|
+ },
|
|
41
|
+ },
|
|
42
|
+ tableData: [
|
|
43
|
+ { label: '新增用户', },
|
|
44
|
+ { label: '授权注册', }
|
|
45
|
+ ],
|
|
46
|
+ tableTitle: [ '类型' ],
|
|
47
|
+ tableData2: [
|
35
|
48
|
{
|
36
|
49
|
num: "98",
|
37
|
50
|
name: "王晓红",
|
|
@@ -59,57 +72,44 @@ export default {
|
59
|
72
|
]
|
60
|
73
|
};
|
61
|
74
|
},
|
62
|
|
- computed: {},
|
|
75
|
+ computed: {
|
|
76
|
+ ...mapIndexEchartsState({
|
|
77
|
+ newsUserCount: x => x.newsUserCount
|
|
78
|
+ })
|
|
79
|
+ },
|
63
|
80
|
methods: {
|
64
|
|
- drawLine() {
|
65
|
|
- // 折线图
|
66
|
|
- let thirdChart = Echarts.init(this.$refs.thirdChart);
|
67
|
|
- // 绘制图表
|
68
|
|
- thirdChart.setOption({
|
69
|
|
- title: {
|
70
|
|
- text: "新增用户"
|
71
|
|
- },
|
72
|
|
- color: ["purple", "green"],
|
73
|
|
- tooltip: {
|
74
|
|
- trigger: "axis"
|
75
|
|
- },
|
76
|
|
- legend: {
|
77
|
|
- data: ["新用户数", "授权注册"]
|
78
|
|
- },
|
79
|
|
- grid: {
|
80
|
|
- left: "3%",
|
81
|
|
- right: "4%",
|
82
|
|
- bottom: "3%",
|
83
|
|
- containLabel: true
|
84
|
|
- },
|
85
|
|
- toolbox: {},
|
86
|
|
- xAxis: {
|
87
|
|
- type: "category",
|
88
|
|
- boundaryGap: false,
|
89
|
|
- data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
90
|
|
- },
|
91
|
|
- yAxis: {
|
92
|
|
- type: "value"
|
93
|
|
- },
|
94
|
|
- series: [
|
95
|
|
- {
|
96
|
|
- name: "新用户数",
|
97
|
|
- type: "line",
|
98
|
|
- stack: "1",
|
99
|
|
- data: [120, 132, 101, 134, 90, 230, 210]
|
100
|
|
- },
|
101
|
|
- {
|
102
|
|
- name: "授权注册",
|
103
|
|
- type: "line",
|
104
|
|
- stack: "2",
|
105
|
|
- data: [220, 182, 191, 234, 290, 330, 310]
|
106
|
|
- },
|
107
|
|
- ]
|
|
81
|
+ ...mapIndexEchartsActions(["getNewsUserCount"]),
|
|
82
|
+ initPage() {
|
|
83
|
+ this.getNewsUserCount().then(x => {
|
|
84
|
+ const data = this.newsUserCount.selectNewsUserCount
|
|
85
|
+ this.lineSeting.dataset.source = data
|
|
86
|
+ this.tableData = (data || []).reduce((acc, item, index) => {
|
|
87
|
+ const { date, userCount, authorizationCount } = item
|
|
88
|
+
|
|
89
|
+ const row2 = {
|
|
90
|
+ ...acc[0],
|
|
91
|
+ [`${date}`]: userCount,
|
|
92
|
+ }
|
|
93
|
+
|
|
94
|
+ const row3 = {
|
|
95
|
+ ...acc[1],
|
|
96
|
+ [`${date}`]: authorizationCount,
|
|
97
|
+ }
|
|
98
|
+
|
|
99
|
+ this.tableTitle = this.tableTitle.concat(`${date}`)
|
|
100
|
+
|
|
101
|
+ return [row2, row3];
|
|
102
|
+ }, this.tableData)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+ window.console.log(this.tableData, '-------')
|
108
|
106
|
});
|
109
|
|
- }
|
|
107
|
+ },
|
110
|
108
|
},
|
111
|
109
|
mounted() {
|
112
|
|
- this.drawLine();
|
|
110
|
+ this.initPage();
|
|
111
|
+ // this.drawLine();
|
|
112
|
+
|
113
|
113
|
}
|
114
|
114
|
};
|
115
|
115
|
</script>
|