(function(){ Vue.component('smfw-filter',{ template:'
', props:['chooseYear','minYear',"dimensionValList"], data: function(){ return { selyear:"", 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:[], dimensionVal:"", } }, 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); } //如果前一个页面返回的选中的年份 if(!this.chooseYear){ this.selyear = this.years[0]; this.dimensionVal="" }else{ this.selyear = this.chooseYear this.dimensionVal="" } }, methods: { yearClick:function(val){ this.selyear = val; this.dimensionVal="" }, chooseItem:function(item,param){ this[param] = item this.selyear = "" }, resetClick:function(){ this.selyear=this.years[0] this.dimensionVal="" this.rhfs = [] this.smfu = 1 }, confirmClick:function(){ var vm = this; //触发刷新 this.$emit('vuedals:close', { chooseYear: vm.selyear, rhfs: vm.rhfs.join(","), smfu: vm.smfu, dimensionVal:vm.dimensionVal }); }, 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] = [] } }, } }); })()