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.

ProTend.vue 47 kB

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