monitorChart.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <div class="monitor-chart">
  3. <Row :gutter="[40, 40]">
  4. <Col :span="12">
  5. <div class="h-400px monitor-chart__wrapper p-20px">
  6. <FormTitle class="monitor-chart__title" icon="gas-monitor-extract" title="累积抽采量" />
  7. <BarMulti :propTypeArr="chartSeriesMap" xAxisPropType="date" :chartData="testChartData.items" height="350px" />
  8. </div>
  9. </Col>
  10. <Col :span="12">
  11. <div class="h-400px monitor-chart__wrapper p-20px">
  12. <FormTitle class="monitor-chart__title" icon="gas-monitor-co" title="CO浓度" />
  13. <BarMulti :propTypeArr="chartSeriesMap" xAxisPropType="date" :chartData="testChartData.items" height="350px" />
  14. </div>
  15. </Col>
  16. <Col :span="12">
  17. <div class="h-400px monitor-chart__wrapper p-20px">
  18. <FormTitle class="monitor-chart__title" icon="gas-monitor-np" title="负压浓度" />
  19. <BarMulti :propTypeArr="chartSeriesMap" xAxisPropType="date" :chartData="testChartData.items" height="350px" />
  20. </div>
  21. </Col>
  22. <Col :span="12">
  23. <div class="h-400px monitor-chart__wrapper p-20px">
  24. <FormTitle class="monitor-chart__title" icon="gas-monitor-flow" title="瞬时流量" />
  25. <LineMulti :propTypeArr="chartSeriesMap" xAxisPropType="date" :chartData="testChartData.items" height="350px" />
  26. </div>
  27. </Col>
  28. </Row>
  29. </div>
  30. </template>
  31. <script setup lang="ts">
  32. import FormTitle from '/@/views/vent/gas/components/form/formTitle.vue';
  33. import BarMulti from '/@/components/chart/BarMulti.vue';
  34. import LineMulti from '/@/components/chart/LineMulti.vue';
  35. import { Row, Col } from 'ant-design-vue';
  36. import { LimitedArray } from '/@/utils/limitedArray';
  37. import { onMounted, onUnmounted, ref } from 'vue';
  38. defineProps({
  39. device: {
  40. type: Object,
  41. require: true,
  42. },
  43. });
  44. const testChartData = ref(new LimitedArray(10));
  45. const chartSeriesMap = new Map([
  46. ['valueA', '值A'],
  47. ['valueB', '值B'],
  48. ]);
  49. let timer: any = null;
  50. onMounted(() => {
  51. timer = setInterval(() => {
  52. const testobj = {
  53. valueA: Math.floor(Math.random() * 10),
  54. valueB: Math.floor(Math.random() * 10),
  55. date: new Date().getSeconds().toString(),
  56. };
  57. testChartData.value.push(testobj);
  58. }, 2000);
  59. });
  60. onUnmounted(() => {
  61. clearTimeout(timer);
  62. });
  63. </script>
  64. <style lang="less" scoped>
  65. @import '@/design/vent/color.less';
  66. .monitor-chart {
  67. margin-top: 100px;
  68. margin-left: 20px;
  69. margin-right: 20px;
  70. }
  71. .monitor-chart__wrapper {
  72. color: @white;
  73. border-top: 3px solid @vent-gas-primary-text;
  74. background-color: @vent-gas-primary-trasparent-bg;
  75. }
  76. </style>