occupancyType.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div>
  3. <uni-table style="margin-top:40px;" ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据" @selection-change="selectionChange">
  4. <uni-tr>
  5. <uni-th width="60" align="center">入住类型</uni-th>
  6. <uni-th width="60" align="center">入住间数</uni-th>
  7. <uni-th width="60" align="center">房费</uni-th>
  8. <uni-th width="60" align="center">平均房价</uni-th>
  9. <uni-th width="60" align="center">非房费</uni-th>
  10. <uni-th width="60" align="center">收入小计</uni-th>
  11. </uni-tr>
  12. <uni-tr v-for="(item, index) in tableData" :key="index">
  13. <uni-td align="center">
  14. <view class="name">{{ item.name }}</view>
  15. </uni-td>
  16. <uni-td align="center">{{ item.rz_count }}</uni-td>
  17. <!-- <uni-td align="center">{{ item.address }}</uni-td> -->
  18. <uni-td align="center">{{ item.room_money }}</uni-td>
  19. <uni-td align="center">{{ item.room_average_price }}</uni-td>
  20. <uni-td align="center">{{ item.other_money }}</uni-td>
  21. <uni-td align="center">{{ item.sum_money }}</uni-td>
  22. <!-- <uni-td align="center">{{ item.date }}</uni-td> -->
  23. </uni-tr>
  24. </uni-table>
  25. <div style="margin-top:20px;">
  26. <ucharts :chartData="chartsData" :type="'column'"></ucharts>
  27. </div>
  28. <div style="margin-top:20px;">
  29. <pieCharts :chartData="chartsPieDatas"></pieCharts>
  30. </div>
  31. <div style="margin-top:20px;">
  32. <pieCharts :chartData="chartsPieData"></pieCharts>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import ucharts from '../echarts/line.vue'
  38. import pieCharts from '../echarts/pie.vue'
  39. export default {
  40. components: {
  41. ucharts,
  42. pieCharts
  43. },
  44. props:{
  45. tableData:{
  46. type:Array,
  47. default(){
  48. return []
  49. }
  50. }
  51. },
  52. computed: {
  53. chartsData() {
  54. let categories = [];
  55. let series = [];
  56. let obj = {
  57. name: '收入',
  58. data: []
  59. }
  60. console.log(this.tableData);
  61. if (!this.tableData || this.tableData.length === 0) {
  62. return {
  63. categories,
  64. series
  65. }
  66. } else {
  67. this.tableData.forEach(ele => {
  68. categories.push(ele.name)
  69. obj.data.push(ele.sum_money)
  70. })
  71. series = [obj]
  72. return {
  73. categories,
  74. series
  75. }
  76. }
  77. },
  78. chartsPieData() {
  79. console.log('111111111', this.tableData);
  80. let series = []
  81. this.tableData.forEach(ele => {
  82. series.push({
  83. name: ele.name,
  84. value: ele.sum_money
  85. })
  86. })
  87. console.log('222222222222', series);
  88. return series
  89. },
  90. chartsPieDatas() {
  91. console.log('111111111', this.tableData);
  92. let series = []
  93. this.tableData.forEach(ele => {
  94. series.push({
  95. name: ele.name,
  96. value: ele.rz_count
  97. })
  98. })
  99. console.log('222222222222', series);
  100. return series
  101. },
  102. },
  103. data() {
  104. return {
  105. loading:false,
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. /deep/.uni-table {
  112. min-width: 100vw !important;
  113. }
  114. /deep/.uni-table-th {
  115. font-size: 12px !important;
  116. }
  117. </style>