area-data-panel.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 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 ><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. year:'',
  36. cityLevelNoShowTeamTab: false,
  37. districtLevelNoShowTeamTab: false
  38. }
  39. },
  40. mounted: function(){
  41. var vm = this;
  42. EventBus.$on("render-area-data", function(arg){
  43. vm.index = arg.index;
  44. vm.level = arg.level;
  45. vm.lowLevel = arg.lowLevel;
  46. vm.area = arg.area;
  47. vm.headers = arg.headers;
  48. vm.rows = arg.rows;
  49. vm.year=arg.year;
  50. vm.cityLevelNoShowTeamTab = arg.cityLevelNoShowTeamTab;
  51. vm.districtLevelNoShowTeamTab = arg.districtLevelNoShowTeamTab;
  52. })
  53. },
  54. computed: {
  55. showTeamTab: function(){
  56. if(this.cityLevelNoShowTeamTab){
  57. if(this.level == 4){
  58. return false;
  59. }else{
  60. if(this.districtLevelNoShowTeamTab){
  61. if(this.level == 3){
  62. return false;
  63. }else{
  64. return true;
  65. }
  66. }else{
  67. return true;
  68. }
  69. }
  70. }else{
  71. return true;
  72. }
  73. }
  74. },
  75. methods: {
  76. getLowLeverData: function(row){
  77. var vm=this
  78. if(this.level > 2 && this.lowLevel != 1){
  79. //跳转去下一级数据
  80. if(this.lowLevel && (this.level - this.lowLevel) >= 2){
  81. //从次级tab的内容查看再下一级的数据
  82. this.level = this.level - 2;
  83. this.lowLevel --;
  84. }else{
  85. this.level --;
  86. this.lowLevel = '';
  87. }
  88. this.area = row.code;
  89. this.areaTitle = row.name;
  90. //触发组件监听事件,去父页面请求新的数据
  91. this.$emit("getnewdata", {
  92. level: this.level,
  93. area: this.area,
  94. areaTitle: this.areaTitle,
  95. lowLevel: this.lowLevel,
  96. });
  97. }else{
  98. var title="团队信息"
  99. var size="md"
  100. var component='team-info'
  101. if(this.index==27){
  102. title="团队信息和代预约记录"
  103. size="lg"
  104. component='team-info-dyy'
  105. }
  106. //弹框显示团队信息
  107. Vuedals.Bus.$emit('new', {
  108. title: title,
  109. component: component,
  110. props: {
  111. teamId: row.code,
  112. year: vm.year
  113. },
  114. size:size
  115. });
  116. }
  117. },
  118. getLowCodeData: function(code){
  119. if(code == 3){
  120. this.lowLevel = '';
  121. }else{
  122. this.lowLevel = code;
  123. }
  124. //触发组件监听事件,去父页面请求新的数据
  125. this.$emit("getnewdata", {
  126. level: this.level,
  127. area: this.area,
  128. lowLevel: this.lowLevel
  129. });
  130. }
  131. }
  132. });
  133. })()