index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="page_container">
  3. <base-title title="激光云台" />
  4. <div class="page_content">
  5. <!-- 上半部分 -->
  6. <div class="video_window window1">
  7. <video-window :windowData="topData" />
  8. </div>
  9. <!-- 下半部分 -->
  10. <div class="video_window window2" v-if="bottomData.length">
  11. <video-window :windowData="bottomData" />
  12. </div>
  13. <!-- <video-image-window :cameraData="videoData" :cameraId="videoData.id" /> -->
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import { divide } from "lodash-es";
  19. import BaseTitle from "../BaseTitle.vue";
  20. import VideoWindow from "./videoWindow.vue";
  21. import { mapGetters } from "vuex";
  22. export default {
  23. name: "IntelligentVideo",
  24. components: { BaseTitle, VideoWindow },
  25. data() {
  26. return {
  27. videoData: {
  28. id: "593102253968072704",
  29. name: "吴圩站",
  30. type: "wxz",
  31. ptzEnable: true,
  32. tags: { ndTag: "ND", gqTag: "GQ" },
  33. },
  34. curStation: {},
  35. stationList: [
  36. //初始化泄漏报警骨架
  37. {
  38. id: "1",
  39. name: "贵阳作业区",
  40. children: [
  41. {
  42. id: "101",
  43. name: "贵阳站",
  44. children: [
  45. {
  46. id: "1",
  47. name: "云台1",
  48. ndTag: "ND",
  49. },
  50. {
  51. id: "2",
  52. name: "云台2",
  53. ndTag: "ND",
  54. },
  55. {
  56. id: "3",
  57. name: "云台3",
  58. ndTag: "ND",
  59. },
  60. ],
  61. },
  62. {
  63. id: "102",
  64. name: "白云站",
  65. children: [
  66. {
  67. id: "4",
  68. name: "云台1",
  69. ndTag: "ND",
  70. },
  71. ],
  72. },
  73. ],
  74. },
  75. {
  76. id: "2",
  77. name: "都匀作业区",
  78. children: [
  79. {
  80. id: "201",
  81. name: "都匀站",
  82. children: [
  83. {
  84. id: "20101",
  85. name: "云台1",
  86. },
  87. ],
  88. },
  89. {
  90. id: "202",
  91. name: "独山首站",
  92. children: [
  93. {
  94. id: "20201",
  95. name: "云台1",
  96. },
  97. {
  98. id: "20202",
  99. name: "云台2",
  100. },
  101. ],
  102. },
  103. {
  104. id: "203",
  105. name: "凯口站",
  106. children: [
  107. {
  108. id: "20301",
  109. name: "云台1",
  110. },
  111. ],
  112. },
  113. {
  114. id: "204",
  115. name: "云雾首站",
  116. children: [
  117. {
  118. id: "20401",
  119. name: "云台1",
  120. },
  121. ],
  122. },
  123. ],
  124. },
  125. ],
  126. list: [],
  127. dId: "",
  128. };
  129. },
  130. computed: {
  131. ...mapGetters(["departmentId"]),
  132. topData() {
  133. let arr = [];
  134. let leng = this.curStation?.children?.length || 0;
  135. if (leng === 0) {
  136. arr = [];
  137. }
  138. // 一个的时候只显示上半部分,下半隐藏
  139. // 两个的时候,上下都显示
  140. else if (leng <= 2) {
  141. arr = [this.curStation.children[0]];
  142. }
  143. // 大于2个的时候,上面左右结构,下面显示其余
  144. else {
  145. arr = [this.curStation.children[0], this.curStation.children[1]];
  146. }
  147. return arr;
  148. },
  149. bottomData() {
  150. let arr = [];
  151. let leng = this.curStation?.children?.length || 0;
  152. if (leng <= 1) {
  153. // 一个的时候只显示上半部分,下半隐藏
  154. arr = [];
  155. }
  156. // 两个的时候,上下各显示一个
  157. else if (leng == 2) {
  158. arr = [this.curStation.children[1]];
  159. }
  160. // 大于两个,上面显示两个,下面显示其余
  161. else {
  162. arr = this.curStation.children.slice(2);
  163. }
  164. return arr;
  165. },
  166. },
  167. created() {
  168. this.init();
  169. },
  170. watch: {
  171. departmentId(newVal) {
  172. // console.log("部门id信息", newVal, this.list);
  173. this.dId = newVal;
  174. if (this.dId === "") {
  175. this.init();
  176. } else {
  177. setTimeout(() => {
  178. for (let i = 0; i < this.list[0].children.length; i++) {
  179. const e = this.list[0].children[i];
  180. if (e.departmentId === this.dId) {
  181. this.stationList[0].children = [this.list[0].children[i]];
  182. }
  183. }
  184. this.curStation = this.getCurStation("1");
  185. }, 200);
  186. }
  187. // console.log("场站云台列表", this.stationList);
  188. },
  189. },
  190. methods: {
  191. init() {
  192. this.list = GY_JGYT_CONFIG;
  193. if (this.list.length > 0) {
  194. this.stationList = [
  195. {
  196. id: this.list[0].id,
  197. name: this.list[0].name,
  198. children: [this.list[0].children[0]],
  199. },
  200. ];
  201. }
  202. this.curStation = this.getCurStation("1");
  203. // console.log("curStation", this.curStation);
  204. },
  205. getCurStation(id) {
  206. let obj = {};
  207. const find = (arr) => {
  208. arr.forEach((item) => {
  209. if (item.id === id) {
  210. obj.id = item.id;
  211. obj.name = item.name;
  212. obj.type = item.type;
  213. obj.ptzEnable = item.ptzEnable;
  214. obj.tags = item.tags;
  215. obj.children = item.children;
  216. } else if (item.children && item.children.length) {
  217. find(item.children);
  218. }
  219. });
  220. };
  221. find(this.stationList);
  222. return obj;
  223. },
  224. },
  225. };
  226. </script>
  227. <style lang="less" scoped>
  228. .page_container {
  229. width: 400px;
  230. z-index: 2;
  231. .page_content {
  232. width: 100%;
  233. .video_window {
  234. width: 100%;
  235. height: 268px;
  236. margin-top: 10px;
  237. }
  238. }
  239. }
  240. </style>