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 58 kB

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