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