dashboardPortrait.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <script>
  2. import Card from "@/components/common/card.vue";
  3. import PersonPortrait from "@/components/dashboard/portrait/personPortrait.vue";
  4. import RestaurantPortrait from "@/components/dashboard/portrait/restaurantPortrait.vue";
  5. import SupermarketPortrait from "@/components/dashboard/portrait/supermarketPortrait.vue";
  6. import ElectricityPortrait from "@/components/dashboard/portrait/electricityPortrait.vue";
  7. import WaterPortrait from "@/components/dashboard/portrait/waterPortrait.vue";
  8. import HotPortrait from "@/components/dashboard/portrait/hotPortrait.vue";
  9. import ColdPortrait from "@/components/dashboard/portrait/coldPortrait.vue";
  10. import MoneyPortrait from "@/components/dashboard/portrait/moneyPortrait.vue";
  11. export default {
  12. data() {
  13. return {
  14. chartHeight: 490,
  15. currCheck: 'person',
  16. tagCheck: {
  17. person: true,
  18. restaurant: false,
  19. supermarket: false,
  20. electricity: false,
  21. water: false,
  22. hot: false,
  23. cold: false,
  24. money: false,
  25. }
  26. }
  27. },
  28. components: {
  29. Card,
  30. PersonPortrait,
  31. RestaurantPortrait,
  32. SupermarketPortrait,
  33. ElectricityPortrait,
  34. WaterPortrait,
  35. HotPortrait,
  36. ColdPortrait,
  37. MoneyPortrait,
  38. },
  39. methods: {
  40. handleTagSelect(item) {
  41. for (const key in this.tagCheck) {
  42. this.tagCheck[key] = false;
  43. }
  44. this.currCheck = item;
  45. this.tagCheck[item] = true;
  46. }
  47. }
  48. }
  49. </script>
  50. <template>
  51. <div class="dashboardPortrait">
  52. <Card title="统计画像">
  53. <div style="width: 97%;margin: 0 auto">
  54. <a-divider style="margin: 10px 0;padding: 0;"></a-divider>
  55. </div>
  56. <div class="dashboardPortrait-select">
  57. <a-checkable-tag v-model="tagCheck.person" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('person')">
  58. <span class="dashboardPortrait-select-text">人员</span>
  59. </a-checkable-tag>
  60. <a-checkable-tag v-model="tagCheck.restaurant" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('restaurant')">
  61. <span class="dashboardPortrait-select-text">餐厅</span>
  62. </a-checkable-tag>
  63. <a-checkable-tag v-model="tagCheck.supermarket" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('supermarket')">
  64. <span class="dashboardPortrait-select-text">商超</span>
  65. </a-checkable-tag>
  66. <a-checkable-tag v-model="tagCheck.electricity" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('electricity')">
  67. <span class="dashboardPortrait-select-text">用电</span>
  68. </a-checkable-tag>
  69. <a-checkable-tag v-model="tagCheck.water" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('water')">
  70. <span class="dashboardPortrait-select-text">用水</span>
  71. </a-checkable-tag>
  72. <a-checkable-tag v-model="tagCheck.hot" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('hot')">
  73. <span class="dashboardPortrait-select-text">用热</span>
  74. </a-checkable-tag>
  75. <a-checkable-tag v-model="tagCheck.cold" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('cold')">
  76. <span class="dashboardPortrait-select-text">用冷</span>
  77. </a-checkable-tag>
  78. <a-checkable-tag v-model="tagCheck.money" color="white" class="dashboardPortrait-select-tag" @change="handleTagSelect('money')">
  79. <span class="dashboardPortrait-select-text">资产</span>
  80. </a-checkable-tag>
  81. </div>
  82. <div class="dashboardPortrait-body">
  83. <PersonPortrait :chartHeight="chartHeight" v-if="currCheck==='person'"></PersonPortrait>
  84. <RestaurantPortrait :chartHeight="chartHeight" v-if="currCheck==='restaurant'"></RestaurantPortrait>
  85. <SupermarketPortrait :chartHeight="chartHeight" v-if="currCheck==='supermarket'"></SupermarketPortrait>
  86. <ElectricityPortrait :chartHeight="chartHeight" v-if="currCheck==='electricity'"></ElectricityPortrait>
  87. <WaterPortrait :chartHeight="chartHeight" v-if="currCheck==='water'"></WaterPortrait>
  88. <HotPortrait :chartHeight="chartHeight" v-if="currCheck==='hot'"></HotPortrait>
  89. <ColdPortrait :chartHeight="chartHeight" v-if="currCheck==='cold'"></ColdPortrait>
  90. <MoneyPortrait :chartHeight="chartHeight" v-if="currCheck==='money'"></MoneyPortrait>
  91. </div>
  92. </Card>
  93. </div>
  94. </template>
  95. <style lang="less" scoped>
  96. .dashboardPortrait {
  97. width: 100%;
  98. height: 100%;
  99. .dashboardPortrait-select {
  100. padding: 8px 15px;
  101. .dashboardPortrait-select-tag {
  102. border: 1px solid #F0F1F2;
  103. border-radius: 12px;
  104. padding: 1px 12px;
  105. margin-right: 16px;
  106. cursor: pointer;
  107. }
  108. .ant-tag-checkable-checked {
  109. .dashboardPortrait-select-text {
  110. color: white;
  111. }
  112. }
  113. .dashboardPortrait-select-text {
  114. color: #B3B3B3;
  115. }
  116. }
  117. .dashboardPortrait-body {
  118. padding: 8px 12px;
  119. }
  120. }
  121. </style>