Browse Source

Merge branch 'V20211115' into download-model-error

pull/817/head
lewis 3 years ago
parent
commit
c53159bd75
3 changed files with 216 additions and 57 deletions
  1. +1
    -1
      web_src/js/components/DataAnalysis.vue
  2. +175
    -41
      web_src/js/components/ProAnalysis.vue
  3. +40
    -15
      web_src/js/components/UserAnalysis.vue

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

@@ -69,7 +69,7 @@
if(tab.name=="third"){
// document.getElementById('usr').style.display="block"
// document.getElementById("pro").style.display='none'
//this.$refs.UserAnalysis.getUserList("all_usr",7)
this.$refs.UserAnalysis.getUserList("all_usr",7)

this.isSecond = false
this.isThird = true


+ 175
- 41
web_src/js/components/ProAnalysis.vue View File

@@ -2,7 +2,7 @@
<div style="width: 100%;">
<div id = "pro_main">
<div style="margin-top: 10px;">
<b class="pro_item">项目分析</b> <span class="update_time">数据更新时间:{{lastUpdatedTime}}/{{recordBeginTime}}</span>
<b class="pro_item">项目分析</b> <span class="update_time">数据更新时间:{{lastUpdatedTime}}&nbsp/&nbsp从{{recordBeginTime}}开始统计</span>
</div>
<bar-label :width="'95%'" :height="'500px'"></bar-label>
@@ -30,8 +30,10 @@
<span style="float:right; margin-right: 20px;">
<div style="display:inline-block;margin-left: 20px; ">
<i class="el-icon-download"></i>
<span ><a>下载报告</a> </span>
<span ><a id = "download_file" :href= "'../api/v1/projectboard/downloadAll/?type='+this.params.type+'&beginTime='+this.params.beginTime+'&endTime='+this.params.endTime+'&q='+this.params.q+'&sort=openi'" >下载报告</a> </span>
</div>


<span style="display:inline-block;margin-left: 20px; ">
<el-input size="small" placeholder="输入项目关键字搜索" v-model="search" class="input-with-select" @keyup.enter.native="searchName() "><i slot="suffix" class="el-input__icon el-icon-search"></i>
</el-input>
@@ -152,28 +154,28 @@
<div style="margin-top:20px">
<el-row >
<el-col :span='4' class="items">
项目创建时间 </br>
{{tableDataIDTotal.creatTime}}
<el-row>项目创建时间 </el-row>
<el-row class="item_content">{{tableDataIDTotal.creatTime}}</el-row>
</el-col>
<el-col :span='4' class="items">
OPenI指数 </br>
{{tableDataIDTotal.openi | rounding}}
<el-row>OpenI指数</el-row>
<el-row class="item_content">{{tableDataIDTotal.openi | rounding}}</el-row>
</el-col>
<el-col :span='4' class="items">
评论数 </br>
{{tableDataIDTotal.comment}}
<el-row>评论数 </el-row>
<el-row class="item_content">{{tableDataIDTotal.comment}}</el-row>
</el-col>
<el-col :span='4' class="items">
浏览数 </br>
{{tableDataIDTotal.view}}
<el-row>浏览量 </el-row>
<el-row class="item_content">{{tableDataIDTotal.view}}</el-row>
</el-col>
<el-col :span='4' class="items">
代码下载量 </br>
{{tableDataIDTotal.download}}
<el-row>代码下载量</el-row>
<el-row class="item_content">{{tableDataIDTotal.download}}</el-row>
</el-col>
<el-col :span='4' style="text-align: center;">
任务完成比例 </br>
{{tableDataIDTotal.issueClosedRatio}}
<el-row>任务完成比例</el-row>
<el-row class="item_content">{{tableDataIDTotal.issueClosedRatio}}</el-row>
</el-col>
</el-row>
</div>
@@ -213,8 +215,8 @@
</template>
</el-table-column>
<el-table-column
prop="PR"
label="pr"
prop="pr"
label="PR"
align="center">
</el-table-column>
<el-table-column
@@ -242,7 +244,7 @@
<el-date-picker
v-model="create_time_pro"
prefix-icon="el-icon-time"
@change="getOneProList(pro_id,'',true,0),getOneProList(pro_id,'',false,0)"
@change="getOneProList(pro_id,'',true,0),getOneProList(pro_id,'',false,0),clickCheckBox"
type="daterange"
size='small'
range-separator="至"
@@ -251,9 +253,9 @@
</el-date-picker>
</span>
<span style="float:right; margin-right: 20px;">
<div style="display:inline-block;margin-left: 20px; ">
<div style="display:inline-block;margin-left: 20px;">
<i class="el-icon-download"></i>
<span ><a>下载报告</a> </span>
<span ><a @click="exportData()">下载报告</a> </span>
</div>
</span>
</div>
@@ -319,7 +321,7 @@
<script>
// import barLabel from './basic/barLabel.vue';
import { export2Excel } from '../excel/util.js'
export default{
name:'ProAnalysis',
components: {
@@ -340,9 +342,11 @@
value_time: '',
search:'',
dynamic:7,
download_a:"",

//单个项目参数
columns: [{title: '日期',key: 'date'},{title: '浏览量',key: 'view'},{title: '下载量',key: 'download'},{title: 'commit',key: 'commit'}],
currentPage:1,
pageSize1:10,
paramsID:{type:'all' ,beginTime:'',endTime:'',openi:'false'},
@@ -363,7 +367,97 @@
};
},
methods: {
// download_file(){
// this.params.type='all'
// },
exportData(){
// this.getOneProList(this.pro_id,'all',true,7)
// this.getOneProList(this.pro_id,'all',false,7)
// this.fileName()
var saveFileName = this.getFileName()
export2Excel(this.columns,this.tableDataID,saveFileName)
},
getFileName(){

var now = new Date(); // 当前日期
var nowDayOfWeek = now.getDay(); // 今天本周的第几天
var nowDay = now.getDate(); // 当前日
var nowMonth = now.getMonth(); // 当前月
var nowYear = now.getFullYear(); // 当前年
var today = this.saveFormatDate(nowYear,nowMonth+1,nowDay);

let lastMonthDate = new Date(); // 上月日期
lastMonthDate.setDate(1);
lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
let lastYear = lastMonthDate.getYear();
let lastMonth = lastMonthDate.getMonth();
var startDate=''
var endDate=''
var saveFileName = ''
if (typeof this.paramsID.type=="undefined" || this.paramsID.type=="null" || this.paramsID.type==""){
startDate= this.saveFormatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate());
endDate = this.saveFormatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate());
saveFileName = this.pro_name+"_"+startDate+'_'+endDate
}else{
switch(this.paramsID.type){
case "yesterday":{
var now = new Date();
var tmp = new Date(now.setTime(now.getTime()-24*60*60*1000));
startDate = this.saveFormatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate());
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break
}
case "current_week":{
var now = new Date(); // 当前日期
var nowDayOfWeek = now.getDay(); // 今天本周的第几天
var day = nowDayOfWeek || 7;
startDate = this.saveFormatDate(now.getFullYear(), nowMonth+1, nowDay + 1 - day);
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break
}
case "current_month":{
startDate = this.saveFormatDate(nowYear,nowMonth+1,1);
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break
}
case "last_month":{
startDate=this.saveFormatDate(nowYear, lastMonth+1, 1);
endDate=this.saveFormatDate(nowYear, lastMonth+1, this.saveFormatDate(nowYear,lastMonth));
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break

}
case "monthly":{
var temp=new Date(now - 1000 * 60 * 60 * 24 * 30)
startDate = this.saveFormatDate(temp.getFullYear(),temp.getMonth()+1,temp.getDate());
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break
}
case "current_year":{
startDate = this.saveFormatDate(now.getFullYear(), 1, 1);
endDate = today
saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
break
}
case "all":{
console.log("e:"+today)
startDate = 'all'
endDate = today
saveFileName = this.pro_name+'_all'
break
}
}
}
return saveFileName

},
handleCurrentChange(val){
console.log(val)
this.params.page = val
@@ -411,6 +505,20 @@
}
}
},
saveFormatDate(myyear,mymonth,myweekday) {
// var myyear = this.date.getFullYear();
// var mymonth = this.date.getMonth() + 1;
// var myweekday = this.date.getDate();
if (mymonth < 10) {
mymonth = "0" + mymonth;
}
if (myweekday < 10) {
myweekday = "0" + myweekday;
}
console.log((myyear +''+ mymonth +''+ myweekday))
return (myyear +''+ mymonth +''+ myweekday);
},
formatDate(myyear,mymonth,myweekday) {
// var myyear = this.date.getFullYear();
// var mymonth = this.date.getMonth() + 1;
@@ -422,8 +530,9 @@
if (myweekday < 10) {
myweekday = "0" + myweekday;
}
return (myyear + "-" + mymonth + "-" + myweekday);
return (myyear +'-'+ mymonth +'-'+ myweekday);
},
getAllProList(type_val,index){
console.log("类型:"+type_val)
this.dynamic = index
@@ -446,7 +555,7 @@
this.lastUpdatedTime=res.data.lastUpdatedTime
this.tableData = res.data.pageRecords
this.totalPage=res.data.totalPage
this.totalNum = this.totalPage*this.params.pagesize
this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize
console.log("this.totalPage:"+this.totalPage)
})
@@ -547,7 +656,7 @@
},//提示层
legend: {
data: ['name1']
// data: ['']
},
radar: {
name: {
@@ -589,10 +698,19 @@
type: 'radar',
lineStyle:{
width:2,
color: 'rgb(0,255,0)'
color: '#409effd6',
normal:{
color:'#409effd6 '
}
},
itemStyle : {
normal : {
color:'#409effd6'
}
},
data: [{
value: ydata,
name:"数据"
}]
}]
@@ -604,8 +722,8 @@
var xdata_openI=[]
var ydata_openI=[]
for(var i =0;i<this.tableDataIDOpenI.length;i++){
xdata_openI.push(this.tableDataIDOpenI[this.tableDataIDOpenI.length-1-i].date);
ydata_openI.push(this.roundingF(this.tableDataIDOpenI[i].openi))
xdata_openI.push(this.tableDataIDOpenI[i].date);
ydata_openI.push(this.roundingF(this.tableDataIDOpenI[this.tableDataIDOpenI.length-1-i].openi))
}
console.log("ydata_openI:"+ydata_openI)
console.log(xdata_openI)
@@ -658,15 +776,25 @@
data: ydata_openI,
type: 'line',
areaStyle: {
color:'red',
type:'linear',
color:'#DCE7FB',
opacity: 0.3,
origin:"start"
origin:"start",
normal:{
color:'#DCE7FB'
}
},
lineStyle:{
width:1,
normal:{
color:'#409effd6'
}
},
// lineStyle:{
// width:2,
// color: '#409effd6'
// },
itemStyle : {
normal : {
color:'#409effd6'
}
},
}
]
};
@@ -674,16 +802,18 @@
},
drawSelectData(){
// $("#selectData").removeAttr("selectData").empty();
var xdata=[]
var ydata_view=[]
var ydata_download=[]
var ydata_commit=[]
for(var i =0;i<this.tableDataIDOpenI.length;i++){
xdata.push(this.tableDataIDOpenI[this.tableDataID.length-1-i].date);
ydata_view.push(this.roundingF(this.tableDataID[i].view))
ydata_download.push(this.roundingF(this.tableDataID[i].download))
ydata_commit.push(this.roundingF(this.tableDataID[i].commit))
// if ()
for(var i =0;i<this.tableDataID.length;i++){
xdata.push(this.tableDataID[i].date);
ydata_view.push(this.roundingF(this.tableDataID[this.tableDataID.length-1-i].view))
ydata_download.push(this.roundingF(this.tableDataID[this.tableDataID.length-1-i].download))
ydata_commit.push(this.roundingF(this.tableDataID[this.tableDataID.length-1-i].commit))
}
console.log("ydata_openI:"+ydata_download)
console.log(xdata)
@@ -855,7 +985,7 @@
// console.log("this.radarOpenI:"+this.radarOpenI)
},
created() {
// this.download_a=document.getElementById("download_file")
}
}
</script>
@@ -920,4 +1050,8 @@
height: 350px;
width: 100%;
}
.item_content{
color: #409eff;
margin-top: 10px;
}
</style>

+ 40
- 15
web_src/js/components/UserAnalysis.vue View File

@@ -1,7 +1,7 @@
<template>
<div>
<div style="margin-top: 10px;">
<b class="pro_item">用户分析</b> <span class="update_time">数据更新时间:{{lastUpdatedTime}}/{{recordBeginTime}}</span>
<b class="pro_item">用户分析</b> <span class="update_time">数据更新时间:{{lastUpdatedTime}} &nbsp/&nbsp从{{recordBeginTime}}开始统计</span>
</div>
<div style="margin-top: 20px;">
<span class="sta_iterm">统计周期:</span>
@@ -25,7 +25,7 @@
end-placeholder="结束日期">
</el-date-picker>
</span>
<span style="float:right; margin-right: 20px;">
<span style="float:right; margin-right: 20px;" >
<a style="display:inline-block;margin-left: 20px; " id = 'download'>
<i class="el-icon-download"></i>
<span ><a @click="exportData()">下载报告</a> </span>
@@ -123,18 +123,18 @@
label="用户注册时间"
width="120px"
align="center">
<template slot-scope="scope">
<!-- <template slot-scope="scope">
{{scope.row.RegistDate | transformTimestamp}}
</template>
</template> -->
</el-table-column>
<el-table-column
prop="CountDate"
label="系统统计时间"
width="120px"
align="center">
<template slot-scope="scope">
<!-- <template slot-scope="scope">
{{scope.row.CountDate | transformTimestamp}}
</template>
</template> -->
</el-table-column>
</el-table>
</div>
@@ -171,7 +171,7 @@
value_time: '',
search:'',
data:'',
columns: [{title: 'ID',key: 'ID'},{title: '用户名',key: 'Name'},{title: 'PR数',key: 'CommitCount'},{title: '提出任务数',key: 'IssueCount'},{title: '评论数',key: 'CommentCount'},{title: '关注项目数',key: 'FocusRepoCount'},{title: '点赞项目数',key: 'StarRepoCount'},{title: '登录次数',key: 'LoginCount'},{title:'关注者数',key:'WatchedCount'},{title:'commit代码行数',key:'CommitCodeSize'},{title:'已解决任务数',key:'SolveIssueCount'},{title:'百科页面贡献次数',key:'EncyclopediasCount'},{title:'创建项目',key:'CreateRepoCount'},{title:'加入时间',key:'RegistDate'}],
columns: [{title: 'ID',key: 'ID'},{title: '用户名',key: 'Name'},{title: 'PR数',key: 'CommitCount'},{title: '提出任务数',key: 'IssueCount'},{title: '评论数',key: 'CommentCount'},{title: '关注项目数',key: 'FocusRepoCount'},{title: '点赞项目数',key: 'StarRepoCount'},{title: '登录次数',key: 'LoginCount'},{title:'关注者数',key:'WatchedCount'},{title:'commit代码行数',key:'CommitCodeSize'},{title:'已解决任务数',key:'SolveIssueCount'},{title:'百科页面贡献次数',key:'EncyclopediasCount'},{title:'创建项目',key:'CreateRepoCount'},{title:'用户注册时间',key:'RegistDate'},{title:'系统统计时间',key:'CountDate'}],
blob:'',
fileName:'',
dynamic:7,
@@ -180,8 +180,25 @@
};
},
methods: {

exportData(){
export2Excel(this.columns,this.tableData,"测试下载excel")
// this.getUserList('all_usr',7)
var saveFileName = this.getFileName()
export2Excel(this.columns,this.tableData,saveFileName)
},
getFileName(){
var saveFileName=''
var Date=(this.params.startDate).split('-')
var startDate=Date[0]+''+Date[1]+''+Date[2]
console.log(startDate)
Date=(this.params.endDate).split('-')
var endDate=Date[0]+Date[1]+Date[2]
saveFileName = '用户分析_'+this.search+''+startDate+'_'+endDate
if (this.type_val=='all_usr'){
saveFileName = '用户分析_'+this.search+'_all'
}
return saveFileName

},
handleCurrentChange(currentPage){
this.currentPage = currentPage;
@@ -209,6 +226,7 @@
},

getUserList(type_val,index){
this.type_val = type_val
this.dynamic = index;
console.log("dj:"+type_val)
var now = new Date(); // 当前日期
@@ -234,10 +252,10 @@
var tmp = new Date(now.setTime(now.getTime()-24*60*60*1000));
var yesterday = this.formatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate());
this.params.startDate = yesterday
this.params.endDate = yesterday
this.params.endDate = today
this.value_time=[]
document.getElementById("yesterday_usr").style.backgroundColor="409effd6"
document.getElementById("current_week_usr")
// document.getElementById("yesterday_usr").style.backgroundColor="409effd6"
// document.getElementById("current_week_usr")
break
}
case "current_week_usr":{
@@ -277,7 +295,7 @@
}
case "all_usr":{
console.log("e:"+today)
this.params.startDate = this.formatDate(2000, 1, 1); //this.recordBeginTime//
this.params.startDate = this.recordBeginTime//this.formatDate(2000, 1, 1); //
this.params.endDate = today
this.value_time=[]
break
@@ -290,6 +308,12 @@
}).then((res)=>{
this.currentPage = 1
this.tableData = res.data
console.log(" this.tableData:", this.tableData.length)
for(var i=0;i<this.tableData.length;i++){
this.tableData[i].RegistDate = this.transformTimestamp(this.tableData[i].RegistDate)
this.tableData[i].CountDate = this.transformTimestamp(this.tableData[i].CountDate)
console.log(" this.tableData:", this.tableData[i].RegistDate)
}
})
this.$axios.get('../api/v1/projectboard/project',{
params:this.params_pro
@@ -327,9 +351,6 @@
return 'background:#f5f5f6;color:#606266'
}
},
},
filters:{
transformTimestamp(timestamp){
console.log("timestamp",timestamp)
let a = new Date(timestamp*1000);
@@ -344,6 +365,10 @@
console.log('dateString', dateString); // > dateString 2021-07-06 14:23
return dateString;
},
},
filters:{

// transformTimestamp(timestamp){
// var dateString= new Date(timestamp);


Loading…
Cancel
Save