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

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  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="left"
  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. updated(){
  1046. if(document.querySelectorAll('img[avatar]').length!==0){
  1047. window.LetterAvatar.transform()
  1048. }
  1049. }
  1050. }
  1051. </script>
  1052. <style scoped>
  1053. .pro_item{
  1054. font-size: 16px;
  1055. color: rgba(16, 16, 16, 100);
  1056. font-family: SourceHanSansSC-bold;
  1057. }
  1058. .sta_item{
  1059. font-size: 14px;
  1060. color: rgb(0 0 0);
  1061. font-family: SourceHanSansSC-bold;
  1062. }
  1063. .update_time{
  1064. line-height: 17px;
  1065. font-size: 12px;
  1066. color:rgba(187, 187, 187, 100);
  1067. margin-left: 10px;
  1068. }
  1069. .btn{
  1070. line-height: 1.5;
  1071. margin: -3px;
  1072. border: 1px solid #409eff;
  1073. background: #FFFF;
  1074. color: #409eff;
  1075. width: 60px;
  1076. height: 30px;
  1077. border-radius:4px ;
  1078. }
  1079. /*
  1080. .btn:focus,
  1081. .btn:active{
  1082. background-color:#409effd6 ;
  1083. } */
  1084. /* /deep/ .el-date-picker {
  1085. width: 250px;
  1086. } */
  1087. /deep/ .el-table tbody tr:hover>td {
  1088. background-color:#D3D3D3!important;
  1089. opacity:1
  1090. }
  1091. /deep/ .el-table {
  1092. font-size: 12px;
  1093. }
  1094. /deep/ .el-range-separator{
  1095. width: 20% !important;
  1096. }
  1097. .colorChange {
  1098. background-color: #409effd6;
  1099. color: #FFFF;
  1100. }
  1101. .items{
  1102. text-align: center;
  1103. border-right:1px solid rgba(219, 219, 219, 100);
  1104. }
  1105. .item_l{
  1106. margin-right: 5px;
  1107. border:1px solid rgba(219, 219, 219, 100);
  1108. height: 370px;
  1109. width: 100%;
  1110. }
  1111. .item_r{
  1112. margin-right:5px;
  1113. border:1px solid rgba(219, 219, 219, 100);
  1114. height: 370px;
  1115. overflow:auto
  1116. }
  1117. .item_echart{
  1118. margin-top: 10px;
  1119. margin-right: 5px;
  1120. border:1px solid rgba(219, 219, 219, 100);
  1121. height: 350px;
  1122. width: 100%;
  1123. }
  1124. .item_content{
  1125. color: #409eff;
  1126. margin-top: 10px;
  1127. font-weight:bold;
  1128. }
  1129. </style>