(function(){ Vue.component('smfu-serviceList',{ template:'
', props:['chooseYear','minYear'], data: function(){ return { years: [], smfuList:[{code:1,name:'上门服务'},{code:2,name:'入户访视'}], //上门服务 smfu:1, rhfsList:[{code:"5",name:'孕产妇'},{code:"6",name:'新生儿'}, {code:"9",name:'肺结核'},{code:"8",name:'80岁以上老人'},{code:"7",name:'重性精神疾病'}], //入户访视 rhfs:[], } }, mounted: function(){ var now = new Date(), year = now.getFullYear(); var minYear = 2016 if(this.minYear){ minYear = this.minYear } if(now.getMonth() < 6){ year --; } for(i=year; i>=this.minYear; i--){ this.years.push(i); } }, methods: { yearClick:function(val){ this.chooseYear = val; }, resetClick:function(){ this.chooseYear=this.years[0] this.rhfs = [] this.smfu = 1 }, confirmClick:function(){ var vm = this; //触发刷新 this.$emit('vuedals:close', { chooseYear: vm.chooseYear, rhfs: vm.rhfs.join(","), smfu: vm.smfu }); }, selItem:function(item,index){ var vm = this vm[index] = item.code }, selItems:function(item,index){ var vm=this if(item){ var code = item.code var hasIndex = vm[index].indexOf(code) if(hasIndex>-1){ vm[index].splice(hasIndex,1) }else{ vm[index].push(code) } }else{ vm[index] = [] } }, } }); })()