personPortrait.vue 2.8 KB

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