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

ProAnalysis.vue 52 kB

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