static.vue
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
<div class="template-box content_div_main noBackGround">
<el-form :inline="true" class="search-form" size="small">
<el-form-item label="社区选择:">
<el-select v-model="mallId" placeholder="请选择">
<el-option
v-for="item in mallData"
:key="item.unid" :value="item.id" :label="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="查询时间:">
<el-date-picker
v-model="datatime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期"
:picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button class="search-btn" @click="searchFaceCheck" icon="el-icon-search">查询</el-button>
<!-- <el-button class="search-btn ml10" @click="exportCluster()" icon="el-icon-upload">导出</el-button> -->
</el-form-item>
</el-form>
<div class="chartBox">
<div class="radioBox" style="left: 140px;">
<el-radio-group v-model="radioVal" size="small">
<el-radio-button label="trend7">天汇总</el-radio-button>
<el-radio-button label="trend15">小时级</el-radio-button>
<el-radio-button label="trend30">分钟级</el-radio-button>
</el-radio-group>
</div>
<chart chartId="chart2" :chartType="type" :chartData="chartData2" class="chart"></chart>
</div>
</div>
</template>
<script>
import chart from "../public/chart.vue"
export default {
data() {
return {
type:"AreaLine",
pickerOptions:{
disabledDate(time) {
return time.getTime() > Date.now();
},
},
datatime:this.common.formatDateFun(new Date(), "yyyy-MM-dd"),
datas:{},
chartData2:{},
radioVal:"trend15",
mallData:[],
mallId:'',
accountId:localStorage.getItem("accountId")
}
},
watch:{
radioVal(newVal,oldVal){
this.radioChange(this.datas)
}
},
components:{
chart
},
methods: {
searchFaceCheck(){
this.initChart();
},
getMallList(){
this.axios.get(this.API.url + "/malls",{
params:{
accountId:this.accountId,
status:1
}
}).then((response)=> {
this.mallData = response.data.data;
if(response.data.data.length>0){
this.mallId=response.data.data[0].id
}
this.initChart();
});
},
initChart(){
this.axios.get(this.API.url+"/report/basics/day/mall",{
params:{
orgIds: this.mallId,
date: this.datatime,
chartIds: '283,284,285',
option: "TAB_CHART"
}
}).then((res)=>{
this.datas=res.data.data;
this.radioChange(this.datas);
})
},
radioChange(res){
switch (this.radioVal){
case "trend7":
this.type="Bar";
this.chartData2=res.body.detailData;
break;
case "trend15":
this.type="AreaLine";
this.chartData2=res.body.trafficHour;
break;
case "trend30":
this.type="AreaLine";
this.chartData2=res.body.traffic10Min;
this.chartData2.otherConf={
isYear:true
}
break;
default:
break;
}
if(this.chartData2.otherConf){
this.chartData2.otherConf._color=["#4BBEFF", "#87D14B", "#FFC62E", "#FF9631"]
}else{
this.chartData2.otherConf={
_color:["#4BBEFF", "#87D14B", "#FFC62E", "#FF9631"]
}
}
}
},
mounted() {
this.getMallList();
}
}
</script>
<style scoped>
.chart{
height: 500px;
}
</style>