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