area-data-panel3.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. (function(){
  2. Vue.component('area-data-panel',{
  3. template: '<div class="area-panel">\
  4. <div class="ui-grid panelTop c-border-tb">\
  5. <img v-show="reqList.length!=1" @click="back" src="../../../images/fanhui_icon.png" width="18" height="18" class="mr10 vam">\
  6. <div v-show="level==4" class="area-tab" :class="{\'active\': level==4 && (!lowLevel || lowLevel==3)}" @click="getLowCodeData(3)"><span>各区</span></div>\
  7. <div v-show="level >= 3" class="area-tab" :class="{\'active\': (level==3 && lowLevel!=1) || lowLevel==2}" @click="getLowCodeData(2)"><span>社区</span></div>\
  8. <div v-show="showTeamTab" class="area-tab" :class="{\'active\': level==2 || lowLevel==1}" @click="getLowCodeData(1)"><span>团队</span></div>\
  9. </div>\
  10. <div style="padding: 0 30px;">\
  11. <table class="bottom-list-table mb20" id="listTable">\
  12. <thead><tr>\
  13. <th v-for="th in headers">{{th}}</th>\
  14. </tr></thead>\
  15. <tbody>\
  16. <tr v-for="row in rows" class="data-row">\
  17. <td v-for="(col, index) in row.cols">\
  18. <span v-if="index==1&&level>2 && lowLevel != 1" :class="{\'toJump\':(index==1&&level>2 && lowLevel != 1)}" @click="getLowLeverData(row)">{{col}}</span>\
  19. <span v-else>{{col}}</span>\
  20. </td>\
  21. </tr>\
  22. </tbody>\
  23. </table>\
  24. </div>\
  25. </div>',
  26. props:[],
  27. data: function(){
  28. return {
  29. level: '',
  30. lowLevel: '',
  31. area: '',
  32. headers: [],
  33. rows: [],
  34. cityLevelNoShowTeamTab: false,
  35. districtLevelNoShowTeamTab: false,
  36. reqList:[]
  37. }
  38. },
  39. mounted: function(){
  40. var vm = this;
  41. EventBus.$on("render-area-data", function(arg){
  42. vm.level = arg.level;
  43. vm.lowLevel = arg.lowLevel;
  44. vm.area = arg.area;
  45. vm.headers = arg.headers;
  46. vm.rows = arg.rows;
  47. vm.cityLevelNoShowTeamTab = arg.cityLevelNoShowTeamTab;
  48. vm.districtLevelNoShowTeamTab = arg.districtLevelNoShowTeamTab;
  49. vm.reqList=arg.reqList
  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. // //弹框显示团队信息
  96. // Vuedals.Bus.$emit('new', {
  97. // title: '团队信息',
  98. // component: 'team-info',
  99. // props: {
  100. // teamId: row.code
  101. // }
  102. // });
  103. }
  104. },
  105. back:function(){
  106. EventBus.$emit('back-click', {});
  107. },
  108. getLowCodeData: function(code){
  109. if(code == 3){
  110. this.lowLevel = '';
  111. }else{
  112. this.lowLevel = code;
  113. }
  114. //触发组件监听事件,去父页面请求新的数据
  115. this.$emit("getnewdata", {
  116. level: this.level,
  117. area: this.area,
  118. lowLevel: this.lowLevel
  119. });
  120. }
  121. }
  122. });
  123. })()