fanlocal-echart-line.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="alarm-history">
  3. <BarAndLine class="echarts-line" xAxisPropType="time" :dataSource="historyLists" height="90%" width="100%"
  4. :chartsColumns="chartsColumn" :option="echatsOption" chartsType="listMonitor" />
  5. </div>
  6. </template>
  7. <script setup lang="ts">
  8. import { onBeforeMount, ref, watch, onMounted, nextTick, defineAsyncComponent, reactive, onUnmounted, inject, unref } from 'vue';
  9. import BarAndLine from '../../../../../components/chart/BarAndLine.vue';
  10. import { echatsOption } from '../fanLocal.data';
  11. const props = defineProps({
  12. devicekide: {
  13. type: String,
  14. default: '',
  15. },
  16. historyList: {
  17. type: Array,
  18. default: () => {
  19. return []
  20. }
  21. },
  22. chartsColumns: {
  23. type: Array,
  24. default: () => {
  25. return []
  26. }
  27. }
  28. });
  29. let scroll = reactive({
  30. y: 700,
  31. });
  32. let historyLists = ref<any[]>([])
  33. let chartsColumn = ref<any[]>([])
  34. watch(() => props.historyList, (newH, oldH) => {
  35. historyLists.value = newH
  36. },
  37. { immediate: true })
  38. watch(() => props.chartsColumns, (newC, oldC) => {
  39. chartsColumn.value = newC
  40. }, {
  41. immediate: true
  42. })
  43. </script>
  44. <style lang="less" scoped>
  45. .alarm-history {
  46. width: 100%;
  47. height: 730px;
  48. position: fixed;
  49. top: 100px;
  50. }
  51. </style>