smfu-serviceList.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. (function(){
  2. Vue.component('smfu-serviceList',{
  3. template:'<div style="height: 400px;overflow: auto;margin-bottom: 50px;">\
  4. <div class="mt10 ml10 filter-title">统计年份</div>\
  5. <div class="c-row ml40 mr10" id="signYear">\
  6. <div v-for="year in years" class="c-33 mt20" style="margin-left:0;margin-right:3%;" :class="{\'active\': year==chooseYear}" @click="yearClick(year)"><a>{{year}}</a></div>\
  7. </div>\
  8. <div class="mt20 ml10 filter-title">统计指标</div>\
  9. <div class="div-content">\
  10. <div class="mt20 div-group-btn c-row ml40 mr10">\
  11. <div class="div-btn c-33" v-for="item in smfuList" :class="{\'active\': smfu==item.code}" @click="selItem(item,\'smfu\')">\
  12. <a href="#" class="f-fs14">{{item.name}}</a>\
  13. </div>\
  14. </div>\
  15. </div>\
  16. <div class="mt20 ml10 filter-title" v-if="smfu == 2">统计维度</div>\
  17. <div class="div-content" v-if="smfu == 2">\
  18. <div class="c-row ml40 mr10">\
  19. <div class="c-33 mt20" style="margin-left:0;margin-right:3%;" :class="{\'active\': rhfs.length==0}" @click="selItems(\'\',\'rhfs\')">\
  20. <a href="#" class="f-fs14">全部</a>\
  21. </div>\
  22. <div class="c-33 mt20" style="margin-left:0;margin-right:3%;" v-for="item in rhfsList" :class="{\'active\': rhfs.indexOf(item.code)>-1}" @click="selItems(item,\'rhfs\')">\
  23. <a href="#" class="f-fs14">{{item.name}}</a>\
  24. </div>\
  25. </div>\
  26. </div>\
  27. <div id="footer">\
  28. <div class="c-row btn-wrap c-border-top fr">\
  29. <div class="div-foot-btn mr20" @click="resetClick">\
  30. <a href="#" class="c-666 f-fs16">重置</a>\
  31. </div>\
  32. <div class="div-foot-btn active" @click="confirmClick">\
  33. <a href="#" class="c-666 f-fs16">保存</a>\
  34. </div>\
  35. </div>\
  36. </div>\
  37. </div>',
  38. props:['chooseYear','minYear'],
  39. data: function(){
  40. return {
  41. years: [],
  42. smfuList:[{code:1,name:'上门服务'},{code:2,name:'入户访视'}], //上门服务
  43. smfu:1,
  44. rhfsList:[{code:"5",name:'孕产妇'},{code:"6",name:'新生儿'},
  45. {code:"9",name:'肺结核'},{code:"8",name:'80岁以上老人'},{code:"7",name:'重性精神疾病'}], //入户访视
  46. rhfs:[],
  47. }
  48. },
  49. mounted: function(){
  50. var now = new Date(),
  51. year = now.getFullYear();
  52. var minYear = 2016
  53. if(this.minYear){
  54. minYear = this.minYear
  55. }
  56. if(now.getMonth() < 6){
  57. year --;
  58. }
  59. for(i=year; i>=this.minYear; i--){
  60. this.years.push(i);
  61. }
  62. },
  63. methods: {
  64. yearClick:function(val){
  65. this.chooseYear = val;
  66. },
  67. resetClick:function(){
  68. this.chooseYear=this.years[0]
  69. this.rhfs = []
  70. this.smfu = 1
  71. },
  72. confirmClick:function(){
  73. var vm = this;
  74. //触发刷新
  75. this.$emit('vuedals:close', {
  76. chooseYear: vm.chooseYear,
  77. rhfs: vm.rhfs.join(","),
  78. smfu: vm.smfu
  79. });
  80. },
  81. selItem:function(item,index){
  82. var vm = this
  83. vm[index] = item.code
  84. },
  85. selItems:function(item,index){
  86. var vm=this
  87. if(item){
  88. var code = item.code
  89. var hasIndex = vm[index].indexOf(code)
  90. if(hasIndex>-1){
  91. vm[index].splice(hasIndex,1)
  92. }else{
  93. vm[index].push(code)
  94. }
  95. }else{
  96. vm[index] = []
  97. }
  98. },
  99. }
  100. });
  101. })()