multiScreen.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div class="wrap" style="padding: 30px 0px">
  3. <el-row :gutter="20" style="background:#fff;padding-top:10px;">
  4. <el-col :span="8">
  5. <div class="top-operate-box">{{cameraName1}} <p class="lishihuifang" v-show="url1 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName1+'('+code1+')',streamId:streamId1,deviceAddress:deviceAddress1}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(1)">更换</span> <span @click="delHand(1)">删除</span></p></div>
  6. <div class="video-box">
  7. <el-icon class="el-icon-plus" @click="editHand(1)"><Plus /></el-icon>
  8. <video-play :url="url1" v-show="url1 !== ''" ref="child1"></video-play>
  9. </div>
  10. </el-col>
  11. <el-col :span="8">
  12. <div class="top-operate-box">{{cameraName2}} <p class="lishihuifang" v-show="url2 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName2+'('+code2+')',streamId:streamId2,deviceAddress:deviceAddress2}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(2)">更换</span> <span @click="delHand(2)">删除</span></p></div>
  13. <div class="video-box">
  14. <el-icon class="el-icon-plus" @click="editHand(2)"><Plus /></el-icon>
  15. <video-play2 :url="url2" v-show="url2 !== ''" ref="child2"></video-play2>
  16. </div>
  17. </el-col>
  18. <el-col :span="8">
  19. <div class="top-operate-box">{{cameraName3}} <p class="lishihuifang" v-show="url3 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName3+'('+code3+')',streamId:streamId3,deviceAddress:deviceAddress3}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(3)">更换</span> <span @click="delHand(3)">删除</span></p></div>
  20. <div class="video-box">
  21. <el-icon class="el-icon-plus" @click="editHand(3)"><Plus /></el-icon>
  22. <video-play3 :url="url3" v-show="url3 !== ''" ref="child3"></video-play3>
  23. </div>
  24. </el-col>
  25. </el-row>
  26. <el-row :gutter="20" style="margin-top:20px;">
  27. <el-col :span="8">
  28. <div class="top-operate-box">{{cameraName4}} <p class="lishihuifang" v-show="url4 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName4+'('+code4+')',streamId:streamId4,deviceAddress:deviceAddress4}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(4)">更换</span> <span @click="delHand(4)">删除</span></p></div>
  29. <div class="video-box">
  30. <el-icon class="el-icon-plus" @click="editHand(4)"><Plus /></el-icon>
  31. <video-play4 :url="url4" v-show="url4 !== ''" ref="child4"></video-play4>
  32. </div>
  33. </el-col>
  34. <el-col :span="8">
  35. <div class="top-operate-box">{{cameraName5}} <p class="lishihuifang" v-show="url5 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName5+'('+code5+')',streamId:streamId5,deviceAddress:deviceAddress5}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(5)">更换</span> <span @click="delHand(5)">删除</span></p></div>
  36. <div class="video-box">
  37. <el-icon class="el-icon-plus" @click="editHand(5)"><Plus /></el-icon>
  38. <video-play5 :url="url5" v-show="url5 !== ''" ref="child5"></video-play5>
  39. </div>
  40. </el-col>
  41. <el-col :span="8">
  42. <div class="top-operate-box">{{cameraName6}} <p class="lishihuifang" v-show="url6 !== ''"><router-link :to="{name:'playback',query:{cameraName:cameraName6+'('+code6+')',streamId:streamId6,deviceAddress:deviceAddress6}}" style="color: rgb(40, 198, 217);"><img src="/img/map/lishi-icon.png" />录像回放</router-link> <span @click="editHand(6)">更换</span> <span @click="delHand(6)">删除</span></p></div>
  43. <div class="video-box">
  44. <el-icon class="el-icon-plus" @click="editHand(6)"><Plus /></el-icon>
  45. <video-play6 :url="url6" v-show="url6 !== ''" ref="child6"></video-play6>
  46. </div>
  47. </el-col>
  48. </el-row>
  49. <el-dialog
  50. title="选择监控设备" left :close-on-click-modal="false"
  51. v-model="dialogSelMonitor"
  52. width="600px" :modal="false">
  53. <el-tree highlight-current :data="cameraList" :props="defaultProps" @node-click="cameranodeClick"></el-tree>
  54. <el-button type="primary" style="margin:10px auto 0;display:block;" @click="addChangeVideo">添加</el-button>
  55. </el-dialog>
  56. </div>
  57. </template>
  58. <script setup>
  59. import {GetDevicesCameras, GetmultiscreenList,multiscreenSubmit} from "@/api/multiScreen";
  60. import {ref,onMounted} from 'vue';
  61. import videoPlay from './videoplay.vue'
  62. import videoPlay2 from './videoplay2.vue'
  63. import videoPlay3 from './videoplay3.vue'
  64. import videoPlay4 from './videoplay4.vue'
  65. import videoPlay5 from './videoplay5.vue'
  66. import videoPlay6 from './videoplay6.vue'
  67. import {Plus} from "@element-plus/icons-vue";
  68. import {ElMessage, ElMessageBox} from "element-plus";
  69. const url1 = ref("")
  70. const url2 = ref("")
  71. const url3 = ref("")
  72. const url4 = ref("")
  73. const url5 = ref("")
  74. const url6 = ref("")
  75. const cameraName1 = ref("")
  76. const cameraName2 = ref("")
  77. const cameraName3 = ref("")
  78. const cameraName4 = ref("")
  79. const cameraName5 = ref("")
  80. const cameraName6 = ref("")
  81. const code1 =ref("")
  82. const code2 =ref("")
  83. const code3 =ref("")
  84. const code4 =ref("")
  85. const code5 =ref("")
  86. const code6 =ref("")
  87. const streamId1 = ref("")
  88. const streamId2 = ref("")
  89. const streamId3 = ref("")
  90. const streamId4 = ref("")
  91. const streamId5 = ref("")
  92. const streamId6 = ref("")
  93. const deviceAddress1 = ref("")
  94. const deviceAddress2 = ref("")
  95. const deviceAddress3 = ref("")
  96. const deviceAddress4 = ref("")
  97. const deviceAddress5 = ref("")
  98. const deviceAddress6 = ref("")
  99. const current = ref(0)
  100. const cameraId = ref(0)
  101. const dialogSelMonitor = ref(false)
  102. const cameraList = ref([])
  103. const defaultProps = ref({
  104. children: 'cameraList',
  105. label: 'poleGroupName'
  106. })
  107. onMounted(()=>{
  108. multiscreenListFun()
  109. getCameraLiveList()
  110. })
  111. const editHand = (val)=> {
  112. current.value = val
  113. dialogSelMonitor.value = true
  114. }
  115. const cameranodeClick = (val)=>{
  116. if (!val.cameraList && val.cameraList !== null){
  117. cameraId.value = val.id
  118. }
  119. }
  120. const addChangeVideo = async () => {
  121. const res = await multiscreenSubmit(current.value, cameraId.value);
  122. if (res.code === 0) {
  123. dialogSelMonitor.value = false
  124. ElMessage({ type: 'success', message: '操作成功' })
  125. multiscreenListFun()
  126. }
  127. }
  128. const child1 = ref()
  129. const child2 = ref()
  130. const child3 = ref()
  131. const child4 = ref()
  132. const child5 = ref()
  133. const child6 = ref()
  134. const delHand =(val)=> {
  135. ElMessageBox.confirm('您确定要删除该摄像头吗?', '提示', {
  136. confirmButtonText: '确定',
  137. cancelButtonText: '取消',
  138. type: 'warning',
  139. })
  140. .then(async() => {
  141. if (val===1){
  142. url1.value = ""
  143. child1.value.endde()
  144. }else if(val===2){
  145. url2.value = ""
  146. child2.value.endde()
  147. }else if(val===3){
  148. url3.value = ""
  149. child3.value.endde()
  150. }else if(val===4){
  151. url4.value = ""
  152. child4.value.endde()
  153. }else if(val===5){
  154. url5.value = ""
  155. child5.value.endde()
  156. }else{
  157. url6.value = ""
  158. child6.value.endde()
  159. }
  160. const res = await multiscreenSubmit(val,-1)
  161. if (res.code === 0) {
  162. ElMessage({
  163. type: 'success',
  164. message: '删除成功!',
  165. })
  166. multiscreenListFun()
  167. }
  168. })
  169. .catch(() => {
  170. ElMessage({
  171. type: 'info',
  172. message: '已取消删除',
  173. })
  174. })
  175. }
  176. const props = ref(['url','cameraName','code','streamId','deviceAddress'])
  177. const multiscreenListFun = async () => {
  178. const res = await GetmultiscreenList()
  179. if (res.code === 0) {
  180. url1.value = res.data.list[0].url;
  181. url2.value = res.data.list[1].url;
  182. url3.value = res.data.list[2].url;
  183. url4.value = res.data.list[3].url;
  184. url5.value = res.data.list[4].url;
  185. url6.value = res.data.list[5].url;
  186. cameraName1.value = res.data.list[0].name;
  187. cameraName2.value = res.data.list[1].name;
  188. cameraName3.value = res.data.list[2].name;
  189. cameraName4.value = res.data.list[3].name;
  190. cameraName5.value = res.data.list[4].name;
  191. cameraName6.value = res.data.list[5].name;
  192. code1.value = res.data.list[0].code;
  193. code2.value = res.data.list[1].code;
  194. code3.value = res.data.list[2].code;
  195. code4.value = res.data.list[3].code;
  196. code5.value = res.data.list[4].code;
  197. code6.value = res.data.list[5].code;
  198. streamId1.value = res.data.list[0].streamId;
  199. streamId2.value = res.data.list[1].streamId;
  200. streamId3.value = res.data.list[2].streamId;
  201. streamId4.value = res.data.list[3].streamId;
  202. streamId5.value = res.data.list[4].streamId;
  203. streamId6.value = res.data.list[5].streamId;
  204. deviceAddress1.value = res.data.list[0].deviceAddress;
  205. deviceAddress2.value = res.data.list[1].deviceAddress;
  206. deviceAddress3.value = res.data.list[2].deviceAddress;
  207. deviceAddress4.value = res.data.list[3].deviceAddress;
  208. deviceAddress5.value = res.data.list[4].deviceAddress;
  209. deviceAddress6.value = res.data.list[5].deviceAddress;
  210. }
  211. }
  212. const getCameraLiveList =async () => {
  213. const res = await GetDevicesCameras()
  214. cameraList.value = res.data
  215. }
  216. </script>
  217. <style scoped>
  218. .wrap{background:#fff;}
  219. .icon-tuichuquanping{
  220. position:absolute;
  221. top:5px;
  222. right:6px;
  223. cursor:pointer;
  224. }
  225. .video-box{
  226. /* border:1px solid #ced7ea; */
  227. border-radius:4px;
  228. width:100%;
  229. height:56.2%;
  230. min-height:282px;
  231. position:relative;
  232. background: #fff;
  233. }
  234. .video-box .el-icon-plus{
  235. font-size:100px;
  236. color:#d8d8d8;
  237. position:absolute;
  238. left:50%;
  239. top:50%;
  240. transform:translate(-50%,-50%);
  241. cursor:pointer;
  242. }
  243. .lishihuifang{
  244. position:absolute;
  245. top:0;
  246. right:0;
  247. color: rgb(40, 198, 217);
  248. width:187px;
  249. margin:0;
  250. padding:0;
  251. font-size:14px;
  252. }
  253. .lishihuifang img{
  254. vertical-align: middle;
  255. margin-right:4px;
  256. position:relative;
  257. top:-2px;
  258. }
  259. .lishihuifang span{
  260. margin-left:20px;
  261. cursor:pointer;
  262. }
  263. .top-operate-box{
  264. position:relative;width:100%;margin-bottom:10px;
  265. height:20px;
  266. }
  267. </style>