nav-tab.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Vue.component('nav-tab', {
  2. template: '<div>\
  3. <div>\
  4. <ul class="nav-tab" style="height: 34px;">\
  5. <li @click="active(0)" :class="{\'active\': activeIdx == 0}">\
  6. 个人模板\
  7. </li>\
  8. <li @click="active(1)" :class="{\'active\': activeIdx == 1}">\
  9. 团队模板\
  10. </li>\
  11. <li @click="active(2)" :class="{\'active\': activeIdx == 2}">\
  12. 系统模板\
  13. </li>\
  14. </ul>\
  15. <person-panel v-show="activeIdx==0" :activetemplate="activetemplate"></person-panel>\
  16. <team-panel v-show="activeIdx==1" :activetemplate="activetemplate"></team-panel>\
  17. <system-panel v-show="activeIdx==2" :activetemplate="activetemplate"></system-panel>\
  18. </div>\
  19. <div>\
  20. <div v-if="isLeader && activeIdx == 0" class="new-temp" @click="newPersonTemplate">\
  21. <img class="c-vam" src="../../../images/tianjia_pre.png" width="20" />\
  22. <span class="c-vam">新建指导模板</span>\
  23. </div>\
  24. </div>\
  25. <div>\
  26. <div v-if="isLeader && activeIdx == 1" class="new-temp" @click="newTeamTemplate">\
  27. <img class="c-vam" src="../../../images/tianjia_pre.png" width="20" />\
  28. <span class="c-vam">新建指导模板</span>\
  29. </div>\
  30. </div>\
  31. </div>',
  32. props: [],
  33. data: function() {
  34. return {
  35. activeIdx: 0,
  36. activetemplate: null,
  37. isLeader: storage.docInfo.isLeader
  38. }
  39. },
  40. created: function() {
  41. var vm = this
  42. EventBus.$on('active-template', function(template) {
  43. vm.activetemplate = template
  44. })
  45. EventBus.$on('active-nav-tab', function(idx) {
  46. vm.activeIdx = idx
  47. })
  48. },
  49. methods: {
  50. active: function(idx) {
  51. this.activeIdx = idx
  52. },
  53. newPersonTemplate: function() {
  54. var query = {
  55. patient: storage.patient || "",
  56. timestemp: $.now()
  57. }
  58. this.$router.push({path:'/person-new-panel',query:query})
  59. },
  60. newTeamTemplate: function() {
  61. var query = {
  62. patient: storage.patient || "",
  63. timestemp: $.now()
  64. }
  65. this.$router.push({path:'/team-new-panel',query:query})
  66. }
  67. }
  68. })