area-data-panel3.js 5.0 KB

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