monthly.vue
9.24 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<template>
<div class="monthly">
<div class="asis-table-wrapper weather-echart-wrapper download-parent">
<!-- 天气分析图 -->
<!-- <scatter-chart id="monthScatterChart" class="month-scatter-block" :options="WeatherAnalyze_ops" chartType="Scatter"></scatter-chart> -->
<mix-charts chartId="monthScatterChart" class="month-scatter-block" :chartData="WeatherAnalyze_ops" chartType="Scatter" />
<span class="ehcarts-title">{{ i18nFormatter(WeatherAnalyze_title) }}</span>
<!-- <span class="download-text">导出数据</span> -->
<!-- <span class="download-text" @click="getechartsId('monthScatterChart','Scatter','WeatherAnalyze',WeatherAnalyze_ops)">导出数据</span> -->
</div>
<div class="asis-table-wrapper">
<h3 class="asis-table-header">
<span class="asis-table-title">{{ i18nFormatter(WeatherSynthetical_title) }}</span>
<span class="asis-table-download" @click="dealExport('domAsis', i18nFormatter(WeatherSynthetical_title))">{{$t('allPages.load')}}</span>
</h3>
<div class="asis-table-content">
<common-tab v-loading="loading" :tableData="WeatherSynthetical_ops" id="domAsis" :headData="WeatherSynthetical_head" :tabHeight="''"></common-tab>
</div>
</div>
<div class="asis-table-wrapper">
<h3 class="asis-table-header">
<span class="asis-table-title">{{ i18nFormatter(WeatherDetail_title) }}</span>
<span class="asis-table-download" @click="dealExport('domDetail', i18nFormatter(WeatherDetail_title))">{{$t('allPages.load')}}</span>
</h3>
<div class="asis-table-content">
<common-tab v-loading="loading" :tableData="WeatherDetail_ops" id="domDetail" :headData="WeatherDetail_head" :tabHeight="''"></common-tab>
</div>
</div>
</div>
</template>
<script>
import publicChart from '../common/publicChart'
import commonTable from '../../public/tableCommon'
export default {
props: {
propparam: Object
},
data() {
return {
startDate:'',
endDate:'',
loading: true,
// monthScatter_ops: {},
quarterVal: this.$t('format.quarter1th'),
WeatherSynthetical_head: [],
WeatherDetail_head: [],
WeatherAnalyze_title: '',
WeatherSynthetical_title: '',
WeatherDetail_title: '',
WeatherAnalyze_ops: {}, // 天气分析
WeatherSynthetical_ops: [], // 天气综合列表
WeatherDetail_ops: [], // 每日详情
tableKeyToId: {},
tableIds: '',
emitData: {},
kpiArr: {
'TRAFFIC': this.$t('table.passFlow'),
'SALES': this.$t('format.SALES'),
'ENTERINGRATE': this.$t('format.ENTERINGRATE'),
'PREPRICE': this.$t('format.PREPRICE'),
'PERAREAVALUE': this.$t('format.PERAREAVALUE'),
'ORDER': this.$t('format.VOLUME'),
'HANDBAGRATE': this.$t('format.BAGRATE'),
'DURATIONTIME': this.$t('format.DURATIONTIME'),
}
}
},
components: {
'scatter-chart': publicChart,
'common-tab': commonTable,
},
watch: {
propparam: {
handler: 'refreshHandle',
immediate: true
}
},
mounted() {
// this.getMonthScatter();
},
methods: {
refreshHandle(param) {
if(param.dateType !== '/weatherasis/monthly') return;
this.emitData = param.data;
this.loading = true;
if(this.tableIds && JSON.stringify(this.tableKeyToId) !== '{}') {
this.getChartData(this.tableIds);
} else {
this.getChartId();
}
},
getChartId() {
this.tableKeyToId = {};
this.tableIds = '';
this.$api.baseReport.reportChart({
report: 'WeatherReport',
// _t: Date.parse(new Date()) / 1000
})
.then(res => {
let tableItem = res.data.data;
tableItem.forEach((item, index) => {
this.tableKeyToId[item.key] = item.id;
if(item.key === 'WeatherAnalyze' || item.key === 'WeatherSynthetical' || item.key === 'WeatherDetail') {
if(index == tableItem.length - 1) {
this.tableIds += item.id;
} else {
this.tableIds += item.id + ',';
}
}
});
this.getChartData(this.tableIds);
})
},
getChartData(tableIds) {
if(!tableIds) return;
this.WeatherAnalyze_ops = {};
this.WeatherSynthetical_ops = [];
this.WeatherDetail_ops = [];
let apiUrl = '', param = {};
let formatTime = this.newDateFormat('month',this.emitData.asis_time);
this.startDate = formatTime.startTime;
this.endDate = formatTime.endTime;
param = {
orgIds: this.emitData.asis_org,
startDate: this.startDate,
endDate: this.endDate,
chartIds: tableIds,
kpiType: this.emitData.asis_kpi,
}
let {params,asisLevel} = this.dealFormat(param,this.emitData);
this.$api.analysisReport.weatherAnalysis(asisLevel, params)
.then(res => {
setTimeout(() => {
this.loading = false;
}, 500);
let report = 'WeatherReport'
// this.WeatherAnalyze_title = res.data.data.body['WeatherAnalyze'].title;
// this.WeatherSynthetical_title = res.data.data.body['WeatherSynthetical'].title;
// this.WeatherDetail_title = res.data.data.body['WeatherDetail'].title;
this.WeatherAnalyze_title = report + 'WeatherAnalyze';
this.WeatherSynthetical_title = report + 'WeatherSynthetical';
this.WeatherDetail_title = report+ 'WeatherDetail';
let {
WeatherAnalyze
, WeatherSynthetical
, WeatherDetail
} = res.data.data.body
WeatherAnalyze['otherConf'] = {
_color: ['#3BB8FF', '#3D97CB', '#87D14B', '#0069FF', '#FF9631', '#FFC62E', '#6784E3', '#3BB8FF', '#3D97CB', '#87D14B', '#0069FF', '#FF9631', '#FFC62E', '#6784E3', '#3BB8FF', '#3D97CB', '#87D14B', '#0069FF', '#FF9631', '#FFC62E'],
kpiName: this.kpiArr[this.emitData.asis_kpi]
}
this.WeatherAnalyze_ops = WeatherAnalyze
let WeatherSynthetical_series = this.dealColWeatherCode(WeatherSynthetical.series, 0)
let WeatherDetail_series = this.dealColWeatherCode(WeatherDetail.series, 2)
this.WeatherSynthetical_head = this.dealHead(WeatherSynthetical.xaxis.data);
this.WeatherDetail_head = this.dealHead(WeatherDetail.xaxis.data);
this.WeatherSynthetical_ops = this.dealData(WeatherSynthetical_series, this.WeatherSynthetical_head);
this.WeatherDetail_ops = this.dealData(WeatherDetail_series, this.WeatherDetail_head);
})
.catch(err => {
this.catchErrorHandle(err)
})
},
dealHead(headData) {
let resultHead = [];
headData.forEach((item, index) => {
resultHead.push({
prop: 'defaultOrg' + index,
label: item
})
})
return resultHead;
},
weatherFormat(row, column, cellValue) {
let dicWeather = this.getSessionLocal('weather', cellValue)
return dicWeather ? this.$t('dictionary.' + dicWeather) : this.$t('dictionary.unknow');
},
dealColWeatherCode(data, colNum) {
if (!data.length) return data
return data.map(item => {
item.data = item.data.map((dataItem, dataIndex) => {
dataItem = dataIndex === colNum ? this.weatherFormat(0, 0, dataItem) : dataItem
return dataItem
})
return item
})
},
}
}
</script>
<style scoped>
.weather-table-wrapper {
padding: 26px;
box-sizing: border-box;
}
.quarter-sel-wrapper {
float: left;
font-size: 13px !important;
color: #444;
padding-left: 137px;
}
.quarter-sel-wrapper label {
margin-right: 10px;
}
.weather-echart-wrapper {
padding: 0;
}
/* #monthScatterChart, */
.month-scatter-block {
height: 731px;
background: #fff;
}
.week-heatmap-chart
{
height: 722px;
}
.chart-title {
left: 26px;
top: 26px;
}
@media only screen and (max-width: 1366px) {
.month-scatter-block {
height: 500px;
}
}
@media only screen and (max-width: 1280px) {
.month-scatter-block {
height: 500px;
}
}
</style>