sign-progress-filter.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. (function(){
  2. Vue.component('sign-progress-filter',{
  3. template:'<div style="height: 400px;overflow: auto;margin-bottom: 50px;">\
  4. <div class="mt10 ml10 filter-title">统计年份</div>\
  5. <div class="c-row mt20 ml40" id="signYear" v-html="yearHtml" @click="yearClick">\
  6. </div>\
  7. <div class="mt20 ml10 filter-title">统计维度</div>\
  8. <div class="div-content">\
  9. <div class="mt20 div-group-btn c-row ml40">\
  10. <div class="div-btn c-33 active">\
  11. <a href="#" class="f-fs14">按任务</a>\
  12. </div>\
  13. <div class="div-btn c-33">\
  14. <a href="#" class="f-fs14">按人口</a>\
  15. </div>\
  16. <div class="div-btn c-33">\
  17. <a href="#" class="f-fs14">65岁以上签约</a>\
  18. </div>\
  19. </div>\
  20. <div class="mt20 div-group-btn c-row ml40">\
  21. <div class="div-btn c-33">\
  22. <a href="#" class="f-fs14">高血压</a>\
  23. </div>\
  24. <div class="div-btn c-33">\
  25. <a href="#" class="f-fs14">糖尿病</a>\
  26. </div>\
  27. </div>\
  28. </div>\
  29. </div>',
  30. props:[],
  31. data: function(){
  32. return {
  33. yearHtml:""
  34. }
  35. },
  36. methods: {
  37. yearClick:function(){
  38. $(event.target.closest("div")).addClass('active').siblings().removeClass('active')
  39. },
  40. formatYearData: function () {
  41. //显示年份最低是2016年
  42. var now = new Date(),
  43. year = now.getFullYear();
  44. var yearHtml = "";
  45. if(now.getMonth() >= 6){
  46. yearHtml += '<div class="c-33 active" data-val="'+year+'"><a>'+year+"</a></div>";
  47. }
  48. for(i=year-1; i>=2016; i--){
  49. if(i == (year-1) && now.getMonth() < 6){
  50. yearHtml += '<div class="c-33 active" data-val="'+i+'"><a>'+i+"</a></div>";
  51. }else{
  52. yearHtml += '<div class="c-33" data-val="'+i+'"><a>'+i+"</a></div>";
  53. }
  54. }
  55. this.yearHtml = yearHtml;
  56. },
  57. },
  58. mounted: function(){
  59. this.formatYearData();
  60. }
  61. });
  62. })()