index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="_energy">
  3. <layout>
  4. <template #left>
  5. <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
  6. <deviceList :resultData="leftData.device" style="flex:1;" />
  7. <tiring :resultData="leftData.TerminalOffline" style="flex: 1;" />
  8. </div>
  9. </template>
  10. <template #content>
  11. <p>广播</p>
  12. </template>
  13. <template #right>
  14. <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
  15. <running :resultData="leftData" style="flex: 1;" />
  16. <sameDay :resultData="leftData.PlaybackControls" style="flex: 1;" />
  17. <eventList :resultData="leftData.TerminalLog" style="flex: 1;" />
  18. </div>
  19. </template>
  20. </layout>
  21. </div>
  22. </template>
  23. <script setup name="Role">
  24. import { getBroadcast } from "@/api/system/broadcast"
  25. import layout from "@/components/layout_/index.vue";
  26. import running from './modules/running.vue'
  27. import deviceList from './modules/deviceList.vue'
  28. import sameDay from './modules/sameDay.vue'
  29. import eventList from './modules/eventList.vue'
  30. import tiring from './modules/tiring.vue'
  31. const intervalId = ref(null)
  32. const leftData = ref({})
  33. // 生命周期
  34. onMounted(() => {
  35. intervalId.value = setInterval(getBroadcastData, 10000);
  36. getBroadcastData()
  37. });
  38. onUnmounted(() => {
  39. clearInterval(intervalId.value);
  40. })
  41. function getBroadcastData() {
  42. getBroadcast().then((res) => {
  43. if (res.code == 200) {
  44. leftData.value = res.data
  45. }
  46. })
  47. }
  48. </script>
  49. <style lang="scss">
  50. ._energy {
  51. height: 100%;
  52. }
  53. </style>