diff --git a/auto_pt/views.py b/auto_pt/views.py
index a5c1a51..82fbefe 100644
--- a/auto_pt/views.py
+++ b/auto_pt/views.py
@@ -676,8 +676,10 @@ def site_data_api(request):
} for (index, info) in enumerate(info_list) if index < len(info_list) - 1]
'''
diff_info_list = {
- info['date']: info_list[index + 1]['uploaded'] - info['uploaded'] if index < len(
- info_list) - 1 else 0 for (index, info) in enumerate(info_list) if index < len(info_list) - 1
+ info['date']: info['uploaded'] - info_list[index - 1]['uploaded'] if
+ info['uploaded'] - info_list[index - 1]['uploaded'] > 0 else 0 for
+ (index, info) in enumerate(info_list) if 0 < index < len(info_list)
+
}
print(f'处理完后站点数据条数:{len(info_list)}')
for date in date_list:
diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html
index 777d8bf..44d69ed 100644
--- a/templates/auto_pt/status.html
+++ b/templates/auto_pt/status.html
@@ -346,13 +346,32 @@
direction="btt"
size="96%"
append-to-body
- :title="site.name + '--历史数据'"
style="background-color: rgba(227, 229, 229, 0.6);">
- {#
#}
- {#
-历史数据
#}
- {# #}
-
-
+ -历史数据
+
+
+
+
+
+
+ 7天
+ 15天
+ 30天
+ 两个月
+ 三个月
+ 半年
+ 一年
+ 全部
+
+
+ 图例
+
+
+
+
@@ -400,6 +419,8 @@
sortStep: 1,
showData: [],
showAllHistory: false,
+ incrementData: {},
+ dataLength: -7,
}
},
beforeMount() {
@@ -556,7 +577,8 @@
{#this.ptData = res.data.data#}
{#this.setPie()#}
{#this.setCard()#}
- id == 0 ? this.showAllIncrementHistory(res.data.data) : this.setLine(res.data.data)
+ this.incrementData = res.data.data
+ id == 0 ? this.showAllIncrementHistory() : this.setLine()
} else {
this.$message({
type: 'warning',
@@ -571,7 +593,26 @@
});
})
},
- showAllIncrementHistory(data) {
+ changeLength() {
+
+ },
+ showAllIncrementHistory($event) {
+ console.log($event)
+ if (typeof $event == "object") {
+ this.showLegend = !this.showLegend
+ }
+ {#console.log(this.incrementData)#}
+ let dateList = this.incrementData.date_list.slice(this.dataLength)
+ {#console.log(dateList)#}
+ let diff = []
+ this.incrementData.diff.forEach((item, index) => {
+ let diff_item = {}
+ diff_item = JSON.parse(JSON.stringify(item));
+ {#console.log(item)#}
+ diff_item.data = item.data.slice(this.dataLength)
+ {#console.log(diff_item)#}
+ diff.push(diff_item)
+ })
let option = {
title: {
text: '每日增量--全部站点',
@@ -623,7 +664,7 @@
extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);', // 附加阴影样式
},
legend: {
- show: true,
+ show: this.showLegend,
{#top: '3%',#}
left: 'center',
bottom: '12',
@@ -640,7 +681,8 @@
},
toolbox: {
feature: {
- saveAsImage: {}
+ saveAsImage: {},
+ dataZoom: {},
}
},
xAxis: {
@@ -652,7 +694,7 @@
axisLine: {
onZero: false
},
- data: data.date_list
+ data: dateList
},
yAxis: {
type: 'value',
@@ -663,13 +705,15 @@
},
},
- series: data.diff,
+ series: diff,
};
this.site.name = '全部站点'
this.showSiteChart = true
this.showAllHistory = true
+ this.showLegend ? option.grid.bottom = '25%' : option.grid.bottom = '3%'
setTimeout(() => {
this.chart = this.$refs.history_charts.chart
+ this.chart.clear()
this.setChartOption(this.chart, option)
}, 15)
},
@@ -1054,7 +1098,8 @@
this.chart = this.$refs.charts.chart
this.setChartOption(this.chart, option)
},
- setLine(siteData) {
+ setLine() {
+ let siteData = this.incrementData
this.site = siteData.site
let dataList = siteData.site_status_list
let uploadedList = []