(function(){ Vue.component('hospital-filter',{ template:'
\ \ \
\
\ {{item.name}}\
\
\
\ \
\
\ {{item.name}}\
\
\
\
\ \
', props:['chopitalList','hopitalList','initarea'], data: function(){ return { activeName:0, hospitalCode:"", hospitalItem:{}, chopitalList:[], hopitalList:[], } }, mounted: function(){ this.selectHospital(this,1,'hopitalList') }, watch:{ activeName(v) { if(v == 0) { this.selectHospital(this,1,'hopitalList') }else{ this.selectHospital(this,2,'chopitalList') } }, }, methods: { selectHospital(vm,index,param) { var url = "/specialistStatistics/selectHospital", params = { town:vm.initarea, level:index }; statisticAPI.selectHospital(params).then(function(res) { if(res.status == 200) { vm[param] = res.data } else { vm.$message.error(res.msg) } }) }, resetClick:function(){ this.$emit('vuedals:close', {}); }, confirmClick:function(){ var vm = this; if(vm.hospitalCode){ //触发刷新 this.$emit('vuedals:close', { hospitalItem: vm.hospitalItem, hospitalCode: vm.hospitalCode, activeName:vm.activeName, }); }else{ vm.$message.error("请选择医院") } }, selHospitalItem:function(item){ var vm = this; vm.hospitalItem = item vm.hospitalCode = item.code } } }); })()