index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="camera-container">
  3. <div class="left-area">
  4. <cameraTree :selected="selected" :list="listArr" :draggable="true" @detail-node="onDetail" @on-click="onClick">
  5. <template #icon="{ item }">
  6. <template v-if="item.isFolder">
  7. <SvgIcon v-if="item.expanded" size="18" name="file-open" />
  8. <SvgIcon v-else size="18" name="file-close" />
  9. </template>
  10. <treeIcon class="iconfont" :title="item.title" v-else />
  11. </template>
  12. <template #operation="{ type }">
  13. <!-- <i class="iconfont icon-eyeoutlined"></i> -->
  14. <span style="color: #ccc; font-size: 12px">详情</span>
  15. </template>
  16. </cameraTree>
  17. </div>
  18. <div class="right-area">
  19. <div v-if="renderPlayer" ref="playerRef" style="display: flex; width: 100%; height: 100%; overflow-y: auto; pointer-events: none"> </div>
  20. <div class="camera-box" v-else>
  21. <Empty />
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { onMounted, onUnmounted, ref, reactive, computed, onBeforeUnmount } from 'vue';
  28. import { useRouter } from 'vue-router';
  29. import { list, cameraAddr, getCameraDevKind, getDevice, getVentanalyCamera } from './camera.api';
  30. import cameraTree from './common/cameraTree.vue';
  31. import { SvgIcon } from '/@/components/Icon';
  32. import treeIcon from './common/Icon/treeIcon.vue';
  33. import { useCamera } from '/@/hooks/system/useCamera';
  34. const { getCamera, removeCamera } = useCamera();
  35. const playerRef = ref();
  36. const renderPlayer = ref(true);
  37. //当前选中树节点
  38. let selected = reactive<any>({
  39. id: null,
  40. pid: null,
  41. title: '',
  42. isFolder: false,
  43. });
  44. //tree菜单列表
  45. let listArr = reactive<any[]>([]);
  46. let searchParam = reactive({
  47. devKind: '',
  48. strType: '',
  49. });
  50. let router = useRouter(); //路由
  51. async function getCameraDevKindList() {
  52. let res = await getCameraDevKind();
  53. if (res.length != 0) {
  54. listArr.length = 0;
  55. listArr.push({
  56. pid: 'root',
  57. isFolder: true,
  58. expanded: true,
  59. title: '全部',
  60. id: 0,
  61. children: [],
  62. });
  63. res.forEach((el) => {
  64. el.pid = 0;
  65. el.isFolder = true;
  66. el.expanded = false;
  67. el.title = el.itemText;
  68. el.id = el.subDictId;
  69. el.children = [];
  70. listArr[0].children.push(el);
  71. });
  72. selected.id = listArr[0].id;
  73. selected.pid = listArr[0].pid;
  74. selected.title = listArr[0].title;
  75. selected.isFolder = listArr[0].isFolder;
  76. }
  77. }
  78. //点击目录
  79. async function onClick(node) {
  80. if (selected.title === node.title && selected.id === node.id) return;
  81. selected.id = node.id;
  82. selected.pid = node.pid;
  83. selected.title = node.title;
  84. selected.isFolder = node.isFolder;
  85. if (node.pid != 'root') {
  86. if (node.isFolder) {
  87. let types, devicetype;
  88. if (node.itemValue.indexOf('&') != -1) {
  89. types = node.itemValue.substring(node.itemValue.indexOf('&') + 1);
  90. devicetype = node.itemValue.substring(0, node.itemValue.indexOf('&'));
  91. } else {
  92. types = '';
  93. devicetype = '';
  94. }
  95. let res = await getDevice({ ids: types, devicetype: devicetype });
  96. if (res.msgTxt.length != 0) {
  97. res.msgTxt[0].datalist.forEach((el) => {
  98. el.pid = node.id;
  99. el.isFolder = false;
  100. el.title = el.strinstallpos;
  101. el.id = el.deviceID;
  102. });
  103. listArr[0].children.forEach((v) => {
  104. if (v.id == node.id) {
  105. v.children = res.msgTxt[0].datalist;
  106. }
  107. });
  108. }
  109. searchParam.devKind = node.itemValue;
  110. searchParam.strType = '';
  111. let paramKind = searchParam.devKind.substring(0, searchParam.devKind.indexOf('&'));
  112. await getCamera('', playerRef, renderPlayer, paramKind);
  113. } else {
  114. await getCamera(node.deviceID, playerRef, renderPlayer);
  115. }
  116. } else {
  117. searchParam.devKind = '';
  118. searchParam.strType = '';
  119. await getCamera('', playerRef, renderPlayer);
  120. }
  121. }
  122. //点击详情跳转
  123. function onDetail(node) {
  124. let str = listArr[0].children.filter((v) => v.id == node.pid)[0].itemValue;
  125. let type = str.indexOf('&') != -1 ? str.substring(0, str.indexOf('&')) : '';
  126. console.log(type, 'type--------');
  127. switch (type) {
  128. case 'pulping': //注浆
  129. router.push('/grout-home');
  130. break;
  131. case 'window': //自动风窗
  132. router.push('/monitorChannel/monitor-window?id=' + node.deviceID);
  133. break;
  134. case 'gate': //自动风门
  135. router.push('/monitorChannel/monitor-gate?id=' + node.deviceID + '&deviceType=' + node.deviceType);
  136. break;
  137. case 'fanlocal': //局部风机
  138. router.push('/monitorChannel/monitor-fanlocal?id=' + node.deviceID + '&deviceType=fanlocal');
  139. break;
  140. case 'fanmain': //主风机
  141. router.push('/monitorChannel/monitor-fanmain?id=' + node.deviceID);
  142. break;
  143. case 'forcFan': //压风机
  144. router.push('/forcFan/home');
  145. break;
  146. case 'pump': //瓦斯抽采泵
  147. router.push('/monitorChannel/gasPump-home');
  148. break;
  149. case 'nitrogen': //制氮
  150. router.push('/nitrogen-home');
  151. break;
  152. }
  153. }
  154. onMounted(async () => {
  155. await getCameraDevKindList();
  156. await getCamera('', playerRef, renderPlayer);
  157. });
  158. onBeforeUnmount(() => {
  159. removeCamera(playerRef);
  160. });
  161. </script>
  162. <style lang="less" scoped>
  163. @import '/@/design/theme.less';
  164. @{theme-deepblue} {
  165. .camera-container {
  166. --image-camera_bg: url('/@/assets/images/themify/deepblue/vent/camera_bg.png');
  167. }
  168. }
  169. .camera-container {
  170. --image-camera_bg: url('/@/assets/images/vent/camera_bg.png');
  171. position: relative;
  172. width: calc(100% - 30px);
  173. height: calc(100% - 84px);
  174. display: flex;
  175. margin: 15px;
  176. justify-content: space-between;
  177. align-items: center;
  178. .left-area {
  179. width: 15%;
  180. height: 100%;
  181. padding: 20px;
  182. border: 1px solid #99e8ff66;
  183. background: #27546e1a;
  184. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  185. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  186. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  187. box-sizing: border-box;
  188. // lxh
  189. .iconfont {
  190. color: #fff;
  191. font-size: 12px;
  192. margin-left: 5px;
  193. }
  194. }
  195. .right-area {
  196. width: 85%;
  197. height: 100%;
  198. padding: 0px 0px 0px 15px;
  199. box-sizing: border-box;
  200. }
  201. }
  202. :deep(#LivePlayerBox) {
  203. display: flex;
  204. flex-direction: row;
  205. justify-content: flex-start;
  206. flex-wrap: wrap;
  207. pointer-events: none;
  208. .liveVideo {
  209. width: 510px !important;
  210. height: 320px !important;
  211. align-self: auto !important;
  212. margin: 10px 8px !important;
  213. background-size: 100% 100% !important;
  214. padding: 15px !important;
  215. }
  216. // .video-parent {
  217. // pointer-events: auto !important;
  218. // align-self: auto !important;
  219. // }
  220. }
  221. </style>