area-data-panel.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. (function(){
  2. Vue.component('area-data-panel',{
  3. template: '<div class="area-panel">\
  4. <div class="area-tab-panel">\
  5. <div v-show="level==4" class="area-tab" :class="{\'active\': level==4 && (!lowLevel || lowLevel==3)}" @click="getLowCodeData(3)"><span>各区</span></div>\
  6. <div v-show="level >= 3" class="area-tab" :class="{\'active\': (level==3 && lowLevel!=1) || lowLevel==2}" @click="getLowCodeData(2)"><span>社区</span></div>\
  7. <div v-show="showTeamTab" class="area-tab" :class="{\'active\': level==2 || lowLevel==1}" @click="getLowCodeData(1)"><span>团队</span></div>\
  8. </div>\
  9. <table class="bottom-list-table mb20" id="listTable">\
  10. <thead><tr>\
  11. <th v-for="th in headers">{{th}}</th>\
  12. <th v-show="level>2 && lowLevel != 1" width="20"></th>\
  13. </tr></thead>\
  14. <tbody>\
  15. <tr v-for="row in rows" class="data-row" @click="getLowLeverData(row)">\
  16. <td v-for="(col, index) in row.cols" :class="{\'area-name\': index == 0}">\
  17. <div v-if="index==0" class="ranking" :class="{\'ranking1\': row.rank==1, \'ranking2\': row.rank==2, \'ranking3\': row.rank==3}">{{row.rank}}</div>\
  18. <div v-if="index==0" class="ui-col-1 c-nowrap-multi">{{col}}</div>\
  19. <span v-else>{{col}}</span>\
  20. </td>\
  21. <td v-show="level>2 && lowLevel != 1"><i class="fa fa-angle-right"></i></td>\
  22. </tr>\
  23. </tbody>\
  24. </table>\
  25. </div>',
  26. props:[],
  27. data: function(){
  28. return {
  29. index: '',
  30. level: '',
  31. lowLevel: '',
  32. area: '',
  33. headers: [],
  34. rows: [],
  35. cityLevelNoShowTeamTab: false,
  36. districtLevelNoShowTeamTab: false
  37. }
  38. },
  39. mounted: function(){
  40. var vm = this;
  41. EventBus.$on("render-area-data", function(arg){
  42. vm.index = arg.index;
  43. vm.level = arg.level;
  44. vm.lowLevel = arg.lowLevel;
  45. vm.area = arg.area;
  46. vm.headers = arg.headers;
  47. vm.rows = arg.rows;
  48. vm.cityLevelNoShowTeamTab = arg.cityLevelNoShowTeamTab;
  49. vm.districtLevelNoShowTeamTab = arg.districtLevelNoShowTeamTab;
  50. })
  51. },
  52. computed: {
  53. showTeamTab: function(){
  54. if(this.cityLevelNoShowTeamTab){
  55. if(this.level == 4){
  56. return false;
  57. }else{
  58. if(this.districtLevelNoShowTeamTab){
  59. if(this.level == 3){
  60. return false;
  61. }else{
  62. return true;
  63. }
  64. }else{
  65. return true;
  66. }
  67. }
  68. }else{
  69. return true;
  70. }
  71. }
  72. },
  73. methods: {
  74. getLowLeverData: function(row){
  75. if(this.level > 2 && this.lowLevel != 1){
  76. //跳转去下一级数据
  77. if(this.lowLevel && (this.level - this.lowLevel) >= 2){
  78. //从次级tab的内容查看再下一级的数据
  79. this.level = this.level - 2;
  80. this.lowLevel --;
  81. }else{
  82. this.level --;
  83. this.lowLevel = '';
  84. }
  85. this.area = row.code;
  86. this.areaTitle = row.name;
  87. //触发组件监听事件,去父页面请求新的数据
  88. this.$emit("getnewdata", {
  89. level: this.level,
  90. area: this.area,
  91. areaTitle: this.areaTitle,
  92. lowLevel: this.lowLevel,
  93. });
  94. }else{
  95. var title="团队信息"
  96. var size="md"
  97. var component='team-info'
  98. if(this.index==27){
  99. title="团队信息和代预约记录"
  100. size="lg"
  101. component='team-info-dyy'
  102. }
  103. //弹框显示团队信息
  104. Vuedals.Bus.$emit('new', {
  105. title: title,
  106. component: component,
  107. props: {
  108. teamId: row.code
  109. },
  110. size:size
  111. });
  112. }
  113. },
  114. getLowCodeData: function(code){
  115. if(code == 3){
  116. this.lowLevel = '';
  117. }else{
  118. this.lowLevel = code;
  119. }
  120. //触发组件监听事件,去父页面请求新的数据
  121. this.$emit("getnewdata", {
  122. level: this.level,
  123. area: this.area,
  124. lowLevel: this.lowLevel
  125. });
  126. }
  127. }
  128. });
  129. })()