hospital-filter.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. (function(){
  2. Vue.component('hospital-filter',{
  3. template:'<div style="height: 400px;overflow: auto;margin-bottom: 50px;">\
  4. <el-tabs v-model="activeName" :stretch="true">\
  5. <el-tab-pane label="等级医院" name="0">\
  6. <div class="ptb10 c-f14 plr15 c-border-b ui-grid c-cursor-p" :class="{\'bgc-f2f3f4\':hospitalCode==item.code}" v-for="(item,index) in hopitalList" :key="index" @click="selHospitalItem(item)" >\
  7. <div class="ui-col-1">\
  8. {{item.name}}\
  9. </div>\
  10. </div>\
  11. </el-tab-pane>\
  12. <el-tab-pane label="社区医院" name="1">\
  13. <div class="ptb10 c-f14 plr15 c-border-b ui-grid c-cursor-p" :class="{\'bgc-f2f3f4\':hospitalCode==item.code}" v-for="(item,index) in chopitalList" :key="index" @click="selHospitalItem(item)" >\
  14. <div class="ui-col-1">\
  15. {{item.name}}\
  16. </div>\
  17. </div>\
  18. </el-tab-pane>\
  19. </el-tabs>\
  20. <div id="footer">\
  21. <div class="c-row btn-wrap c-border-top fr">\
  22. <div class="div-foot-btn mr20" @click="resetClick">\
  23. <a href="#" class="c-666 f-fs16">取消</a>\
  24. </div>\
  25. <div class="div-foot-btn active" @click="confirmClick">\
  26. <a href="#" class="c-666 f-fs16">确认</a>\
  27. </div>\
  28. </div>\
  29. </div>\
  30. </div>',
  31. props:['chopitalList','hopitalList','initarea'],
  32. data: function(){
  33. return {
  34. activeName:0,
  35. hospitalCode:"",
  36. hospitalItem:{},
  37. chopitalList:[],
  38. hopitalList:[],
  39. }
  40. },
  41. mounted: function(){
  42. this.selectHospital(this,1,'hopitalList')
  43. },
  44. watch:{
  45. activeName(v) {
  46. if(v == 0) {
  47. this.selectHospital(this,1,'hopitalList')
  48. }else{
  49. this.selectHospital(this,2,'chopitalList')
  50. }
  51. },
  52. },
  53. methods: {
  54. selectHospital(vm,index,param) {
  55. var url = "/specialistStatistics/selectHospital",
  56. params = {
  57. town:vm.initarea,
  58. level:index
  59. };
  60. statisticAPI.selectHospital(params).then(function(res) {
  61. if(res.status == 200) {
  62. vm[param] = res.data
  63. } else {
  64. vm.$message.error(res.msg)
  65. }
  66. })
  67. },
  68. resetClick:function(){
  69. this.$emit('vuedals:close', {});
  70. },
  71. confirmClick:function(){
  72. var vm = this;
  73. if(vm.hospitalCode){
  74. //触发刷新
  75. this.$emit('vuedals:close', {
  76. hospitalItem: vm.hospitalItem,
  77. hospitalCode: vm.hospitalCode,
  78. activeName:vm.activeName,
  79. });
  80. }else{
  81. vm.$message.error("请选择医院")
  82. }
  83. },
  84. selHospitalItem:function(item){
  85. var vm = this;
  86. vm.hospitalItem = item
  87. vm.hospitalCode = item.code
  88. }
  89. }
  90. });
  91. })()