CameraInfo.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="camera-info">
  3. <span class="info-tit">相机视频流</span>
  4. <div>
  5. <el-tree-select
  6. v-model="selectedCamera"
  7. :data="props.data"
  8. :render-after-expand="false"
  9. :props="treeProp"
  10. node-key="code"
  11. :default-expand-all="true"
  12. @current-change="onCurrentChange"
  13. />
  14. </div>
  15. <div class="video-block">
  16. <LiveVideo :url="`http://10.94.4.184:8090/live/JJ-GH-test0.flv`" />
  17. </div>
  18. <div class="flex" style="width: 100%">
  19. <span class="algo-text">相关算法:</span>
  20. <div class="tag-list">
  21. <el-tag v-for="item in algoList" class="algo-name" :key="item.id">
  22. {{ item.algoInfo.name }}
  23. </el-tag>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup lang="ts">
  29. import { nextTick, ref } from 'vue';
  30. import LiveVideo from '@/components/LiveVideo/LiveVideo.vue';
  31. import { CompanyInfoItem, AlgoConfig } from '@/api/home/home.ts';
  32. const props = defineProps<{
  33. data: CompanyInfoItem[];
  34. getAlgoes: (cameraId: number) => Promise<AlgoConfig[]>;
  35. }>();
  36. const treeProp = {
  37. label: 'name',
  38. disabled: (_, node) => node?.data && node.data.nodeType !== 'camera',
  39. };
  40. const selectedCamera = ref('');
  41. const algoList = ref<AlgoConfig[]>([]);
  42. const onCurrentChange = (_, node) => {
  43. nextTick(() => {
  44. if (node?.data && node.data.code === selectedCamera.value) {
  45. props.getAlgoes(node.data.id).then((res) => {
  46. algoList.value = res;
  47. });
  48. }
  49. });
  50. };
  51. </script>
  52. <style scoped>
  53. .camera-info {
  54. padding: 12px 30px;
  55. display: flex;
  56. flex-direction: column;
  57. align-items: flex-start;
  58. }
  59. .info-tit {
  60. font-size: 16px;
  61. font-weight: 500;
  62. color: #2e2e2e;
  63. line-height: 44px;
  64. margin-bottom: 10px;
  65. }
  66. .video-block {
  67. /* width: 889px;
  68. height: 500px; */
  69. min-width: 444.5;
  70. width: 100%;
  71. margin-top: 16px;
  72. margin-bottom: 28px;
  73. aspect-ratio: 1920/1080;
  74. }
  75. .algo-text {
  76. font-size: 14px;
  77. font-weight: 400;
  78. color: #2e2e2e;
  79. line-height: 20px;
  80. }
  81. .tag-list {
  82. max-width: 60%;
  83. display: flex;
  84. margin-left: 16px;
  85. flex-wrap: wrap;
  86. justify-content: flex-start;
  87. }
  88. .algo-name {
  89. margin-right: 12px;
  90. margin-bottom: 12px;
  91. }
  92. </style>