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