workBus.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div>
  3. <div class="page-query-core">
  4. <query :show="['company', 'time']" :query-data="queryData" :reset="reset" :search="search"></query>
  5. <card :title="'核心指标'">
  6. <CoreData :data-list="coreData"></CoreData>
  7. </card>
  8. </div>
  9. <a-row :style="{ marginTop: '15px' }">
  10. <a-col :span="18">
  11. <div class="left ioc-card-content">
  12. <card :title="'公车管理'">
  13. <WorkBusChart ref="WorkBusChart" :query-data="queryData" :height="450" />
  14. </card>
  15. </div>
  16. </a-col>
  17. <a-col :span="6">
  18. <div class="right ioc-card-content">
  19. <card :title="'成本趋势'">
  20. <div style="padding: 0 15px">
  21. <WorkBusTrend ref="WorkBusTrend" :query-data="queryData" :height="450" />
  22. </div>
  23. </card>
  24. </div>
  25. </a-col>
  26. </a-row>
  27. </div>
  28. </template>
  29. <script>
  30. import query from "@/components/common/query.vue";
  31. import card from "@/components/common/card.vue";
  32. import WorkBusChart from "@/components/work/bus/component/workBusChart.vue";
  33. import WorkBusTrend from "@/components/work/bus/component/workBusTrend.vue";
  34. import apiWorkFloor from "@/api/work/apiWorkFloor";
  35. import ApiWorkBus from "@/api/work/apiWorkBus";
  36. export default {
  37. components: {
  38. query,
  39. card,
  40. WorkBusChart,
  41. WorkBusTrend,
  42. },
  43. data() {
  44. const listData = [];
  45. for (let i = 0; i < 100; i++) {
  46. listData.push({
  47. index: i + 1,
  48. name: "物理饭",
  49. department: "技术开发部门",
  50. time: "2023.02.03 00:00:00",
  51. });
  52. }
  53. let timeRange = this.$util.dateUtil.getNearlyMonthRange();
  54. return {
  55. queryData: {
  56. companyId: '0',
  57. timeRange: timeRange,
  58. },
  59. columns: [
  60. {title: "序号", dataIndex: "index", key: "1", width: 48},
  61. {title: "姓名", dataIndex: "name", key: "2", width: 60},
  62. {title: "部门", dataIndex: "department", key: "3", width: 80},
  63. {title: "最后进入时间", dataIndex: "time", key: "4", width: 90},
  64. ],
  65. listData: listData,
  66. coreData: [
  67. {
  68. title: "车辆平均成本(元)",
  69. num: "0",
  70. historyDesc: "同比",
  71. historyNum: 0,
  72. },
  73. {
  74. title: "车辆平均出车次数",
  75. num: "0",
  76. historyDesc: "同比",
  77. historyNum: 0,
  78. },
  79. {
  80. title: "车辆平均碳排放(tco2e)",
  81. num: "0",
  82. historyDesc: "同比",
  83. historyNum: 0,
  84. },
  85. {
  86. title: "平均出车时长(小时)",
  87. num: 0,
  88. historyDesc: "同比",
  89. historyNum: 0,
  90. },
  91. {
  92. type: 1,
  93. showStar: true,
  94. title: "值得关注",
  95. content: "",
  96. },
  97. ],
  98. };
  99. },
  100. mounted() {
  101. this.init();
  102. },
  103. methods: {
  104. init() {
  105. this.$store.loadingStore().loadingWithApi(this.getCoreData(), 2000)
  106. },
  107. reset() {
  108. },
  109. search() {
  110. this.$util.asyncPromise(
  111. this.getCoreData(),
  112. this.$refs.WorkBusChart.getData(),
  113. this.$refs.WorkBusTrend.getData(),
  114. )
  115. },
  116. getCoreData() {
  117. return ApiWorkBus.getCoreData(this.queryData).then(res=>{
  118. this.coreData[0].num = res.list[0].value
  119. this.coreData[0].historyNum = res.list[0].compare
  120. this.coreData[1].num = res.list[1].value
  121. this.coreData[1].historyNum = res.list[1].compare
  122. this.coreData[2].num = res.list[2].value
  123. this.coreData[2].historyNum = res.list[2].compare
  124. this.coreData[3].num = res.list[3].value
  125. this.coreData[3].historyNum = res.list[3].compare
  126. this.coreData[4].content = res.worthAttention
  127. })
  128. }
  129. },
  130. };
  131. </script>
  132. <style lang="less" scoped>
  133. .left {
  134. margin-right: 6px;
  135. }
  136. .right {
  137. margin-left: 6px;
  138. background-color: #ffffff;
  139. }
  140. </style>