meetingTimeCharts.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="myChart" ref="myChart" :style="{ height: height + 'px' }"></div>
  3. </template>
  4. <script>
  5. /**
  6. * 楼层选择全部时展示的图标
  7. */
  8. import apiSceneMeeting from "@/api/scene/meeting/apiSceneMeeting";
  9. export default {
  10. data() {
  11. return {
  12. option: {
  13. color: ["#80B2FF", "#FFDF80"],
  14. grid: {
  15. left: "2%", //默认10%
  16. right: "2%", //默认10%
  17. bottom: "0%", //默认60
  18. top: "15%",
  19. containLabel: true,
  20. //grid区域是否包含坐标轴的刻度标签
  21. },
  22. legend: {
  23. align: "left",
  24. top: "5%",
  25. //itemWidth: 30,
  26. //itemHeight: 10,
  27. formatter: (name) => {
  28. return `{a|${name}} `;
  29. },
  30. },
  31. xAxis: {
  32. type: "category",
  33. data: [
  34. "4月1日",
  35. "4月2日",
  36. "4月3日",
  37. "4月4日",
  38. "4月5日",
  39. "4月6日",
  40. "4月7日",
  41. "4月8日",
  42. "4月9日",
  43. "4月10日",
  44. "4月11日",
  45. "4月12日",
  46. ],
  47. },
  48. yAxis: [
  49. {
  50. name: "使用时长(h)",
  51. type: "value",
  52. nameTextStyle: {
  53. padding: [0, 20, 0, 0],
  54. },
  55. splitLine: {
  56. show: true,
  57. lineStyle: {
  58. color: "#e8e8e8",
  59. },
  60. },
  61. axisLine: {
  62. show: true,
  63. lineStyle: {
  64. color: "#233653",
  65. },
  66. },
  67. },
  68. ],
  69. tooltip: {
  70. trigger: "axis",
  71. axisPointer: {
  72. type: "shadow",
  73. },
  74. textStyle: {
  75. color: "#fff",
  76. align: "left",
  77. fontSize: 14,
  78. },
  79. axisLine: {
  80. //x坐标轴轴线
  81. show: true,
  82. lineStyle: {
  83. //x坐标轴轴线样式
  84. color: "#000", //'#ccc' | 'rgb(128, 128, 128)' | 'rgba(128, 128, 128, 0.5)',设置标签颜色
  85. },
  86. },
  87. backgroundColor: "rgba(0,0,0,0.8)",
  88. },
  89. series: [
  90. {
  91. data: [32, 39, 54, 55, 101, 76, 60, 42, 36, 57, 40, 85],
  92. type: "bar",
  93. stack: "A",
  94. barWidth: "30px",
  95. backgroundStyle: {
  96. color: "rgba(180, 180, 180, 0.2)",
  97. },
  98. },
  99. ],
  100. },
  101. };
  102. },
  103. props: {
  104. height: Number,
  105. queryData: Object,
  106. },
  107. mounted() {
  108. this.init();
  109. },
  110. methods: {
  111. init() {
  112. let chart = this.$echarts.init(this.$refs.myChart);
  113. this.chart = chart;
  114. this.$util.chartsResize(this.chart);
  115. chart.setOption(this.option);
  116. this.$store.loadingStore().loadingWithApi(this.getData());
  117. },
  118. getData() {
  119. this.loading = true;
  120. console.log(this.queryData.timeRange, "会议开始和结束时间");
  121. return apiSceneMeeting
  122. .getMeetingMinutes(this.queryData.timeRange)
  123. .then((res) => {
  124. let data = this.$util.dataUtil.covertDataToEcharts(res, ["minutes"]);
  125. // console.log(data, "会议时间");
  126. this.$util.dataUtil.refreshEchartsData(this.chart, this.option, data);
  127. this.loading = false;
  128. })
  129. .catch((err) => {
  130. this.loading = false;
  131. });
  132. },
  133. },
  134. };
  135. </script>
  136. <style lang="less" scoped></style>