personPortrait.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <script>
  2. import api from "@/api/dashboard/apiDashboard";
  3. import CoreData from "@/components/common/coreData.vue";
  4. import PersonTrendChart from "@/components/dashboard/portrait/person/personTrendChart.vue";
  5. export default {
  6. data() {
  7. return {
  8. coreData: [
  9. {
  10. type: 0,
  11. title: '进入大楼(人)',
  12. num: 0,
  13. historyDesc: '同比',
  14. historyNum: 0
  15. },
  16. {
  17. type: 0,
  18. title: '离开大楼(人)',
  19. num: 0,
  20. historyDesc: '同比',
  21. historyNum: 0
  22. },
  23. {
  24. type: 0,
  25. title: '9点前进入大楼(人)',
  26. num: 0,
  27. historyDesc: '同比',
  28. historyNum: 0
  29. },
  30. {
  31. type: 0,
  32. title: '楼内人员数量(人)',
  33. num: 0,
  34. historyDesc: '同比',
  35. historyNum: 0
  36. },
  37. {
  38. type: 1,
  39. title: '值得关注',
  40. showStar: true,
  41. content: ''
  42. },
  43. ],
  44. }
  45. },
  46. props: {
  47. chartHeight: Number
  48. },
  49. components: {
  50. CoreData,
  51. PersonTrendChart,
  52. },
  53. mounted() {
  54. this.init();
  55. },
  56. methods: {
  57. init() {
  58. this.getCoreData();
  59. },
  60. getCoreData() {
  61. api.getPersonCoreData(this.$util.dateUtil.getNearlyMonthRange()).then(res=>{
  62. this.coreData[0].num = res.list[0].value
  63. this.coreData[0].historyNum = res.list[0].compare
  64. this.coreData[1].num = res.list[1].value
  65. this.coreData[1].historyNum = res.list[1].compare
  66. this.coreData[2].num = res.list[2].value
  67. this.coreData[2].historyNum = res.list[2].compare
  68. this.coreData[3].num = res.list[3].value
  69. this.coreData[3].historyNum = res.list[3].compare
  70. this.coreData[4].content = res.worthAttention
  71. })
  72. },
  73. }
  74. }
  75. </script>
  76. <template>
  77. <div class="personPortrait">
  78. <div class="portrait-coreData">
  79. <CoreData :data-list="coreData"></CoreData>
  80. </div>
  81. <div style="padding: 15px;">
  82. <PersonTrendChart :height="chartHeight"></PersonTrendChart>
  83. </div>
  84. </div>
  85. </template>