You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProAnalysis.vue 52 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. <template>
  2. <div style="width: 100%;">
  3. <div id = "pro_main">
  4. <div style="margin-top: 10px;">
  5. <b class="pro_item">项目分析</b> <span class="update_time">数据更新时间:</span> <span style="font-size: 12px;">{{lastUpdatedTime}}&nbsp/&nbsp从{{recordBeginTime}}开始统计</span>
  6. </div>
  7. <bar-label :width="'95%'" :height="'500px'"></bar-label>
  8. <div style="margin-top: 20px;">
  9. <span class="sta_iterm">统计周期:</span>
  10. <button type="button" class='btn' id ="yesterday" v-bind:class="{colorChange:1==dynamic}" @click="resetPage(),getAllProList('yesterday',1)">昨天</button>
  11. <button type="button" class='btn' id = "current_week" v-bind:class="{colorChange:2==dynamic}" @click="resetPage(),getAllProList('current_week',2)">本周</button>
  12. <button type="button" class='btn' id = "current_month" v-bind:class="{colorChange:3==dynamic}" @click="resetPage(),getAllProList('current_month',3)">本月</button>
  13. <button type="button" class='btn' id = "last_month" v-bind:class="{colorChange:4==dynamic}" @click="resetPage(),getAllProList('last_month',4)">上月</button>
  14. <button type="button" class='btn' id = "monthly" v-bind:class="{colorChange:5==dynamic}" @click="resetPage(),getAllProList('monthly',5)">近30天</button>
  15. <button type="button" class='btn' id = "current_year" v-bind:class="{colorChange:6==dynamic}" @click="resetPage(),getAllProList('current_year',6)">今年</button>
  16. <button type="button" class='btn' id = "all" v-bind:class="{colorChange:7==dynamic}" @click="resetPage(),getAllProList('all',7)">所有</button>
  17. <span style="margin-left: 20px;">
  18. <el-date-picker
  19. v-model="value_time"
  20. prefix-icon="el-icon-time"
  21. @change="resetPage(),getAllProList('',0)"
  22. type="daterange"
  23. size='small'
  24. range-separator="至"
  25. start-placeholder="开始日期"
  26. end-placeholder="结束日期">
  27. </el-date-picker>
  28. </span>
  29. <span style="float:right; margin-right: 20px;">
  30. <div style="display:inline-block;margin-left: 20px; ">
  31. <i class="el-icon-download"></i>
  32. <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>
  33. </div>
  34. <span style="display:inline-block;margin-left: 20px; ">
  35. <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" @click="searchName() "></i>
  36. </el-input>
  37. </span>
  38. </span>
  39. </div>
  40. <div style="margin-top: 30px;">
  41. <el-table
  42. :data="tableData"
  43. style="width: 100%"
  44. :header-cell-style="tableHeaderStyle"
  45. :cell-style='cellStyle'>
  46. <el-table-column
  47. label="ID"
  48. align="center"
  49. prop="repo_id"
  50. stripe
  51. >
  52. </el-table-column>
  53. <el-table-column
  54. label="项目名称"
  55. width="125px"
  56. align="center"
  57. prop="name"
  58. style="color:#0366D6 100%;"
  59. >
  60. <template slot-scope="scope">
  61. <a @click=goToDetailPage(scope.row.repo_id,scope.row.name,scope.row.ownerName)>{{scope.row.name}} </a>
  62. </template>
  63. </el-table-column>
  64. <el-table-column
  65. label="拥有者"
  66. align="center"
  67. prop="ownerName"
  68. stripe
  69. >
  70. </el-table-column>
  71. <el-table-column
  72. prop="isPrivate"
  73. label="私有"
  74. align="center">
  75. <template slot-scope="scope">
  76. {{scope.row.isPrivate|changeType}}
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. prop="openi"
  81. label="OpenI指数"
  82. align="center">
  83. <template slot-scope="scope">
  84. {{scope.row.openi | rounding}}
  85. </template>
  86. </el-table-column>
  87. <el-table-column
  88. prop="view"
  89. label="浏览量"
  90. align="center">
  91. </el-table-column>
  92. <el-table-column
  93. prop="download"
  94. label="代码下载量"
  95. align="center">
  96. </el-table-column>
  97. <el-table-column
  98. prop="pr"
  99. label="PR"
  100. align="center">
  101. </el-table-column>
  102. <el-table-column
  103. prop="commit"
  104. label="Commit数"
  105. align="center">
  106. </el-table-column>
  107. <el-table-column
  108. prop="watch"
  109. label="关注数"
  110. align="center">
  111. </el-table-column>
  112. <el-table-column
  113. prop="star"
  114. label="点赞数"
  115. align="center">
  116. </el-table-column>
  117. <el-table-column
  118. prop="fork"
  119. label="派生数"
  120. align="center">
  121. </el-table-column>
  122. <el-table-column
  123. prop="issue"
  124. label="任务数"
  125. align="center">
  126. </el-table-column>
  127. <el-table-column
  128. prop="issueClosed"
  129. label="已解决任务"
  130. align="center">
  131. </el-table-column>
  132. <el-table-column
  133. prop="contributor"
  134. label="贡献者数"
  135. align="center">
  136. </el-table-column>
  137. </el-table>
  138. </div>
  139. <div style="margin-top:50px;text-align:center">
  140. <el-pagination
  141. background
  142. @current-change="handleCurrentChange"
  143. :current-page="page"
  144. :page-size="pageSize"
  145. layout="prev, pager, next"
  146. :total="totalNum">
  147. </el-pagination>
  148. </div>
  149. </div>
  150. <div id ="pro_detail" style="display:none;width: 100%;">
  151. <div style="margin-top: 10px;">
  152. <b class="pro_item">{{this.ownerName}}/{{this.pro_name}}</b> <span class="update_time">数据更新时间:</span><span style="font-size: 12px;">{{tableDataIDTotal.lastUpdatedTime}}&nbsp/&nbsp从{{tableDataIDTotal.recordBeginTime}}开始</span>
  153. </div>
  154. <div style="margin-top: 10px;">
  155. 项目描述:{{tableDataIDTotal.description | discriptionFun}}
  156. </div>
  157. <div style="margin-top:20px">
  158. <el-row >
  159. <el-col :span='4' class="items">
  160. <el-row>项目创建时间 </el-row>
  161. <el-row class="item_content">{{tableDataIDTotal.creatTime}}</el-row>
  162. </el-col>
  163. <el-col :span='4' class="items">
  164. <el-row>OpenI指数</el-row>
  165. <el-row class="item_content">{{tableDataIDTotal.openi | rounding}}</el-row>
  166. </el-col>
  167. <el-col :span='4' class="items">
  168. <el-row>评论数 </el-row>
  169. <el-row class="item_content">{{tableDataIDTotal.comment}}</el-row>
  170. </el-col>
  171. <el-col :span='4' class="items">
  172. <el-row>浏览量 </el-row>
  173. <el-row class="item_content">{{tableDataIDTotal.view}}</el-row>
  174. </el-col>
  175. <el-col :span='4' class="items">
  176. <el-row>代码下载量</el-row>
  177. <el-row class="item_content">{{tableDataIDTotal.download}}</el-row>
  178. </el-col>
  179. <el-col :span='4' style="text-align: center;">
  180. <el-row>任务完成比例</el-row>
  181. <el-row class="item_content">{{Math.round(tableDataIDTotal.issueClosedRatio * 100) }}%</el-row>
  182. </el-col>
  183. </el-row>
  184. </div>
  185. <div style="margin-top:30px;">
  186. <el-row :gutter="20">
  187. <el-col :span=18 >
  188. <div class="item_l" id="charts">
  189. <div style="font-size:14px;color:#409eff;margin:20px 5px;">OpenI指数:{{tableDataIDTotal.openi | rounding}}</div>
  190. <div >
  191. <el-col :span='8' id="radar_openi" :style="{width: '400px', height: '300px'}"></el-col>
  192. <el-col :span='16' id="line_openi" :style="{width: '600px', height: '300px',float:'right'}"></el-col>
  193. </div>
  194. </div>
  195. </el-col>
  196. <el-col :span=6 >
  197. <div class="item_r">
  198. <div style="font-size:14px;color:rgb(0,0,0);margin:20px 5px;">贡献者TOP10</div>
  199. <div>
  200. <el-table
  201. :data="tableDataContTop10"
  202. style="width: 100%"
  203. stripe
  204. :header-cell-style="tableHeaderStyle"
  205. >
  206. <el-table-column
  207. label="用户名"
  208. align="center"
  209. prop="user">
  210. <template slot-scope="scope">
  211. <a v-if="scope.row.mode!=-1" :href="AppSubUrl +'../../../'+ scope.row.user"><img class="ui avatar s16 image js-popover-card" :src="scope.row.relAvatarLink">{{scope.row.user}} </a>
  212. <a v-else :href="'mailto:'+ scope.row.email "> <img class="ui avatar s16 image js-popover-card" :avatar="scope.row.email"> {{scope.row.user}}</a>
  213. </template>
  214. </el-table-column>
  215. <el-table-column
  216. label="身份"
  217. align="center"
  218. prop="mode"
  219. v-if='0'>
  220. <template slot-scope="scope">
  221. {{scope.row.mode | showMode}}
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. prop="pr"
  226. label="PR"
  227. align="center">
  228. </el-table-column>
  229. <el-table-column
  230. prop="commit"
  231. label="commit"
  232. align="center">
  233. </el-table-column>
  234. </el-table>
  235. </div>
  236. </div>
  237. </el-col>
  238. </el-row>
  239. </div>
  240. <div style="margin-top: 20px;">
  241. <span class="sta_iterm">统计周期:</span>
  242. <button type="button" class='btn' id ="yesterday_pro" v-bind:class="{colorChange:1==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'yesterday',false,1)">昨天</button>
  243. <button type="button" class='btn' id = "current_week_pro" v-bind:class="{colorChange:2==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'current_week',false,2)">本周</button>
  244. <button type="button" class='btn' id = "current_month_pro" v-bind:class="{colorChange:3==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'current_month',false,3)">本月</button>
  245. <button type="button" class='btn' id = "last_month_pro" v-bind:class="{colorChange:4==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'last_month',false,4)">上月</button>
  246. <button type="button" class='btn' id = "monthly_pro" v-bind:class="{colorChange:5==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'monthly',false,5)">近30天</button>
  247. <button type="button" class='btn' id = "current_year_pro" v-bind:class="{colorChange:6==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'current_year',false,6)">今年</button>
  248. <button type="button" class='btn' id = "all_pro" v-bind:class="{colorChange:7==dynamic_pro}" @click="resetCurrentPage(),getOneProList(pro_id,'all',false,7)">所有</button>
  249. <span style="margin-left: 20px;">
  250. <el-date-picker
  251. v-model="create_time_pro"
  252. prefix-icon="el-icon-time"
  253. @change="resetCurrentPage(),getOneProList(pro_id,'',false,0),clickCheckBox"
  254. type="daterange"
  255. size='small'
  256. range-separator="至"
  257. start-placeholder="开始日期"
  258. end-placeholder="结束日期">
  259. </el-date-picker>
  260. </span>
  261. <span style="float:right; margin-right: 20px;">
  262. <div style="display:inline-block;margin-left: 20px;">
  263. <i class="el-icon-download"></i>
  264. <span ><a @click="exportData()">下载报告</a> </span>
  265. </div>
  266. </span>
  267. </div>
  268. <div class="item_echart" id ='linecharts'>
  269. <div style="margin-top:10px;margin-left: 5px;">
  270. <label for="label" @change='clickCheckBox'>
  271. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="浏览量"/>浏览量
  272. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="下载量"/>下载量
  273. <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="commit"/>commit
  274. </label>
  275. </div>
  276. <div id ="selectData" style="width: 1280px;height: 300px;">
  277. </div>
  278. </div>
  279. <div style="margin-top: 30px;">
  280. <el-table
  281. :data="tableDataID.slice((currentPage-1)*pageSize,currentPage*pageSize)"
  282. style="width: 100%"
  283. :header-cell-style="tableHeaderStyle"
  284. :cell-style='cellStyle'>
  285. <el-table-column
  286. label="日期"
  287. align="center"
  288. prop="date"
  289. stripe
  290. >
  291. </el-table-column>
  292. <el-table-column
  293. label="浏览量"
  294. align="center"
  295. prop="view">
  296. </el-table-column>
  297. <el-table-column
  298. prop="download"
  299. label="下载量"
  300. align="center">
  301. </el-table-column>
  302. <el-table-column
  303. prop="commit"
  304. label="commit"
  305. align="center">
  306. </el-table-column>
  307. </el-table>
  308. </div>
  309. <div style="margin-top:50px;text-align:center">
  310. <el-pagination
  311. background
  312. @current-change="handleCurrentChangeID"
  313. :current-page="currentPage"
  314. :page-size="pageSize1"
  315. layout="prev, pager, next"
  316. :total="tableDataID.length">
  317. </el-pagination>
  318. </div>
  319. </div>
  320. </div>
  321. </template>
  322. <script>
  323. // import barLabel from './basic/barLabel.vue';
  324. const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
  325. import { export2Excel } from '../excel/util.js'
  326. export default{
  327. name:'ProAnalysis',
  328. components: {
  329. // barLabel,
  330. },
  331. data() {
  332. return {
  333. recordBeginTime:'',
  334. lastUpdatedTime:'',
  335. page:1,
  336. pageSize:10,
  337. params:{type:'all',page:1,pagesize:10,beginTime:'',endTime:'',q:'',sort:'openi'},
  338. tableData: [],
  339. totalPage:0,
  340. totalNum:0,
  341. pickerOptions: {
  342. },
  343. value_time: '',
  344. search:'',
  345. dynamic:7,
  346. download_a:"",
  347. //单个项目参数
  348. columns: [{title: '日期',key: 'date'},{title: '浏览量',key: 'view'},{title: '下载量',key: 'download'},{title: 'commit',key: 'commit'}],
  349. currentPage:1,
  350. pageSize1:10,
  351. paramsID:{type:'all' ,beginTime:'',endTime:'',openi:'false'},
  352. tableDataIDTotal: [],
  353. tableDataID: [],
  354. tableDataIDOpenI:[],
  355. tableDataContTop10:[],
  356. create_time_pro: '',
  357. dynamic_pro:7,
  358. pro_name:'',
  359. pro_id:'',
  360. ownerName:'',
  361. radarOpenI:'',
  362. echartsOITd:'',
  363. echartsSelectData:'',
  364. option:'',
  365. };
  366. },
  367. methods: {
  368. // download_file(){
  369. // this.params.type='all'
  370. // },
  371. exportData(){
  372. // this.getOneProList(this.pro_id,'all',true,7)
  373. // this.getOneProList(this.pro_id,'all',false,7)
  374. // this.fileName()
  375. this.currentPage=1
  376. var saveFileName = this.getFileName()
  377. export2Excel(this.columns,this.tableDataID,saveFileName)
  378. },
  379. getFileName(){
  380. var now = new Date(); // 当前日期
  381. var nowDayOfWeek = now.getDay(); // 今天本周的第几天
  382. var nowDay = now.getDate(); // 当前日
  383. var nowMonth = now.getMonth(); // 当前月
  384. var nowYear = now.getFullYear(); // 当前年
  385. var today = this.saveFormatDate(nowYear,nowMonth+1,nowDay);
  386. let lastMonthDate = new Date(); // 上月日期
  387. lastMonthDate.setDate(1);
  388. lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
  389. let lastYear = lastMonthDate.getYear();
  390. let lastMonth = lastMonthDate.getMonth();
  391. var startDate=''
  392. var endDate=''
  393. var saveFileName = ''
  394. if (typeof this.paramsID.type=="undefined" || this.paramsID.type=="null" || this.paramsID.type==""){
  395. startDate= this.saveFormatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate());
  396. endDate = this.saveFormatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate());
  397. saveFileName = this.pro_name+"_"+startDate+'_'+endDate
  398. }else{
  399. switch(this.paramsID.type){
  400. case "yesterday":{
  401. var now = new Date();
  402. var tmp = new Date(now.setTime(now.getTime()-24*60*60*1000));
  403. startDate = this.saveFormatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate());
  404. endDate = today
  405. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  406. break
  407. }
  408. case "current_week":{
  409. var now = new Date(); // 当前日期
  410. var nowDayOfWeek = now.getDay(); // 今天本周的第几天
  411. var day = nowDayOfWeek || 7;
  412. startDate = this.saveFormatDate(now.getFullYear(), nowMonth+1, nowDay + 1 - day);
  413. endDate = today
  414. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  415. break
  416. }
  417. case "current_month":{
  418. startDate = this.saveFormatDate(nowYear,nowMonth+1,1);
  419. endDate = today
  420. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  421. break
  422. }
  423. case "last_month":{
  424. startDate=this.saveFormatDate(nowYear, lastMonth+1, 1);
  425. endDate=this.saveFormatDate(nowYear, lastMonth+1, this.saveFormatDate(nowYear,lastMonth));
  426. endDate = today
  427. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  428. break
  429. }
  430. case "monthly":{
  431. var temp=new Date(now - 1000 * 60 * 60 * 24 * 30)
  432. startDate = this.saveFormatDate(temp.getFullYear(),temp.getMonth()+1,temp.getDate());
  433. endDate = today
  434. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  435. break
  436. }
  437. case "current_year":{
  438. startDate = this.saveFormatDate(now.getFullYear(), 1, 1);
  439. endDate = today
  440. saveFileName = this.pro_name+"_"+startDate+'_'+ endDate
  441. break
  442. }
  443. case "all":{
  444. console.log("e:"+today)
  445. startDate = 'all'
  446. endDate = today
  447. saveFileName = this.pro_name+'_所有'
  448. break
  449. }
  450. }
  451. }
  452. return saveFileName
  453. },
  454. resetPage(){
  455. this.page=1
  456. this.params.page = 1
  457. },
  458. resetCurrentPage(){
  459. this.currentPage=1
  460. },
  461. handleCurrentChange(val){
  462. console.log(val)
  463. this.params.page = val
  464. this.page = val
  465. switch(this.params.type){
  466. case "yesterday":{
  467. this.value_time=''
  468. this.getAllProList(this.params.type,1)
  469. break
  470. }
  471. case "current_week":{
  472. this.value_time=''
  473. this.getAllProList(this.params.type,2)
  474. break
  475. }
  476. case "current_month":{
  477. this.value_time=''
  478. this.getAllProList(this.params.type,3)
  479. break
  480. }
  481. case "last_month":{
  482. this.value_time=''
  483. this.getAllProList(this.params.type,4)
  484. break
  485. }
  486. case "monthly":{
  487. this.value_time=''
  488. this.getAllProList(this.params.type,5)
  489. break
  490. }
  491. case "current_year":{
  492. this.value_time=''
  493. this.getAllProList(this.params.type,6)
  494. break
  495. }
  496. case "all":{
  497. this.value_time=''
  498. this.getAllProList(this.params.type,7)
  499. break
  500. }
  501. case "":{
  502. // this.value_time=''
  503. this.getAllProList(this.params.type,0)
  504. break
  505. }
  506. }
  507. },
  508. saveFormatDate(myyear,mymonth,myweekday) {
  509. // var myyear = this.date.getFullYear();
  510. // var mymonth = this.date.getMonth() + 1;
  511. // var myweekday = this.date.getDate();
  512. if (mymonth < 10) {
  513. mymonth = "0" + mymonth;
  514. }
  515. if (myweekday < 10) {
  516. myweekday = "0" + myweekday;
  517. }
  518. console.log((myyear +''+ mymonth +''+ myweekday))
  519. return (myyear +''+ mymonth +''+ myweekday);
  520. },
  521. formatDate(myyear,mymonth,myweekday) {
  522. // var myyear = this.date.getFullYear();
  523. // var mymonth = this.date.getMonth() + 1;
  524. // var myweekday = this.date.getDate();
  525. if (mymonth < 10) {
  526. mymonth = "0" + mymonth;
  527. }
  528. if (myweekday < 10) {
  529. myweekday = "0" + myweekday;
  530. }
  531. return (myyear +'-'+ mymonth +'-'+ myweekday);
  532. },
  533. getAllProList(type_val,index){
  534. console.log("类型:"+type_val)
  535. this.dynamic = index
  536. if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
  537. this.params.type=''
  538. this.params.beginTime=this.formatDate(this.value_time[0].getFullYear(),this.value_time[0].getMonth() + 1,this.value_time[0].getDate())
  539. this.params.endTime=this.formatDate(this.value_time[1].getFullYear(),this.value_time[1].getMonth() + 1,this.value_time[1].getDate())
  540. }else{
  541. this.params.type=type_val
  542. this.params.beginTime=''
  543. this.params.endTime=''
  544. this.value_time=[]
  545. }
  546. this.$axios.get('../api/v1/projectboard/project',{
  547. params:this.params
  548. }).then((res)=>{
  549. this.recordBeginTime=res.data.recordBeginTime
  550. this.lastUpdatedTime=res.data.lastUpdatedTime
  551. this.tableData = res.data.pageRecords
  552. this.totalPage=res.data.totalPage
  553. this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize
  554. console.log("this.totalPage:"+this.totalPage)
  555. })
  556. },
  557. searchName(){
  558. this.params.q = this.search
  559. this.params.page = 1
  560. this.page=1
  561. this.getAllProList(this.params.type, this.dynamic)
  562. },
  563. goToDetailPage(pro_id,pro_name,ownerName){
  564. this.currentPage=1
  565. document.getElementById("pro_main").style.display="none";
  566. document.getElementById("pro_detail").style.display="block";
  567. console.log(pro_id)
  568. console.log(pro_name)
  569. this.pro_name=pro_name;
  570. this.pro_id=pro_id;
  571. this.ownerName=ownerName
  572. this.getOneProData(pro_id);
  573. this.getOneProList(pro_id,"current_year",true,0);
  574. this.getOneProList(pro_id,"monthly",false,5);
  575. },
  576. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  577. if(rowIndex===0){
  578. return 'background:#f5f5f6;color:#606266'
  579. }
  580. },
  581. cellStyle({row,column,rowIndex,columnIndex}){
  582. if(rowIndex%2 === 1){
  583. return 'background:#f5f5f6;color:#606266'
  584. }
  585. },
  586. handleCurrentChangeID(currentPage){
  587. this.currentPage = currentPage;
  588. },
  589. getOneProData(pro_id){
  590. this.$axios.get('../api/v1/projectboard/project/'+pro_id,{
  591. }).then((res)=>{
  592. this.tableDataIDTotal = res.data
  593. this.tableDataContTop10=res.data.top10
  594. // this.drawLine()
  595. this.drawRadarOpenI()
  596. })
  597. },
  598. getOneProList(pro_id,type_val,bool_val,index){
  599. this.dynamic_pro=index
  600. console.log("日期类型:"+type_val)
  601. if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
  602. this.paramsID.type=''
  603. this.paramsID.beginTime= this.formatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate())
  604. this.paramsID.endTime=this.formatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate())
  605. }else{
  606. this.create_time_pro=[]
  607. this.paramsID.type=type_val
  608. this.paramsID.beginTime=''
  609. this.paramsID.endTime=''
  610. }
  611. this.paramsID.openi=bool_val
  612. this.$axios.get('../api/v1/projectboard/project/'+pro_id+"/period",{
  613. params:this.paramsID
  614. }).then((res)=>{
  615. if (bool_val){
  616. this.tableDataIDOpenI = res.data
  617. this.drawOpenItrend()
  618. }else{
  619. this.tableDataID = res.data
  620. this.drawSelectData()
  621. }
  622. })
  623. },
  624. drawRadarOpenI(){
  625. var ydata = [this.roundingF(this.tableDataIDTotal.impact),this.roundingF(this.tableDataIDTotal.completeness),this.roundingF(this.tableDataIDTotal.liveness),this.roundingF(this.tableDataIDTotal.projectHealth),this.roundingF(this.tableDataIDTotal.teamHealth),this.roundingF(this.tableDataIDTotal.growth)]
  626. console.log("ydata:",ydata)
  627. var i = -1;
  628. var option = {
  629. titile:{
  630. text:""
  631. },
  632. tooltip: {
  633. trigger: 'item',
  634. backgroundColor:'rgba(255,255,255,0.8)',
  635. color:'black',
  636. borderWidth:'1',
  637. borderColor:'gray',
  638. textStyle:{
  639. color:'black'
  640. },
  641. position: 'right'
  642. },//提示层
  643. legend: {
  644. // data: ['']
  645. },
  646. radar: {
  647. name: {
  648. textStyle: {
  649. color: 'rgb(0,0,0)', //字体颜色
  650. borderRadius: 3, //圆角
  651. padding: [3, 5] //padding
  652. }
  653. },
  654. slpitNumber:5,
  655. center: ['50%', '50%'],
  656. indicator: [{
  657. name: '社区影响力',
  658. max: 100
  659. },
  660. {
  661. name: '项目成熟度',
  662. max: 100
  663. },
  664. {
  665. name: '开发活跃度',
  666. max: 100
  667. },
  668. {
  669. name: '项目健康度',
  670. max: 100
  671. },
  672. {
  673. name: '团队健康度',
  674. max: 100
  675. },
  676. {
  677. name: '项目发展趋势',
  678. max: 100
  679. }
  680. ],
  681. },
  682. series: [{
  683. type: 'radar',
  684. lineStyle:{
  685. width:2,
  686. color: '#409effd6',
  687. normal:{
  688. color:'#409effd6 '
  689. }
  690. },
  691. itemStyle : {
  692. normal : {
  693. color:'#409effd6'
  694. }
  695. },
  696. data: [{
  697. value: ydata,
  698. name:"数据"
  699. }]
  700. }]
  701. }
  702. this.radarOpenI.setOption(option)
  703. },
  704. drawOpenItrend(){
  705. var xdata_openI=[]
  706. var ydata_openI=[]
  707. for(var i =0;i<this.tableDataIDOpenI.length;i++){
  708. xdata_openI.push(this.tableDataIDOpenI[i].date);
  709. ydata_openI.push(this.roundingF(this.tableDataIDOpenI[i].openi))
  710. }
  711. console.log("ydata_openI:"+ydata_openI)
  712. console.log(xdata_openI)
  713. var option = {
  714. title : {
  715. text: 'OpenI指数趋势',
  716. textStyle: {
  717.                 fontSize: 12,
  718.             },
  719. left:'center',
  720. top:'bottom',
  721. subtext: '',
  722. },
  723. tooltip : {
  724. trigger: 'axis',
  725. backgroundColor:'rgba(255,255,255,0.8)',
  726. color:'black',
  727. borderWidth:'1',
  728. borderColor:'gray',
  729. textStyle:{
  730. color:'black'
  731. },
  732. },
  733. legend: {
  734. orient: 'vertical',
  735. top:'top',  
  736. },
  737. // calculable : true,
  738. xAxis : [
  739. {
  740. type : 'category',
  741. boundaryGap: false,
  742. data : xdata_openI,
  743. }
  744. ],
  745. yAxis : [
  746. {
  747. type : 'value',
  748. }
  749. ],
  750. series : [
  751. {
  752. data: ydata_openI,
  753. type: 'line',
  754. areaStyle: {
  755. type:'linear',
  756. color:'#DCE7FB',
  757. opacity: 0.3,
  758. origin:"start",
  759. normal:{
  760. color:'#DCE7FB'
  761. }
  762. },
  763. lineStyle:{
  764. width:1,
  765. normal:{
  766. color:'#409effd6'
  767. }
  768. },
  769. itemStyle : {
  770. normal : {
  771. color:'#409effd6'
  772. }
  773. },
  774. }
  775. ]
  776. };
  777. this.echartsOITd.setOption(option)
  778. },
  779. drawSelectData(){
  780. // $("#selectData").removeAttr("selectData").empty();
  781. var xdata=[]
  782. var ydata_view=[]
  783. var ydata_download=[]
  784. var ydata_commit=[]
  785. // if ()
  786. for(var i =0;i<this.tableDataID.length;i++){
  787. xdata.push(this.tableDataID[this.tableDataID.length-1-i].date);
  788. ydata_view.push(this.tableDataID[this.tableDataID.length-1-i].view)
  789. ydata_download.push(this.tableDataID[this.tableDataID.length-1-i].download)
  790. ydata_commit.push(this.tableDataID[this.tableDataID.length-1-i].commit)
  791. }
  792. console.log("ydata_openI:"+ydata_download)
  793. console.log(xdata)
  794. this.option = {
  795. title : {
  796. text: '',
  797. textStyle: {
  798.                 fontSize: 12,
  799.             },
  800. left:'center',
  801. top:'bottom',
  802. subtext: '',
  803. },
  804. tooltip : {
  805. trigger: 'axis',
  806. backgroundColor:'rgba(255,255,255,0.8)',
  807. color:'black',
  808. borderWidth:'1',
  809. borderColor:'gray',
  810. textStyle:{
  811. color:'black'
  812. },
  813. },
  814. legend: {
  815. data:['浏览量','下载量','commit'],
  816. // orient: 'vertical',
  817. // top:'top',  
  818. },
  819. toolbox: {
  820. show : false,
  821. feature : {
  822. mark : {show: true},
  823. dataView : {show: false, readOnly: false},
  824. magicType : {show: true, type: ['line', 'bar']},
  825. restore : {show: false},
  826. saveAsImage : {show: true}
  827. }
  828. },
  829. calculable : true,
  830. xAxis : [
  831. {
  832. type : 'category',
  833. data : xdata,
  834. }
  835. ],
  836. yAxis : [
  837. {
  838. type : 'value',
  839. }
  840. ],
  841. series : [
  842. { name:"浏览量",
  843. data: ydata_view,
  844. type: 'line',
  845. areaStyle: {},
  846. },
  847. {
  848. name:"下载量",
  849. data: ydata_download,
  850. type: 'line',
  851. areaStyle: {},
  852. },
  853. {
  854. name:"commit",
  855. data: ydata_commit,
  856. type: 'line',
  857. areaStyle: {},
  858. },
  859. ]
  860. };
  861. this.echartsSelectData.setOption(this.option)
  862. // // 使用刚指定的选择项数据显示图表。
  863. // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  864. // var checkboxs=document.getElementsByName('checkboxchart');
  865. // $(".checkboxchart").click(function(){
  866. // var obj = {};
  867. // for(var i=0; i<checkboxs.length; i++){
  868. // if(checkboxs[i].checked){
  869. // obj[selectArr[i]] = true;
  870. // }else{
  871. // obj[selectArr[i]] = false;
  872. // }
  873. // }
  874. // option.legend.selected = obj;
  875. // this.echartsSelectData.setOption(option);
  876. // });
  877. },
  878. roundingF(value){
  879. return Number(value).toFixed(2)
  880. },
  881. clickCheckBox(){
  882. // 使用刚指定的选择项数据显示图表。
  883. var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  884. var checkboxs=document.getElementsByName('checkboxchart');
  885. // $(".checkboxchart").click(function(){
  886. var obj = {};
  887. for(var i=0; i<checkboxs.length; i++){
  888. if(checkboxs[i].checked){
  889. obj[selectArr[i]] = true;
  890. }else{
  891. obj[selectArr[i]] = false;
  892. }
  893. }
  894. this.option.legend.selected = obj;
  895. this.echartsSelectData.setOption(this.option);
  896. // });
  897. }
  898. },
  899. filters:{
  900. rounding (value) {
  901. return Number(value).toFixed(2)
  902. },
  903. changeType(value){
  904. if(value==false){
  905. return "否"
  906. }else{
  907. return "是"
  908. }
  909. },
  910. discriptionFun(value){
  911. if(value==''){
  912. return "暂无描述"
  913. }
  914. },
  915. showMode(value){
  916. if(value==1){
  917. return "可读权限"
  918. }else if(value==2){
  919. return "可写权限"
  920. }else if(value==3){
  921. return "管理员"
  922. }else if(value==4){
  923. return "所有者"
  924. }else{
  925. return "未定义"
  926. }
  927. },
  928. showContext(value){
  929. if (value.mode!=-1){
  930. return " <img class=\"ui avatar image\" src= \" "+ value.RelAvatarLink+ " \" > "+" <a href= \" " + AppSubUrl+"/"+value.user+ "\">"+value.user+" </a>"
  931. }
  932. else{
  933. return " <a href=\" mailto:" + value.email + "class=\"circular ui button\">" +value.user+ "</a>"
  934. }
  935. },
  936. },
  937. mounted() {
  938. // document.getElementById("all").style.outline="none"
  939. // document.getElementById("all").focus()
  940. this.getAllProList("all",7)
  941. console.log("id:"+this.pro_id);
  942. // document.getElementById('radar_openi').style.width = document.getElementById('charts').offsetWidth*0.4+'px'
  943. // document.getElementById('line_openi').style.width = document.getElementById('charts').offsetWidth*0.6+'px'
  944. // document.getElementById('selectData').style.width = document.getElementById('linecharts').offsetWidth+'px'
  945. this.radarOpenI = this.$echarts.init(document.getElementById('radar_openi'))
  946. this.echartsOITd = this.$echarts.init(document.getElementById('line_openi'))
  947. this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
  948. // window.onresize=function(){
  949. // this.radarOpenI.resize();
  950. // this.echartsOITd.resize();
  951. // this.echartsSelectData.resize();
  952. // }
  953. // console.log("this.radarOpenI:"+this.radarOpenI)
  954. },
  955. watch:{
  956. search(val){
  957. if(!val){
  958. this.params.q = this.search
  959. this.params.page = 1
  960. this.page=1
  961. this.getAllProList(this.params.type, this.dynamic)
  962. }
  963. }
  964. },
  965. created() {
  966. // this.download_a=document.getElementById("download_file")
  967. }
  968. }
  969. </script>
  970. <style scoped>
  971. .pro_item{
  972. font-size: 16px;
  973. color: rgba(16, 16, 16, 100);
  974. font-family: SourceHanSansSC-bold;
  975. }
  976. .sta_item{
  977. font-size: 14px;
  978. color: rgb(0 0 0);
  979. font-family: SourceHanSansSC-bold;
  980. }
  981. .update_time{
  982. line-height: 17px;
  983. font-size: 12px;
  984. color:rgba(187, 187, 187, 100);
  985. margin-left: 10px;
  986. }
  987. .btn{
  988. line-height: 1.5;
  989. margin: -3px;
  990. border: 1px solid #409eff;
  991. background: #FFFF;
  992. color: #409eff;
  993. width: 60px;
  994. height: 30px;
  995. border-radius:4px ;
  996. }
  997. /*
  998. .btn:focus,
  999. .btn:active{
  1000. background-color:#409effd6 ;
  1001. } */
  1002. /* /deep/ .el-date-picker {
  1003. width: 250px;
  1004. } */
  1005. /deep/ .el-table tbody tr:hover>td {
  1006. background-color:#D3D3D3!important;
  1007. opacity:1
  1008. }
  1009. /deep/ .el-table {
  1010. font-size: 12px;
  1011. }
  1012. /deep/ .el-range-separator{
  1013. width: 20% !important;
  1014. }
  1015. .colorChange {
  1016. background-color: #409effd6;
  1017. color: #FFFF;
  1018. }
  1019. .items{
  1020. text-align: center;
  1021. border-right:2px solid rgba(219, 219, 219, 100);
  1022. }
  1023. .item_l{
  1024. margin-right: 5px;
  1025. border:1px solid rgba(219, 219, 219, 100);
  1026. height: 370px;
  1027. width: 100%;
  1028. }
  1029. .item_r{
  1030. margin-right:5px;
  1031. border:1px solid rgba(219, 219, 219, 100);
  1032. height: 370px;
  1033. }
  1034. .item_echart{
  1035. margin-top: 10px;
  1036. margin-right: 5px;
  1037. border:1px solid rgba(219, 219, 219, 100);
  1038. height: 350px;
  1039. width: 100%;
  1040. }
  1041. .item_content{
  1042. color: #409eff;
  1043. margin-top: 10px;
  1044. }
  1045. </style>