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