index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="24">
  5. <third-register></third-register>
  6. </el-col>
  7. </el-row>
  8. <el-row>
  9. <el-col :span="24">
  10. <basic-container>
  11. <avue-data-box :option="tenantCensus.option"></avue-data-box>
  12. </basic-container>
  13. </el-col>
  14. </el-row>
  15. <el-row>
  16. <el-col :span="12">
  17. <basic-container>
  18. <div ref="tenantShop" style="height: 300px;width: 100%"></div>
  19. </basic-container>
  20. </el-col>
  21. </el-row>
  22. </div>
  23. </template>
  24. <script>
  25. import * as echarts from 'echarts';
  26. import {getTenantCensusCount} from '@/api/census/census';
  27. export default {
  28. name: "wel",
  29. data() {
  30. return {
  31. tenantCensus:{
  32. option: {
  33. span:6,
  34. data: [
  35. {
  36. title: '用户数量',
  37. count: 0,
  38. icon: 'el-icon-user',
  39. color: '#797878',
  40. },
  41. {
  42. title: '会员数量',
  43. count: 0,
  44. icon: 'el-icon-user-solid',
  45. color: '#000000',
  46. },
  47. {
  48. title: '商户数量',
  49. count: 0,
  50. icon: 'el-icon-s-custom',
  51. color: '#F3E803FF',
  52. },
  53. {
  54. title: '商场数量',
  55. count: 0,
  56. icon: 'el-icon-s-shop',
  57. color: '#38A1F2FF',
  58. },
  59. ]
  60. },
  61. },
  62. tenantShop:{
  63. dom:null,
  64. option:{
  65. title: {
  66. text: '租户数据数量统计'
  67. },
  68. tooltip: {
  69. trigger: 'axis',
  70. axisPointer: {
  71. type: 'shadow'
  72. }
  73. },
  74. grid: {
  75. left: '3%',
  76. right: '4%',
  77. bottom: '3%',
  78. containLabel: true
  79. },
  80. xAxis: [
  81. {
  82. type: 'category',
  83. data: [], //设置x轴名称
  84. axisTick: {
  85. alignWithLabel: true
  86. }
  87. }
  88. ],
  89. yAxis: [
  90. {
  91. type: 'value'
  92. }
  93. ],
  94. series: [
  95. {
  96. name: '用户数量',
  97. type: 'bar',
  98. barWidth: '50%',
  99. data: []
  100. }
  101. ]
  102. }
  103. },
  104. };
  105. },
  106. mounted() {
  107. this.init();
  108. },
  109. methods: {
  110. //初始化方法
  111. init(){
  112. this.getTenantCensusCount()
  113. //适应容器动态变化
  114. // setTimeout(()=>{
  115. // window.onresize = ()=>{
  116. // for(const dom in this.$data){
  117. // this.$data[dom].dom.resize();
  118. // }
  119. // };
  120. // },1000);
  121. },
  122. //获取租户数量
  123. getTenantCensusCount(){
  124. //获取租户数量
  125. getTenantCensusCount().then(res=>{
  126. this.tenantCensus.option.data[0].count = res.data.data.userCount;
  127. this.tenantCensus.option.data[1].count = res.data.data.memberCount;
  128. this.tenantCensus.option.data[2].count = res.data.data.shopCount;
  129. this.tenantCensus.option.data[3].count = res.data.data.mallCount;
  130. });
  131. },
  132. //获取租户数量
  133. getTenantShopCount(){
  134. //获取租户数量
  135. getTenantCensusCount().then(res=>{
  136. //配置
  137. res.data.data.forEach(ele=>{
  138. this.tenantCensus.option.xAxis[0].data.push(ele.tenantName);
  139. this.tenantCensus.option.series[0].data.push(ele.count);
  140. });
  141. this.tenantCensus.dom = echarts.init(this.$refs.tenantUser);
  142. this.tenantCensus.dom.setOption(this.tenantCensus.option);
  143. });
  144. },
  145. },
  146. };
  147. </script>
  148. <style>
  149. .el-font-size {
  150. font-size: 14px;
  151. }
  152. </style>