msreport.vue
4.82 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
<template>
<div class="daily">
<!-- 主力店铺同环比报表 -->
<div class="asis-table-wrapper mainstore-table-wrapper">
<h3 class="asis-table-header mainstore-table-header">
<!-- {{ DayCountingYoY_title }} -->
<!-- <span class="asis-table-title">{{ i18nFormatter(feaDayCountingYoY_title) }}</span> -->
<span class="asis-table-download" @click="dealExport('domFeaDayCounting', i18nFormatter(feaDayCountingYoY_title))">{{$t('allPages.load')}}</span>
</h3>
<div class="asis-table-content">
<common-tab v-loading="loading" :tableData="feaDayCountingYoY_ops" id="domFeaDayCounting" :headData="feaDayCountingYoY_head" :tabHeight="''"></common-tab>
</div>
</div>
</div>
</template>
<script>
import commonTable from '../../public/tableCommon'
export default {
props: {
propparam: Object
},
data() {
return {
loading: true,
feaDayCountingYoY_head: [],
feaDayCountingYoY_title: '',
feaDayCountingYoY_ops: [],
searchTime: '',
tableKeyToId: {},
tableIds: '',
emitData: [],
customLoading: undefined
}
},
components: {
'common-tab': commonTable
},
watch: {
propparam: {
handler: 'refreshHandle',
immediate: true
}
},
mounted() {
// this.getTableId();
},
methods: {
refreshHandle(param) {
if(param.dateType !== '/mainstore/msreport') return;
this.emitData = param.data;
this.loading = true;
if(this.tableIds && JSON.stringify(this.tableKeyToId) !== '{}') {
this.getTableData(this.tableIds);
} else {
this.getTableId();
}
},
getTableId() {
this.tableKeyToId = {};
this.tableIds = '';
this.$api.baseReport.reportChart({
report: 'mainZoneYOAnalysis',
// _t: Date.parse(new Date()) / 1000
})
.then(res => {
let tableItem = res.data.data;
if(!tableItem.length){
this.loading = false;
}
tableItem.forEach((item, index) => {
this.tableKeyToId[item.key] = item.id;
if(item.key === 'dayMainZoneYOAnalysis') {
this.tableIds = item.id;
}
});
this.getTableData(this.tableIds);
})
},
getTableData(tableIds) {
if (!this.emitData.asis_org) return
let reportType = this.emitData.asis_date;
tableIds = this.tableKeyToId[this.emitData.asis_date];
if(!tableIds) return this.loading = false;
this.feaDayCountingYoY_ops = [];
this.DayCountingYoY_ops = [];
this.DayAddYoY_ops = [];
let apiUrl = '', param = {}, searchTime = '';
if(this.emitData.asis_time) {
if(typeof this.emitData.asis_time === 'string') {
searchTime = this.emitData.asis_time;
} else {
searchTime = dateUnit.dateFormat(this.emitData.asis_time, 'yyyy-MM-dd');
}
} else {
searchTime = dateUnit.dateFormat(new Date(), 'yyyy-MM-dd');
}
// apiUrl = '/report/mainZoneYOAnalysis/zone';
param = {
orgIds: this.emitData.asis_org,
startDate: searchTime,
chartIds: tableIds,
// _t: Date.parse(new Date()) / 1000
}
this.$api.analysisReport.mainZoneYOAnalysis(param)
.then(res => {
if(!res.data.data.length){
this.loading = false;
}
setTimeout(() => {
this.loading = false;
}, 500);
let report = 'DayYoYMoM';
this.feaDayCountingYoY_title =report + '15DayCountingYoY';
let feaDayCountingYoY_series = res.data.data.body[reportType].series;
let faeDayCountingYoY = res.data.data.body[reportType].xaxis.data;
this.feaDayCountingYoY_head = this.autoComplateHead(reportType, faeDayCountingYoY);
// 处理数据
if(feaDayCountingYoY_series.length) {
this.feaDayCountingYoY_ops = this.dealData(feaDayCountingYoY_series, this.feaDayCountingYoY_head);
}
})
.catch(err => {
this.catchErrorHandle(err)
})
},
}
}
</script>
<style scoped>
.mainstore-table-wrapper {
padding: 5px 26px 12px 26px;
}
.mainstore-table-header {
margin-bottom: 0px
}
</style>