Browse Source

Merge branch 'fix-1937' into fix-1936

tags/v1.22.5.1^2
wangjr 3 years ago
parent
commit
49d8a17c50
3 changed files with 89 additions and 22 deletions
  1. +13
    -9
      routers/api/v1/repo/repo_dashbord.go
  2. +2
    -2
      web_src/js/components/DataAnalysis.vue
  3. +74
    -11
      web_src/js/components/ProTrend.vue

+ 13
- 9
routers/api/v1/repo/repo_dashbord.go View File

@@ -426,7 +426,8 @@ func GetProjectsSummaryDataFile(ctx *context.Context) {

var total int64
queryType := ctx.QueryTrim("type")
row := 2

var datas = make([]*ProjectSummaryBaseData, 0)

if queryType == "all" || queryType == "current_year" {
dates := getEndOfMonthDates(beginTime, endTime)
@@ -448,10 +449,8 @@ func GetProjectsSummaryDataFile(ctx *context.Context) {
createTime, _ := time.Parse(DATE_FORMAT, v.Date)
data.CreatTime = createTime.Format(MONTH_FORMAT)

for k, v := range allProjectsPeriodSummaryValues(row, &data, ctx) {
f.SetCellValue(projectAnalysis, k, v)
}
row++
datas = append(datas, &data)

}

}
@@ -475,17 +474,22 @@ func GetProjectsSummaryDataFile(ctx *context.Context) {
data := ProjectSummaryBaseData{}
setStatisticsData(&data, v, stats[j-1])
data.CreatTime = v.Date
datas = append(datas, &data)

for k, v := range allProjectsPeriodSummaryValues(row, &data, ctx) {
f.SetCellValue(projectAnalysis, k, v)
}
row++
}

}

}
}
row := 2
datas = reverse(datas)
for _, data := range datas {
for k, v := range allProjectsPeriodSummaryValues(row, data, ctx) {
f.SetCellValue(projectAnalysis, k, v)
}
row++
}

f.SetActiveSheet(index)



+ 2
- 2
web_src/js/components/DataAnalysis.vue View File

@@ -14,7 +14,7 @@
<i class="ri-numbers-line"></i>
<span>项目分析</span>
</template>
<el-menu-item index="ProTrend">项目增长趋势分析</el-menu-item>
<el-menu-item index="ProTrend">增长趋势分析</el-menu-item>
<el-menu-item index="ProAnalysis">详细数据</el-menu-item>
</el-submenu>
<el-submenu index="2">
@@ -22,7 +22,7 @@
<i class="ri-contacts-line"></i>
<span>用户分析</span>
</template>
<el-menu-item index="UserTrend">用户增长趋势分析</el-menu-item>
<el-menu-item index="UserTrend">增长趋势分析</el-menu-item>
<el-menu-item index="UserAnalysis">活动分析</el-menu-item>
</el-submenu>
<el-menu-item index="BrainAnalysis">


+ 74
- 11
web_src/js/components/ProTrend.vue View File

@@ -14,7 +14,7 @@
昨天
</el-row>
<el-row class="item_h">
今天
累计
</el-row>
</el-col>
<el-col span='23' >
@@ -115,13 +115,13 @@
</div>
<div style="margin-top: 20px;">
<span class="sta_iterm">统计周期:</span>
<button type="button" class='btnFirst' id ="yesterday" v-bind:class="{colorChange:1==dynamic}" @click="resetPage(),getPeriodProList('yesterday',1)">昨天</button>
<button type="button" class='btn' id = "current_week" v-bind:class="{colorChange:2==dynamic}" @click="resetPage(),getPeriodProList('current_week',2)">本周</button>
<button type="button" class='btn' id = "current_month" v-bind:class="{colorChange:3==dynamic}" @click="resetPage(),getPeriodProList('current_month',3)">本月</button>
<button type="button" class='btn' id = "last_month" v-bind:class="{colorChange:4==dynamic}" @click="resetPage(),getPeriodProList('last_month',4)">上月</button>
<button type="button" class='btn' id = "monthly" v-bind:class="{colorChange:5==dynamic}" @click="resetPage(),getPeriodProList('monthly',5)">近30天</button>
<button type="button" class='btn' id = "current_year" v-bind:class="{colorChange:6==dynamic}" @click="resetPage(),getPeriodProList('current_year',6)">今年</button>
<button type="button" class='btnLast' id = "all" v-bind:class="{colorChange:7==dynamic}" @click="resetPage(),getPeriodProList('all',7)">所有</button>
<!-- <button type="button" class='btnFirst' id ="yesterday" v-bind:class="{colorChange:1==dynamic}" @click="resetPage(),getPeriodProList('yesterday',1)">昨天</button> -->
<button type="button" class='btn' id = "current_week" v-bind:class="{colorChange:1==dynamic}" @click="resetPage(),getPeriodProList('current_week',1)">本周</button>
<button type="button" class='btn' id = "current_month" v-bind:class="{colorChange:2==dynamic}" @click="resetPage(),getPeriodProList('current_month',2)">本月</button>
<button type="button" class='btn' id = "last_month" v-bind:class="{colorChange:3==dynamic}" @click="resetPage(),getPeriodProList('last_month',3)">上月</button>
<button type="button" class='btn' id = "monthly" v-bind:class="{colorChange:4==dynamic}" @click="resetPage(),getPeriodProList('monthly',4)">近30天</button>
<button type="button" class='btn' id = "current_year" v-bind:class="{colorChange:5==dynamic}" @click="resetPage(),getPeriodProList('current_year',5)">今年</button>
<button type="button" class='btnLast' id = "all" v-bind:class="{colorChange:6==dynamic}" @click="resetPage(),getPeriodProList('all',6)">所有</button>
<span style="margin-left: 20px;">
<el-date-picker
v-model="value_time"
@@ -255,7 +255,7 @@
pickerOptions: {
},
value_time: '',
dynamic:5,
dynamic:4,
echartsSelectData:'',
option:'',
};
@@ -529,6 +529,12 @@
},
legend: {
data:['新增项目','新增公开项目','新增私有项目','新增自建项目','新增派生项目','新增镜像项目','累计项目'],
  selected:{
                                '新增自建项目':false,
                                '新增派生项目':false,
                                '新增镜像项目':false,
                                '累计项目':false
                            }
// orient: 'vertical',
// top:'top',  
},
@@ -572,42 +578,98 @@
data: ydata_add_pro,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#3894FF",
},
color:"#3894FF",
}
},
},
{
name:"新增公开项目",
data: ydata_add_public_pro,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#67B3BB",
},
color:"#67B3BB",
}
},
},
{
name:"新增私有项目",
data: ydata_add_private_pro,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#58A55C",
},
color:"#58A55C",
}
},
},
{
name:"新增自建项目",
data: ydata_add_self,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#F2BD42",
},
color:"#F2BD42",
}
},
},
{
name:"新增派生项目",
data: ydata_add_fork,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#DAA67B",
},
color:"#DAA67B",
}
},
},
{
name:"新增镜像项目",
data: ydata_add_mirror,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#2E4552",
},
color:"#2E4552",
}
},
},
{
name:"累计项目",
data: ydata_cumulative_pro,
type: 'line',
areaStyle: {},
itemStyle:{
normal:{
lineStyle:{
color:"#4786B4",
},
color:"#4786B4",
}
},
},

]
@@ -679,7 +741,7 @@

mounted() {

this.getPeriodProList("monthly",5);
this.getPeriodProList("monthly",4);
this.getSummaryPro();
document.getElementById('selectData').style.width = document.getElementById('pro_tend').offsetWidth*0.8+'px'
this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
@@ -690,7 +752,7 @@

created() {
this.getSummaryPro();
this.getPeriodProList("monthly",5);
this.getPeriodProList("monthly",4);
},
updated(){
if(document.querySelectorAll('img[avatar]').length!==0){
@@ -724,6 +786,7 @@
}
.num_color{
color: #0366D6;
font-weight: bold;
}

.pro_item{


Loading…
Cancel
Save