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.

BrainAnalysis.vue 45 kB

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