area-data-panel.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. (function(){
  2. // Vue.component('vuedals', Vuedals.Component);
  3. Vue.component('area-data-panel',{
  4. template: '<div class="area-panel">\
  5. <div class="area-tab-panel">\
  6. <div v-show="level==4" class="area-tab" :class="{\'active\': level==4 && !lowLevel}" @click="getLowCodeData(3)"><span>各区</span></div>\
  7. <div v-show="level >= 3" class="area-tab" :class="{\'active\': level==3 || lowLevel==2}" @click="getLowCodeData(2)"><span>社区</span></div>\
  8. <div 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. <th v-show="level>2 && lowLevel != 1" width="20"></th>\
  14. </tr></thead>\
  15. <tbody>\
  16. <tr v-for="row in rows" class="data-row" @click="getLowLeverData(row)">\
  17. <td v-for="(col, index) in row.cols" :class="{\'area-name\': index == 0}">\
  18. <div v-if="index==0" class="ranking" :class="{\'ranking1\': row.rank==1, \'ranking2\': row.rank==2, \'ranking3\': row.rank==3}">{{row.rank}}</div>\
  19. <div v-if="index==0" class="ui-col-1 c-nowrap-multi">{{col}}</div>\
  20. <span v-else>{{col}}</span>\
  21. </td>\
  22. <td v-show="level>2 && lowLevel != 1"><i class="fa fa-angle-right"></i></td>\
  23. </tr>\
  24. </tbody>\
  25. </table>\
  26. </div>',
  27. props:['headers','rows'],
  28. data: function(){
  29. return {
  30. // headers: ["排名", "咨询量", "未回复"],
  31. // rows: [{rank: 1, cols: ["思明区", "100", "2"]},
  32. // {rank: 2, cols: ["海沧区", "98", "1"]}],
  33. level: 4,
  34. lowLevel: '',
  35. area: '350200'
  36. }
  37. },
  38. methods: {
  39. getLowLeverData: function(row){
  40. if(this.level > 2 && this.lowLevel != 1){
  41. //跳转去下一级数据
  42. this.level --;
  43. this.area = row.code;
  44. //触发组件监听事件,去父页面请求新的数据
  45. this.$emit("getnewdata", {
  46. level: this.level,
  47. area: this.area,
  48. lowLevel: this.lowLevel
  49. });
  50. }else{
  51. //弹框显示团队信息
  52. Vuedals.Bus.$emit('new', {
  53. title: '团队信息',
  54. component: 'team-info',
  55. props: {
  56. teamId: 644
  57. }
  58. });
  59. }
  60. },
  61. getLowCodeData: function(code){
  62. if(code == 3){
  63. this.lowLevel = '';
  64. }else{
  65. this.lowLevel = code;
  66. }
  67. //触发组件监听事件,去父页面请求新的数据
  68. this.$emit("getnewdata", {
  69. level: this.level,
  70. area: this.area,
  71. lowLevel: this.lowLevel
  72. });
  73. }
  74. }
  75. });
  76. })()