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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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>
  145. </template>
  146. <script>
  147. // import barLabel from './basic/barLabel.vue';
  148. const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
  149. import { export2Excel } from '../excel/util.js'
  150. export default{
  151. name:'ProAnalysis',
  152. components: {
  153. // barLabel,
  154. },
  155. data() {
  156. return {
  157. recordBeginTime:'',
  158. lastUpdatedTime:'',
  159. page:1,
  160. pageSize:10,
  161. params:{type:'all',page:1,pagesize:10,beginTime:'',endTime:''},
  162. tableData: [],
  163. totalPage:0,
  164. totalNum:0,
  165. pickerOptions: {
  166. },
  167. value_time: '',
  168. search:'',
  169. dynamic:7,
  170. download_a:"",
  171. downLoadSrc:'',
  172. //单个项目参数
  173. columns: [{title: '日期',key: 'date'},{title: '浏览量',key: 'view'},{title: '下载量',key: 'download'},{title: 'commit',key: 'commit'}],
  174. currentPage:1,
  175. pageSize1:10,
  176. paramsID:{type:'all' ,beginTime:'',endTime:'',openi:'false'},
  177. tableDataIDTotal: [],
  178. tableDataID: [],
  179. tableDataIDOpenI:[],
  180. tableDataContTop10:[],
  181. create_time_pro: '',
  182. dynamic_pro:7,
  183. pro_name:'',
  184. alias:'',
  185. pro_id:'',
  186. ownerName:'',
  187. radarOpenI:'',
  188. echartsOITd:'',
  189. echartsSelectData:'',
  190. option:'',
  191. };
  192. },
  193. methods: {
  194. // download_file(){
  195. // this.params.type='all'
  196. // },
  197. popMark(){
  198. alert("数据为空时,不能下载!")
  199. },
  200. exportData(){
  201. // this.getOneProList(this.pro_id,'all',true,7)
  202. // this.getOneProList(this.pro_id,'all',false,7)
  203. // this.fileName()
  204. if (this.tableDataID!=''){
  205. this.currentPage=1
  206. var saveFileName = this.getFileName()
  207. export2Excel(this.columns,this.tableDataID,saveFileName)
  208. }else{
  209. alert("数据为空时,不能下载!")
  210. }
  211. },
  212. getFileName(){
  213. var now = new Date(); // 当前日期
  214. var nowDayOfWeek = now.getDay(); // 今天本周的第几天
  215. var nowDay = now.getDate(); // 当前日
  216. var nowMonth = now.getMonth(); // 当前月
  217. var nowYear = now.getFullYear(); // 当前年
  218. var today = this.saveFormatDate(nowYear,nowMonth+1,nowDay);
  219. var tmp = new Date(now.setTime(now.getTime()-24*60*60*1000));
  220. var yesterday = this.saveFormatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate());
  221. var yesterday_tmp = this.formatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate())
  222. var startDate=''
  223. var endDate=''
  224. var saveFileName = ''
  225. if (typeof this.paramsID.type=="undefined" || this.paramsID.type=="null" || this.paramsID.type==""){
  226. // startDate= this.saveFormatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate());
  227. endDate = this.saveFormatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate());
  228. var tmp = this.formatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate())
  229. startDate = this.comparedate(tmp,this.recordBeginTime)
  230. console.log("comparedate:"+startDate)
  231. saveFileName = this.alias+"_"+startDate+'_'+endDate
  232. }else{
  233. switch(this.paramsID.type){
  234. case "yesterday":{
  235. startDate = this.comparedate(yesterday_tmp,this.recordBeginTime)
  236. endDate = startDate
  237. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  238. break
  239. }
  240. case "current_week":{
  241. var now = new Date(); // 当前日期
  242. var nowDayOfWeek = now.getDay(); // 今天本周的第几天
  243. var day = nowDayOfWeek || 7;
  244. startDate = this.formatDate(now.getFullYear(), nowMonth+1, nowDay + 1 - day);
  245. startDate = this.comparedate(startDate,this.recordBeginTime)
  246. endDate = yesterday
  247. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  248. break
  249. }
  250. case "current_month":{
  251. startDate = this.formatDate(nowYear,nowMonth+1,1);
  252. startDate = this.comparedate(startDate,this.recordBeginTime)
  253. endDate = yesterday
  254. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  255. break
  256. }
  257. case "last_month":{
  258. let lastMonthDate = new Date(); // 上月日期
  259. lastMonthDate.setDate(1);
  260. lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
  261. let lastYear = lastMonthDate.getFullYear();
  262. let lastMonth = lastMonthDate.getMonth();
  263. startDate=this.formatDate(lastYear, lastMonth+1, 1);
  264. startDate = this.comparedate(startDate,this.recordBeginTime)
  265. var monthStartDate = new Date(lastYear, lastMonth, 1);
  266. var monthEndDate = new Date(lastYear, lastMonth+1, 1);
  267. var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24)
  268. endDate=this.saveFormatDate(lastYear, lastMonth+1, days); //月份从0开始,所以+1保存月份
  269. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  270. break
  271. }
  272. case "monthly":{
  273. var temp=new Date(now - 1000 * 60 * 60 * 24 * 30)
  274. startDate = this.formatDate(temp.getFullYear(),temp.getMonth()+1,temp.getDate());
  275. startDate = this.comparedate(startDate,this.recordBeginTime)
  276. endDate = yesterday
  277. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  278. break
  279. }
  280. case "current_year":{
  281. startDate = this.formatDate(now.getFullYear(), 1, 1);
  282. startDate = this.comparedate(startDate,this.recordBeginTime)
  283. endDate = yesterday
  284. saveFileName = this.alias+"_"+startDate+'_'+ endDate
  285. break
  286. }
  287. case "all":{
  288. console.log("e:"+today)
  289. startDate = 'all'
  290. endDate = yesterday
  291. saveFileName = this.alias+'_所有'
  292. break
  293. }
  294. }
  295. }
  296. return saveFileName
  297. },
  298. resetPage(){
  299. this.page=1
  300. this.params.page = 1
  301. },
  302. resetCurrentPage(){
  303. this.currentPage=1
  304. },
  305. handleSizeChange(val){
  306. this.params.pagesize = val
  307. this.resetPage()
  308. this.getAllProList(this.params.type, this.dynamic)
  309. },
  310. handleCurrentChange(val){
  311. console.log(val)
  312. this.params.page = val
  313. this.page = val
  314. switch(this.params.type){
  315. case "yesterday":{
  316. this.value_time=''
  317. this.getAllProList(this.params.type,1)
  318. break
  319. }
  320. case "current_week":{
  321. this.value_time=''
  322. this.getAllProList(this.params.type,2)
  323. break
  324. }
  325. case "current_month":{
  326. this.value_time=''
  327. this.getAllProList(this.params.type,3)
  328. break
  329. }
  330. case "last_month":{
  331. this.value_time=''
  332. this.getAllProList(this.params.type,4)
  333. break
  334. }
  335. case "monthly":{
  336. this.value_time=''
  337. this.getAllProList(this.params.type,5)
  338. break
  339. }
  340. case "current_year":{
  341. this.value_time=''
  342. this.getAllProList(this.params.type,6)
  343. break
  344. }
  345. case "all":{
  346. this.value_time=''
  347. this.getAllProList(this.params.type,7)
  348. break
  349. }
  350. case "":{
  351. // this.value_time=''
  352. this.getAllProList(this.params.type,0)
  353. break
  354. }
  355. }
  356. },
  357. saveFormatDate(myyear,mymonth,myweekday) {
  358. // var myyear = this.date.getFullYear();
  359. // var mymonth = this.date.getMonth() + 1;
  360. // var myweekday = this.date.getDate();
  361. if (mymonth < 10) {
  362. mymonth = "0" + mymonth;
  363. }
  364. if (myweekday < 10) {
  365. myweekday = "0" + myweekday;
  366. }
  367. console.log((myyear +''+ mymonth +''+ myweekday))
  368. return (myyear +''+ mymonth +''+ myweekday);
  369. },
  370. formatDate(myyear,mymonth,myweekday) {
  371. // var myyear = this.date.getFullYear();
  372. // var mymonth = this.date.getMonth() + 1;
  373. // var myweekday = this.date.getDate();
  374. if (mymonth < 10) {
  375. mymonth = "0" + mymonth;
  376. }
  377. if (myweekday < 10) {
  378. myweekday = "0" + myweekday;
  379. }
  380. return (myyear +'-'+ mymonth +'-'+ myweekday);
  381. },
  382. //获得某月的天数
  383. getAllProList(type_val,index){
  384. console.log("类型:"+type_val)
  385. this.dynamic = index
  386. if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
  387. this.params.type=''
  388. this.params.beginTime=this.formatDate(this.value_time[0].getFullYear(),this.value_time[0].getMonth() + 1,this.value_time[0].getDate())
  389. this.params.endTime=this.formatDate(this.value_time[1].getFullYear(),this.value_time[1].getMonth() + 1,this.value_time[1].getDate())
  390. }else{
  391. this.params.type=type_val
  392. this.params.beginTime=''
  393. this.params.endTime=''
  394. this.value_time=[]
  395. }
  396. console.log("params:",this.params)
  397. this.$axios.get('../api/v1/projectboard/summary/period',{
  398. params:this.params
  399. }).then((res)=>{
  400. // this.recordBeginTime=res.data.recordBeginTime
  401. // this.lastUpdatedTime=res.data.lastUpdatedTime
  402. // this.tableData = res.data.pageRecords
  403. // this.totalPage=res.data.totalPage
  404. // this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize
  405. console.log("this.totalPage:"+this.totalPage)
  406. })
  407. },
  408. searchName(){
  409. this.params.q = this.search
  410. this.params.page = 1
  411. this.page=1
  412. this.getAllProList(this.params.type, this.dynamic)
  413. },
  414. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  415. if(rowIndex===0){
  416. return 'background:#f5f5f6;color:#606266'
  417. }
  418. },
  419. cellStyle({row,column,rowIndex,columnIndex}){
  420. if(rowIndex%2 === 1){
  421. return 'background:#f5f5f6;color:#606266'
  422. }
  423. },
  424. handleSizeChangeID(val){
  425. this.pageSize1=val
  426. },
  427. handleCurrentChangeID(currentPage){
  428. this.currentPage = currentPage;
  429. },
  430. getOneProData(pro_id){
  431. this.$axios.get('../api/v1/projectboard/project/'+pro_id,{
  432. }).then((res)=>{
  433. this.tableDataIDTotal = res.data
  434. this.tableDataContTop10=res.data.top10
  435. // this.drawLine()
  436. this.drawRadarOpenI()
  437. })
  438. },
  439. getOneProList(pro_id,type_val,bool_val,index){
  440. this.dynamic_pro=index
  441. console.log("日期类型:"+type_val)
  442. if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
  443. this.paramsID.type=''
  444. this.paramsID.beginTime= this.formatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate())
  445. this.paramsID.endTime=this.formatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate())
  446. }else{
  447. this.create_time_pro=[]
  448. this.paramsID.type=type_val
  449. this.paramsID.beginTime=''
  450. this.paramsID.endTime=''
  451. }
  452. this.paramsID.openi=bool_val
  453. this.$axios.get('../api/v1/projectboard/summary/period',{
  454. params:this.paramsID
  455. }).then((res)=>{
  456. if (bool_val){
  457. this.tableDataIDOpenI = res.data
  458. // this.drawOpenItrend()
  459. }else{
  460. this.tableDataID = res.data
  461. // this.drawSelectData()
  462. }
  463. })
  464. },
  465. drawRadarOpenI(){
  466. 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)]
  467. console.log("ydata:",ydata)
  468. var i = -1;
  469. var option = {
  470. titile:{
  471. text:""
  472. },
  473. tooltip: {
  474. trigger: 'item',
  475. backgroundColor:'rgba(255,255,255,0.8)',
  476. color:'black',
  477. borderWidth:'1',
  478. borderColor:'gray',
  479. textStyle:{
  480. color:'black'
  481. },
  482. position: 'right',
  483. // formatter: function (params) {
  484. // console.log('params:',params)
  485. // console.log('params.data:',params[0])
  486. // let str = params.data.name + "<br />";
  487. // params.data.forEach((item) => {
  488. // str +=
  489. // '<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 />";
  490. // });
  491. // return str;
  492. // },
  493. // formatter: function (params, ticket, callback) {
  494. // console.log(params);
  495. // var showHtm="";
  496. // var data = params.data.value
  497. // for(var i=0;i<data.length;i++){
  498. // //x轴名称
  499. // var name = data[i];
  500. // //值
  501. // var value = params[i][2];
  502. // showHtm+= text+ '--' + name + ' :' + value+'<br>'
  503. // }
  504. // return showHtm;
  505. // }
  506. },//提示层
  507. legend: {
  508. // data: ['']
  509. },
  510. radar: {
  511. name: {
  512. textStyle: {
  513. color: 'rgb(0,0,0)', //字体颜色
  514. borderRadius: 3, //圆角
  515. padding: [3, 5] //padding
  516. }
  517. },
  518. slpitNumber:5,
  519. center: ['50%', '50%'],
  520. splitArea: { // 坐标轴在 grid 区域中的分隔区域
  521. show: false,
  522. },
  523. indicator: [{
  524. name: '社区影响力',
  525. max: 100
  526. },
  527. {
  528. name: '项目成熟度',
  529. max: 100
  530. },
  531. {
  532. name: '开发活跃度',
  533. max: 100
  534. },
  535. {
  536. name: '项目健康度',
  537. max: 100
  538. },
  539. {
  540. name: '团队健康度',
  541. max: 100
  542. },
  543. {
  544. name: '项目发展趋势',
  545. max: 100
  546. }
  547. ],
  548. },
  549. series: [{
  550. type: 'radar',
  551. lineStyle:{
  552. width:2,
  553. color: '#0366D6',
  554. normal:{
  555. color:'#0366D6 '
  556. }
  557. },
  558. itemStyle : {
  559. normal : {
  560. color:'#0366D6'
  561. }
  562. },
  563. data: [{
  564. value: ydata,
  565. name:"数据"
  566. }]
  567. }]
  568. }
  569. this.radarOpenI.setOption(option)
  570. },
  571. drawOpenItrend(){
  572. var xdata_openI=[]
  573. var ydata_openI=[]
  574. for(var i =0;i<this.tableDataIDOpenI.length;i++){
  575. xdata_openI.push(this.tableDataIDOpenI[i].date);
  576. ydata_openI.push(this.roundingF(this.tableDataIDOpenI[i].openi))
  577. }
  578. console.log("ydata_openI:"+ydata_openI)
  579. console.log(xdata_openI)
  580. var option = {
  581. title : {
  582. text: 'OpenI指数趋势',
  583. textStyle: {
  584.                 fontSize: 12,
  585.             },
  586. left:'center',
  587. top:'bottom',
  588. subtext: '',
  589. },
  590. tooltip : {
  591. trigger: 'axis',
  592. backgroundColor:'rgba(255,255,255,0.8)',
  593. color:'black',
  594. borderWidth:'1',
  595. borderColor:'#DCE7FB',
  596. textStyle:{
  597. color:'black'
  598. },
  599. },
  600. legend: {
  601. orient: 'vertical',
  602. top:'top',  
  603. },
  604. // calculable : true,
  605. xAxis : [
  606. {
  607. type : 'category',
  608. boundaryGap: false,
  609. data : xdata_openI,
  610. }
  611. ],
  612. yAxis : [
  613. {
  614. type : 'value',
  615. }
  616. ],
  617. series : [
  618. {
  619. data: ydata_openI,
  620. type: 'line',
  621. areaStyle: {
  622. type:'linear',
  623. color:'#DCE7FB',
  624. opacity: 0.3,
  625. origin:"start",
  626. normal:{
  627. color:'#DCE7FB'
  628. }
  629. },
  630. lineStyle:{
  631. width:1,
  632. normal:{
  633. color:'#0366D6'
  634. }
  635. },
  636. itemStyle : {
  637. normal : {
  638. color:'#0366D6'
  639. }
  640. },
  641. }
  642. ]
  643. };
  644. this.echartsOITd.setOption(option)
  645. // setTimeout(function (){
  646. // window.onresize = function () {
  647. // this.echartsOITd.resize();
  648. // }
  649. // },200)
  650. },
  651. drawSelectData(){
  652. // $("#selectData").removeAttr("selectData").empty();
  653. var xdata=[]
  654. var ydata_view=[]
  655. var ydata_download=[]
  656. var ydata_commit=[]
  657. // if ()
  658. for(var i =0;i<this.tableDataID.length;i++){
  659. xdata.push(this.tableDataID[this.tableDataID.length-1-i].date);
  660. ydata_view.push(this.tableDataID[this.tableDataID.length-1-i].view)
  661. ydata_download.push(this.tableDataID[this.tableDataID.length-1-i].download)
  662. ydata_commit.push(this.tableDataID[this.tableDataID.length-1-i].commit)
  663. }
  664. console.log("ydata_openI:"+ydata_download)
  665. console.log(xdata)
  666. this.option = {
  667. title : {
  668. text: '',
  669. textStyle: {
  670.                 fontSize: 12,
  671.             },
  672. left:'center',
  673. top:'bottom',
  674. subtext: '',
  675. },
  676. tooltip : {
  677. trigger: 'axis',
  678. backgroundColor:'rgba(255,255,255,0.8)',
  679. color:'black',
  680. borderWidth:'1',
  681. borderColor:'gray',
  682. textStyle:{
  683. color:'black'
  684. },
  685. },
  686. legend: {
  687. data:['浏览量','下载量','commit'],
  688. // orient: 'vertical',
  689. // top:'top',  
  690. },
  691. toolbox: {
  692. show : false,
  693. feature : {
  694. mark : {show: true},
  695. dataView : {show: false, readOnly: false},
  696. magicType : {show: true, type: ['line', 'bar']},
  697. restore : {show: false},
  698. saveAsImage : {show: true}
  699. }
  700. },
  701. calculable : true,
  702. xAxis : [
  703. {
  704. type : 'category',
  705. data : xdata,
  706. }
  707. ],
  708. yAxis : [
  709. {
  710. type : 'value',
  711. }
  712. ],
  713. series : [
  714. { name:"浏览量",
  715. data: ydata_view,
  716. type: 'line',
  717. areaStyle: {},
  718. },
  719. {
  720. name:"下载量",
  721. data: ydata_download,
  722. type: 'line',
  723. areaStyle: {},
  724. },
  725. {
  726. name:"commit",
  727. data: ydata_commit,
  728. type: 'line',
  729. areaStyle: {},
  730. },
  731. ]
  732. };
  733. // this.echartsSelectData.resize()
  734. this.echartsSelectData.setOption(this.option)
  735. // setTimeout(function (){
  736. // window.onresize = function () {
  737. // this.echartsSelectData.resize;
  738. // }
  739. // },200)
  740. // // 使用刚指定的选择项数据显示图表。
  741. // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  742. // var checkboxs=document.getElementsByName('checkboxchart');
  743. // $(".checkboxchart").click(function(){
  744. // var obj = {};
  745. // for(var i=0; i<checkboxs.length; i++){
  746. // if(checkboxs[i].checked){
  747. // obj[selectArr[i]] = true;
  748. // }else{
  749. // obj[selectArr[i]] = false;
  750. // }
  751. // }
  752. // option.legend.selected = obj;
  753. // this.echartsSelectData.setOption(option);
  754. // });
  755. },
  756. roundingF(value){
  757. return Number(value).toFixed(2)
  758. },
  759. clickCheckBox(){
  760. // 使用刚指定的选择项数据显示图表。
  761. var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
  762. var checkboxs=document.getElementsByName('checkboxchart');
  763. // $(".checkboxchart").click(function(){
  764. var obj = {};
  765. for(var i=0; i<checkboxs.length; i++){
  766. if(checkboxs[i].checked){
  767. obj[selectArr[i]] = true;
  768. }else{
  769. obj[selectArr[i]] = false;
  770. }
  771. }
  772. this.option.legend.selected = obj;
  773. this.echartsSelectData.setOption(this.option);
  774. // });
  775. },
  776. comparedate(date1,date2){
  777. console.log("date1:"+date1)
  778. console.log("date1:"+date2)
  779. var oDate1 = new Date(date1);
  780. var oDate2 = new Date(date2);
  781. if(oDate1.getTime() < oDate2.getTime()){
  782. var data = date2.split('-')
  783. return data[0]+''+data[1]+''+data[2]
  784. } else {
  785. var data = date1.split('-')
  786. return data[0]+''+data[1]+''+data[2]
  787. }
  788. },
  789. goBack(){
  790. console.log(",")
  791. },
  792. },
  793. filters:{
  794. rounding (value) {
  795. return Number(value).toFixed(2)
  796. },
  797. changeType(value){
  798. if(value==false){
  799. return "否"
  800. }else{
  801. return "是"
  802. }
  803. },
  804. discriptionFun(value){
  805. if(value==''){
  806. return "暂无描述"
  807. }
  808. },
  809. showMode(value){
  810. if(value==1){
  811. return "可读权限"
  812. }else if(value==2){
  813. return "可写权限"
  814. }else if(value==3){
  815. return "管理员"
  816. }else if(value==4){
  817. return "所有者"
  818. }else{
  819. return "未定义"
  820. }
  821. },
  822. showContext(value){
  823. if (value.mode!=-1){
  824. return " <img class=\"ui avatar image\" src= \" "+ value.RelAvatarLink+ " \" > "+" <a href= \" " + AppSubUrl+"/"+value.user+ "\">"+value.user+" </a>"
  825. }
  826. else{
  827. return " <a href=\" mailto:" + value.email + "class=\"circular ui button\">" +value.user+ "</a>"
  828. }
  829. },
  830. transformTimestamp(timestamp){
  831. let a = new Date(timestamp*1000);
  832. const date = new Date(a);
  833. const Y = date.getFullYear() + '/';
  834. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '/';
  835. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  836. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  837. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes());
  838. const dateString = Y + M + D + h + m ;//+ s;
  839. return dateString;
  840. },
  841. },
  842. mounted() {
  843. this.getAllProList("all",7)
  844. console.log("id:"+this.pro_id);
  845. // document.getElementById('radar_openi').style.width = document.getElementById('pro_main').offsetWidth*0.22+'px'
  846. // document.getElementById('line_openi').style.width = document.getElementById('pro_main').offsetWidth*0.33+'px'
  847. // document.getElementById('selectData').style.width = document.getElementById('pro_main').offsetWidth*0.8+'px'
  848. // this.radarOpenI = this.$echarts.init(document.getElementById('radar_openi'))
  849. // this.echartsOITd = this.$echarts.init(document.getElementById('line_openi'))
  850. // this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
  851. // if (window.history && window.history.pushState) {
  852. // history.pushState(null, null, document.URL);
  853. // window.addEventListener('popstate', this.goBack, false);
  854. // }
  855. // window.onresize=function(){
  856. // this.radarOpenI.resize();
  857. // this.echartsOITd.resize();
  858. // this.echartsSelectData.resize();
  859. // }
  860. // console.log("this.radarOpenI:"+this.radarOpenI)
  861. },
  862. watch:{
  863. search(val){
  864. if(!val){
  865. this.params.q = this.search
  866. this.params.page = 1
  867. this.page=1
  868. this.getAllProList(this.params.type, this.dynamic)
  869. }
  870. }
  871. },
  872. created() {
  873. // this.download_a=document.getElementById("download_file")
  874. },
  875. updated(){
  876. if(document.querySelectorAll('img[avatar]').length!==0){
  877. window.LetterAvatar.transform()
  878. }
  879. }
  880. }
  881. </script>
  882. <style>
  883. .item_list_first{
  884. border-right: 1px solid rgba(219,219,219,100);
  885. padding-right: 10px;
  886. }
  887. .item_list{
  888. border-right: 1px solid rgba(219,219,219,100);
  889. padding:0px 10px;
  890. }
  891. .item_list_p{
  892. border-right: 1px solid rgba(219,219,219,100);
  893. padding:0px 10px;
  894. }
  895. .item_h{
  896. line-height: 40px;
  897. }
  898. .item_title_h{
  899. line-height: 28px;
  900. }
  901. </style>