monitor.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. <!--监控中心-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar" :class="indentleft" ref="left">
  10. <div class="forthis">
  11. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  12. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  13. <div class="this-title">
  14. <span>事态感知</span>
  15. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  16. </div>
  17. <div class="i-list-con h-73">
  18. <div class="d-l-con-icon">
  19. <div class="icon-con w-33 m-btm-no" :class="{on:iconCurrentIndex1==index}"
  20. v-for="(item,index) in visuForestCloudMapDeviceBOList"
  21. v-on:click="selectDeviceType(index)">
  22. <!-- -->
  23. <div class="icon icon-dot"></div>
  24. <div class="icon-text">
  25. <h6>{{ item.deviceCount }}</h6>
  26. <h5>{{ item.deviceName }}</h5>
  27. </div>
  28. </div>
  29. <div class="icon-con w-33 m-btm-no">
  30. <div class="icon icon-dot"></div>
  31. <div class="icon-text">
  32. <h6>0</h6>
  33. <h5>传感器</h5>
  34. </div>
  35. </div>
  36. <div class="icon-con w-33 m-btm-no">
  37. <div class="icon icon-dot"></div>
  38. <div class="icon-text">
  39. <h6>0</h6>
  40. <h5>大喇叭</h5>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- <div class="overflow-y" style="height: 33vh;">-->
  45. <!-- <el-collapse accordion>-->
  46. <!-- <el-collapse-item v-for="(item,index) in region" :key="index">-->
  47. <!-- &lt;!&ndash; deptId &ndash;&gt;-->
  48. <!-- <template slot="title">-->
  49. <!-- <div class="d-l-con sj-collapse" :class="{on:listCurrentIndex1==item.deptId}"-->
  50. <!-- v-on:click="selectCameraByDeptId(item.deptId)">-->
  51. <!-- <div class="d-l-l-text">-->
  52. <!-- <h4 class="collapse-title">{{ item.deptName }}</h4>-->
  53. <!-- </div>-->
  54. <!-- <div class="d-l-l-count">{{ item.deptCount }}</div>-->
  55. <!-- </div>-->
  56. <!-- </template>-->
  57. <!-- </el-collapse-item>-->
  58. <!-- </el-collapse>-->
  59. <!-- </div>-->
  60. <!-- &lt;!&ndash; 横向柱状 echart &ndash;&gt;-->
  61. <!-- <div class="overflow-y" style="height: 33vh;">-->
  62. <!-- <div id="camera-chart" style="width: 100%;height:33vh;"></div>-->
  63. <!-- </div>-->
  64. <div class="overflow-y" style="height: 70vh;">
  65. <div class="i-list-con h-65">
  66. <div class="head-container">
  67. <el-input
  68. v-model="deptName"
  69. placeholder="请输入部门名称"
  70. clearable
  71. size="small"
  72. prefix-icon="el-icon-search"
  73. style="margin-bottom: 20px"
  74. />
  75. </div>
  76. <div class="head-container tree-scrollbar" style="height: 700px;overflow-y:auto;">
  77. <el-tree
  78. :data="deptOptions"
  79. :props="defaultProps"
  80. :expand-on-click-node="false"
  81. :filter-node-method="filterNode"
  82. ref="tree"
  83. node-key="id"
  84. :default-expanded-keys="[100]"
  85. @node-click="handleNodeClick"
  86. />
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </dv-border-box-13>
  92. </div>
  93. </div>
  94. <!-- 地图 -->
  95. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"
  96. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false" @preview="preview">
  97. </supermap>
  98. <!-- 右侧 -->
  99. <div class="rightbar" :class="indentright" ref="right">
  100. <div class="forthis">
  101. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  102. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  103. <div class="this-title">
  104. <span>列表</span>
  105. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  106. </div>
  107. <div class="i-list-con h-43">
  108. <el-input
  109. v-model="rightDeptName"
  110. placeholder="请输入摄像头名称"
  111. clearable
  112. size="small"
  113. prefix-icon="el-icon-search"
  114. style="margin-bottom: 20px"
  115. />
  116. <div class="d-l-con" v-for="(item,index) in visuForestCloudCameraBOListSearch"
  117. :class="{on:listCurrentIndex2 == index}"
  118. v-on:click="dropLocation(item.latitude,item.longitude,index)">
  119. <div class="d-l-l-text">
  120. <i class="iconfont sj-icon-jkzx icon-sxt"></i>
  121. <h4>{{ item.cameraName }}</h4>
  122. </div>
  123. </div>
  124. </div>
  125. </dv-border-box-13>
  126. </div>
  127. <div class="forthis">
  128. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  129. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  130. <div class="this-title">
  131. <span>重点区域</span>
  132. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  133. </div>
  134. <div class="i-list-con h-25">
  135. <div class="d-l-con" v-for="(item,index) in keyAreaList" :class="{on:listCurrentIndex3 == index}" @click="getRegionalFlag(item.id)">
  136. <div class="d-l-l-text">
  137. <i class="i-small"></i>
  138. <h4>{{ item.areaName }}</h4>
  139. </div>
  140. </div>
  141. </div>
  142. </dv-border-box-13>
  143. </div>
  144. </div>
  145. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  146. <!-- <el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">-->
  147. <!-- <div class="mascot" ref="mascot" :class="indentStyle" @click="indent"><img-->
  148. <!-- src="@/assets/images/mascot.png"/></div>-->
  149. <!-- </el-tooltip>-->
  150. </div>
  151. <eventLocation ref="eventLocation"></eventLocation>
  152. <TVWall ref="TVWall"></TVWall>
  153. <TVWalls ref="TVWalls"></TVWalls>
  154. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  155. @close="cancelEventLocationShow()">
  156. <div style="width:1020px;height:625px;position:relative;">
  157. <!--视频窗口展示---海康-->
  158. <div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>
  159. </div>
  160. </el-dialog>
  161. </div>
  162. </template>
  163. <script>
  164. import {
  165. selectDeviceType,
  166. selectCameraByDeptId,
  167. selectKeyAreaList,
  168. getCamerasByDeptId,
  169. getRegionalFlag
  170. } from '@/api/monitor'
  171. import { treeselect } from '@/api/system/dept'
  172. import supermap from '@/components/supermap' //超图
  173. import vheader from '@/components/v-header.vue' //一体化共用头部
  174. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  175. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  176. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  177. import TVWalls from '@/components/TVWalls.vue' //电视墙弹窗
  178. /** ----------------------------------摄像头预览开始------------------------------------- */
  179. import {
  180. getDahuaVideoServer
  181. } from '@/api/dahua/dahua'
  182. import {
  183. getHaiKangVideoServer
  184. } from '@/api/haikang/haikang'
  185. import DHWs from '@/dahua/lib/DHWs'
  186. /** ----------------------------------摄像头预览结束------------------------------------- */
  187. // import echarts from 'echarts'
  188. let echarts = require('echarts')
  189. export default {
  190. components: {
  191. supermap,
  192. vheader,
  193. vBottomMenu,
  194. eventLocation,
  195. TVWalls,
  196. TVWall
  197. },
  198. created() {
  199. /** ----------------------------------摄像头预览开始------------------------------------- */
  200. const DHWsInstance = DHWs.getInstance()
  201. this.ws = DHWsInstance
  202. /** ----------------------------------摄像头预览结束------------------------------------- */
  203. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  204. window.showDialog = this.showDialog
  205. window.choseLayerSwitching = this.choseLayerSwitching
  206. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  207. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  208. },
  209. mounted() {
  210. this.selectDeviceType(-1)
  211. this.selectKeyAreaList()
  212. this.getTreeselect()
  213. this.bottomMenuList() //获取底部公共组件消息和任务
  214. },
  215. data() {
  216. return {
  217. // 部门名称
  218. deptName: undefined,
  219. // 部门树选项
  220. deptOptions: undefined,
  221. defaultProps: {
  222. children: 'children',
  223. label: 'label'
  224. },
  225. iconCurrentIndex1: '-1',
  226. listCurrentIndex1: '-1',
  227. listCurrentIndex2: '-1',
  228. listCurrentIndex3: '-1',
  229. graphicsList:[],//重点区域
  230. /** ----------------------------------摄像头预览开始------------------------------------- */
  231. //大华
  232. activePanel: 'key1',
  233. isLogin: false,
  234. cameraParams: [],
  235. ws: null,
  236. //海康
  237. cameraTitle: '',
  238. cameraVisible: false,
  239. initCount: 0,
  240. pubKey: '',
  241. oWebControl: null,
  242. /** ----------------------------------摄像头预览结束------------------------------------- */
  243. visuForestCloudMapDeviceBOList: [],
  244. visuForestCloudCameraBOList: [],
  245. cameraMarkersList: [],
  246. sourceData: [],
  247. keyAreaList: [],//重点区域
  248. iframeBoo: true,
  249. open: false,
  250. iframeVue: null,
  251. activeName: 'info',
  252. radio: '1',
  253. region: [],
  254. rightDeptName: undefined,
  255. visuForestCloudCameraBOListSearch:[],
  256. //左右缩进
  257. indentStyle: '',
  258. indentleft: '',
  259. indentright: '',
  260. indentText: '收起左右栏',
  261. indentdisabled: false,
  262. domId: 'dom1',
  263. }
  264. },
  265. watch: {
  266. // 根据名称筛选部门树
  267. deptName(val) {
  268. this.$refs.tree.filter(val)
  269. },
  270. rightDeptName(val){
  271. this.visuForestCloudCameraBOListSearch=[];
  272. for (let i in this.visuForestCloudCameraBOList) {
  273. if(this.visuForestCloudCameraBOList[i].cameraName.indexOf(val) != -1){
  274. this.visuForestCloudCameraBOListSearch.push(this.visuForestCloudCameraBOList[i]);
  275. }
  276. }
  277. }
  278. },
  279. methods: {
  280. /** 部门树*/
  281. // 查询部门下拉树结构
  282. getTreeselect() {
  283. treeselect().then(response => {
  284. console.log(response.data)
  285. this.deptOptions = response.data
  286. })
  287. },
  288. // 筛选节点
  289. filterNode(value, data) {
  290. if (!value) return true
  291. return data.label.indexOf(value) !== -1
  292. },
  293. // 节点单击事件
  294. handleNodeClick(data) {
  295. let that = this
  296. console.log("节点单击事件",data);
  297. // this.findCameraByDept(data.id)
  298. that.selectCameraByDeptId(data.id);
  299. getCamerasByDeptId(data.id).then(res => {
  300. that.$refs.TVWalls.showTVWall(res.data, {longitude: data.deptLongitude, latitude: data.deptLatitude});
  301. })
  302. },
  303. selectKeyAreaList() {
  304. this.keyAreaList=[]
  305. //获取重点区域列表
  306. let that = this
  307. selectKeyAreaList().then(res => {
  308. that.keyAreaList = res.data
  309. })
  310. },
  311. getRegionalFlag(id){
  312. //获取重点区域
  313. this.listCurrentIndex3=id
  314. let that = this
  315. getRegionalFlag(id).then(res => {
  316. that.graphicsList=[]
  317. //地图标记
  318. if (res.data != null && res.data.length > 0) {
  319. for (let i = 0; i < res.data.length; i++) {
  320. let latlng = {
  321. lat: res.data[i].lat,
  322. lng: res.data[i].lng
  323. }
  324. that.graphicsList.push(latlng)
  325. }
  326. setTimeout(() => {
  327. that.$refs.supermap.clearG()
  328. that.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  329. }, 1000)
  330. } else {
  331. that.$refs.supermap.clearG()
  332. }
  333. })
  334. },
  335. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  336. bottomMenuList() {
  337. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  338. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  339. },
  340. showDialog(click) {
  341. if (click == 'eventLocation') {
  342. this.$refs.eventLocation.showEventLocation()
  343. this.$refs.supermap.isEditableLayers = false
  344. this.$refs.bottomMenu.showChild = false
  345. this.$refs.bottomMenu.showBanChild = false
  346. this.$refs.bottomMenu.showChangChild = false
  347. } else if (click == 'editableLayers') {
  348. this.$refs.bottomMenu.showChild = false
  349. this.$refs.bottomMenu.showBanChild = false
  350. this.$refs.bottomMenu.showChangChild = false
  351. if (!this.$refs.supermap.isEditableLayers) {
  352. this.$refs.supermap.isEditableLayers = true
  353. } else {
  354. this.$refs.supermap.isEditableLayers = false
  355. }
  356. } else if (click == 'layerSwitching') {
  357. this.$refs.supermap.isEditableLayers = false
  358. this.$refs.bottomMenu.showBanChild = false
  359. this.$refs.bottomMenu.showChangChild = false
  360. if (!this.$refs.bottomMenu.showChild) {
  361. this.$refs.bottomMenu.showChild = true
  362. } else {
  363. this.$refs.bottomMenu.showChild = false
  364. }
  365. } else if (click == 'TVWall') {
  366. this.$refs.TVWall.showTVWall()
  367. this.$refs.supermap.isEditableLayers = false
  368. this.$refs.bottomMenu.showChild = false
  369. this.$refs.bottomMenu.showBanChild = false
  370. this.$refs.bottomMenu.showChangChild = false
  371. } else if (click == 'forestban') {
  372. this.$refs.supermap.isEditableLayers = false
  373. this.$refs.bottomMenu.showChild = false
  374. this.$refs.bottomMenu.showChangChild = false
  375. if (!this.$refs.bottomMenu.showBanChild) {
  376. this.$refs.bottomMenu.showBanChild = true
  377. } else {
  378. this.$refs.bottomMenu.showBanChild = false
  379. }
  380. } else if (click == 'forestchang') {
  381. this.$refs.supermap.isEditableLayers = false
  382. this.$refs.bottomMenu.showBanChild = false
  383. this.$refs.bottomMenu.showChild = false
  384. if (!this.$refs.bottomMenu.showChangChild) {
  385. this.$refs.bottomMenu.showChangChild = true
  386. } else {
  387. this.$refs.bottomMenu.showChangChild = false
  388. }
  389. }
  390. },
  391. //选择图层
  392. choseLayerSwitching(url, isClear) {
  393. this.$refs.supermap.layerSwitching(url, isClear)
  394. },
  395. //选择图层(传递数组)
  396. choseLayerSwitchingList(urlList) {
  397. this.$refs.supermap.layerSwitchingList(urlList)
  398. },
  399. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  400. selectDeviceType(index) {
  401. this.iconCurrentIndex1 = index
  402. //获取左侧动态感知设备
  403. let that = this
  404. selectDeviceType().then(res => {
  405. that.cameraMarkersList=[]
  406. that.visuForestCloudMapDeviceBOList = res.data.visuForestCloudMapDeviceBOList
  407. that.region = res.data.visuForestCloudTodaySjfbBOList
  408. if (res.data.visuForestCloudTodaySjfbBOList != null && res.data.visuForestCloudTodaySjfbBOList
  409. .length > 0) {
  410. for (let i = 0; i < res.data.visuForestCloudTodaySjfbBOList.length; i++) {
  411. let aa = []
  412. aa.push(res.data.visuForestCloudTodaySjfbBOList[i].deptName)
  413. aa.push(Number(res.data.visuForestCloudTodaySjfbBOList[i].deptCount))
  414. this.sourceData.push(aa)
  415. }
  416. }
  417. that.visuForestCloudCameraBOList = res.data.visuForestCloudCameraBOList
  418. that.visuForestCloudCameraBOListSearch = res.data.visuForestCloudCameraBOList
  419. if (res.data.visuForestCloudCameraBOList != null && res.data.visuForestCloudCameraBOList
  420. .length > 0) {
  421. for (let i = 0; i < res.data.visuForestCloudCameraBOList.length; i++) {
  422. let markersMap = {
  423. lng: 124.59,
  424. lat: 43.02,
  425. icon: 'camera',
  426. bindPopupHtml: '',
  427. click: 'preview',
  428. parameter: '',
  429. keepBindPopup: false,
  430. isAggregation: false
  431. }
  432. if (res.data.visuForestCloudCameraBOList[i].channelCode != null) {
  433. markersMap.parameter = {code:res.data.visuForestCloudCameraBOList[i].cameraCode,
  434. type:res.data.visuForestCloudCameraBOList[i].cameraFactory}
  435. } else {
  436. markersMap.parameter = []
  437. }
  438. markersMap.lng = res.data.visuForestCloudCameraBOList[i].longitude
  439. markersMap.lat = res.data.visuForestCloudCameraBOList[i].latitude
  440. markersMap.radius = res.data.visuForestCloudCameraBOList[i].cameraRadius
  441. markersMap.bindPopupHtml = '<div class="map-tip">' +
  442. '<span>' +
  443. ' <div class="d-l-con">' +
  444. ' <div class="d-l-l-text">' +
  445. ' <h4>经纬度:' + res.data.visuForestCloudCameraBOList[i].longitude +
  446. ',' + res.data.visuForestCloudCameraBOList[i].latitude + '</h4>' +
  447. ' </div>' +
  448. ' </div>' +
  449. ' </span>' +
  450. '<span>' +
  451. ' <div class="d-l-con">' +
  452. ' <div class="d-l-l-text">' +
  453. ' <h4>摄像头名称:' + res.data.visuForestCloudCameraBOList[i]
  454. .cameraName + '</h4>' +
  455. ' </div>' +
  456. ' </div>' +
  457. ' </span>' +
  458. '<span>' +
  459. ' <div class="d-l-con">' +
  460. ' <div class="d-l-l-text">' +
  461. ' <h4>摄像头类型:' + (res.data.visuForestCloudCameraBOList[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  462. ' </div>' +
  463. ' </div>' +
  464. ' </span>' +
  465. '<span>' +
  466. ' <div class="d-l-con">' +
  467. ' <div class="d-l-l-text">' +
  468. ' <h4>摄像头半径:' + res.data.visuForestCloudCameraBOList[i]
  469. .cameraRadius + '米</h4>' +
  470. ' </div>' +
  471. ' </div>' +
  472. ' </span>' +
  473. '</div>'
  474. this.cameraMarkersList.push(markersMap)
  475. // cameraAccount: "1"
  476. // cameraCode: "1000010"
  477. // cameraFactory: "2"
  478. // cameraIp: "1"
  479. // cameraName: "2"
  480. // cameraPasword: "2"
  481. // cameraPort: 2
  482. // cameraRadius: 20
  483. // cameraRegion: "3"
  484. // dataDeptId: null
  485. // dataStatus: null
  486. // eventType: null
  487. // height: "11"
  488. // id: "0d165fc362514f79b12a899ea66295fd"
  489. // latitude: "49.325625"
  490. // longitude: "125.3333"
  491. }
  492. setTimeout(() => {
  493. that.$refs.supermap.clearM(true)
  494. that.$refs.supermap.clearM(false)
  495. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  496. }, 1000)
  497. }
  498. })
  499. },
  500. dropLocation(lat, lng, index) {
  501. this.listCurrentIndex2 = index
  502. this.$refs.supermap.dropLocation(lat, lng)
  503. },
  504. selectCameraByDeptId(depId) {
  505. this.listCurrentIndex1 = depId
  506. let that = this
  507. that.cameraMarkersList = []
  508. that.visuForestCloudCameraBOList = []
  509. selectCameraByDeptId(depId).then(res => {
  510. //根据设备类型查看列表
  511. that.visuForestCloudCameraBOList = res.data
  512. that.visuForestCloudCameraBOListSearch = res.data
  513. if (res.data != null && res.data.length > 0) {
  514. for (let i = 0; i < res.data.length; i++) {
  515. let markersMap = {
  516. lng: 124.59,
  517. lat: 43.02,
  518. icon: 'camera',
  519. bindPopupHtml: '',
  520. click: 'preview',
  521. parameter: '',
  522. keepBindPopup: false,
  523. isAggregation: false
  524. }
  525. if (res.data[i].channelCode != null) {
  526. markersMap.parameter = {code:res.data[i].cameraCode,
  527. type:res.data[i].cameraFactory}
  528. } else {
  529. markersMap.parameter = []
  530. }
  531. markersMap.lng = res.data[i].longitude
  532. markersMap.lat = res.data[i].latitude
  533. markersMap.radius = res.data[i].cameraRadius
  534. markersMap.bindPopupHtml = '<div class="map-tip">' +
  535. '<span>' +
  536. ' <div class="d-l-con">' +
  537. ' <div class="d-l-l-text">' +
  538. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  539. '</h4>' +
  540. ' </div>' +
  541. ' </div>' +
  542. ' </span>' +
  543. '<span>' +
  544. ' <div class="d-l-con">' +
  545. ' <div class="d-l-l-text">' +
  546. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  547. ' </div>' +
  548. ' </div>' +
  549. ' </span>' +
  550. '<span>' +
  551. ' <div class="d-l-con">' +
  552. ' <div class="d-l-l-text">' +
  553. ' <h4>摄像头类型:' + (res.data[i].cameraFactory=="1"?"大华":"海康") + '</h4>' +
  554. ' </div>' +
  555. ' </div>' +
  556. ' </span>' +
  557. '<span>' +
  558. ' <div class="d-l-con">' +
  559. ' <div class="d-l-l-text">' +
  560. ' <h4>摄像头半径:' + res.data[i]
  561. .cameraRadius + '米</h4>' +
  562. ' </div>' +
  563. ' </div>' +
  564. ' </span>' +
  565. '</div>'
  566. this.cameraMarkersList.push(markersMap)
  567. // cameraAccount: "1"
  568. // cameraCode: "1000010"
  569. // cameraFactory: "2"
  570. // cameraIp: "1"
  571. // cameraName: "2"
  572. // cameraPasword: "2"
  573. // cameraPort: 2
  574. // cameraRadius: 20
  575. // cameraRegion: "3"
  576. // dataDeptId: null
  577. // dataStatus: null
  578. // eventType: null
  579. // height: "11"
  580. // id: "0d165fc362514f79b12a899ea66295fd"
  581. // latitude: "49.325625"
  582. // longitude: "125.3333"
  583. }
  584. setTimeout(() => {
  585. that.$refs.supermap.clearM(true)
  586. that.$refs.supermap.clearM(false)
  587. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  588. }, 1000)
  589. }
  590. })
  591. },
  592. //吉祥物收起左右框
  593. indent() {
  594. let list = document.getElementsByClassName('el-tooltip__popper')
  595. list[list.length - 1].style.display = 'none'
  596. if (this.indentStyle == '') {
  597. this.indentStyle = 'indent-style'
  598. this.indentleft = 'indent-left'
  599. this.indentright = 'indent-right'
  600. this.indentText = '展开左右栏'
  601. } else if (this.indentText == '展开左右栏') {
  602. this.indentStyle = ''
  603. this.indentleft = ''
  604. this.indentright = ''
  605. this.indentText = '收起左右栏'
  606. }
  607. },
  608. /** ----------------------------------摄像头预览开始------------------------------------- */
  609. alertLogin: function() {
  610. this.$modal.msg('登录中....')
  611. },
  612. alertLoginSuccess: function() {
  613. this.$modal.msgSuccess('登录成功!')
  614. },
  615. alertLoginFailed: function() {
  616. this.$modal.msgError('登陆失败!')
  617. },
  618. alertReinstall: function() {
  619. this.$modal.msgWarning('请重新安装客户端')
  620. },
  621. cancelEventLocationShow() {
  622. if (this.oWebControl != null) {
  623. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  624. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  625. },
  626. function() { // 断开与插件服务连接失败
  627. })
  628. }
  629. },
  630. /** 预览按钮操作 */
  631. preview(cameraParam) {
  632. if(cameraParam.type=='1'){
  633. getDahuaVideoServer().then(newResponse => {
  634. console.log(newResponse)
  635. this.ws.detectConnectQt().then(res => {
  636. if (res) { // 连接客户端成功
  637. this.alertLogin()
  638. this.ws.login({
  639. loginIp: newResponse.loginIp,
  640. loginPort: newResponse.loginPort,
  641. userName: newResponse.userName,
  642. userPwd: newResponse.userPwd,
  643. token: '',
  644. https: 1
  645. })
  646. this.ws.on('loginState', (res) => {
  647. this.isLogin = res
  648. console.log('---res-----', res)
  649. if (res) {
  650. this.alertLoginSuccess()
  651. this.activePanel = 'key2'
  652. this.realTimeVideoDialog(cameraParam.code)
  653. } else {
  654. this.alertLoginFailed()
  655. }
  656. })
  657. } else { // 连接客户端失败
  658. this.alertReinstall()
  659. }
  660. })
  661. })
  662. }else if(cameraParam.type=='0'){
  663. let that = this
  664. that.cameraVisible = true
  665. getHaiKangVideoServer({cameraCode:cameraParam.code}).then(newResponse => {
  666. that.cameraTitle = '摄像头-'+newResponse.data.cameraName
  667. that.initPlugin(newResponse.data.appkey,newResponse.data.loginIp,newResponse.data.secret,newResponse.data.loginPort)
  668. setTimeout(function() {
  669. that.playhk(newResponse.data.channelCode)
  670. }, 5000)
  671. })
  672. }
  673. },
  674. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  675. if (!this.isLogin) {
  676. this.$Message.info('正在登陆客户端,请稍等......')
  677. return false
  678. }
  679. const params = [cameraParams];
  680. this.ws.openVideo(params)
  681. },
  682. /** ----------------------------------摄像头预览结束------------------------------------- */
  683. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  684. // 创建播放实例
  685. initPlugin(newappkey,newloginIp,newsecret,newloginPort) {
  686. let that=this
  687. that.oWebControl = new WebControl({
  688. szPluginContainer: 'playWnd', // 指定容器id
  689. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  690. iServicePortEnd: 15909,
  691. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  692. cbConnectSuccess: function() { // 创建WebControl实例成功
  693. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  694. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  695. }).then(function() { // 启动插件服务成功
  696. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  697. cbIntegrationCallBack: cbIntegrationCallBack
  698. })
  699. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  700. that.init(newappkey,newloginIp,newsecret,newloginPort) // 创建播放实例成功后初始化
  701. })
  702. }, function() { // 启动插件服务失败
  703. })
  704. },
  705. cbConnectError: function() { // 创建WebControl实例失败
  706. that.oWebControl = null
  707. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  708. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  709. initCount++
  710. if (initCount < 3) {
  711. setTimeout(function() {
  712. that.initPlugin(newappkey,newloginIp,newsecret,newloginPort)
  713. }, 3000)
  714. } else {
  715. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  716. }
  717. },
  718. cbConnectClose: function(bNormalClose) {
  719. // 异常断开:bNormalClose = false
  720. // JS_Disconnect正常断开:bNormalClose = true
  721. console.log('cbConnectClose')
  722. that.oWebControl = null
  723. }
  724. })
  725. },
  726. //播放海康摄像头
  727. playhk(channelCode) {
  728. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  729. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  730. var transMode = 1 //传输协议:0-UDP,1-TCP
  731. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  732. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  733. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  734. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  735. this.oWebControl.JS_RequestInterface({
  736. funcName: 'startPreview',
  737. argument: JSON.stringify({
  738. cameraIndexCode: cameraIndexCode, //监控点编号
  739. streamMode: streamMode, //主子码流标识
  740. transMode: transMode, //传输协议
  741. gpuMode: gpuMode, //是否开启GPU硬解
  742. wndId: wndId //可指定播放窗口
  743. })
  744. })
  745. },
  746. //初始化
  747. init(newappkey,newloginIp,newsecret,newloginPort) {
  748. let that = this
  749. that.getPubKey(function() {
  750. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  751. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  752. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  753. var ip = newloginIp //综合安防管理平台IP地址,必填
  754. var playMode = 0 //初始播放模式:0-预览,1-回放
  755. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  756. var snapDir = 'D:\\SnapDir' //抓图存储路径
  757. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  758. var layout = '1x1' //playMode指定模式的布局
  759. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  760. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  761. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  762. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  763. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  764. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  765. that.oWebControl.JS_RequestInterface({
  766. funcName: 'init',
  767. argument: JSON.stringify({
  768. appkey: appkey, //API网关提供的appkey
  769. secret: secret, //API网关提供的secret
  770. ip: ip, //API网关IP地址
  771. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  772. port: port, //端口
  773. snapDir: snapDir, //抓图存储路径
  774. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  775. layout: layout, //布局
  776. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  777. encryptedFields: encryptedFields, //加密字段
  778. showToolbar: showToolbar, //是否显示工具栏
  779. showSmart: showSmart, //是否显示智能信息
  780. buttonIDs: buttonIDs //自定义工具条按钮
  781. })
  782. }).then(function(oData) {
  783. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  784. })
  785. })
  786. },
  787. //获取公钥
  788. getPubKey(callback) {
  789. let that = this
  790. that.oWebControl.JS_RequestInterface({
  791. funcName: 'getRSAPubKey',
  792. argument: JSON.stringify({
  793. keyLength: 1024
  794. })
  795. }).then(function(oData) {
  796. console.log(oData)
  797. if (oData.responseMsg.data) {
  798. that.pubKey = oData.responseMsg.data
  799. callback()
  800. }
  801. })
  802. },
  803. //RSA加密
  804. setEncrypt(value) {
  805. var encrypt = new JSEncrypt()
  806. encrypt.setPublicKey(this.pubKey)
  807. return encrypt.encrypt(value)
  808. },
  809. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  810. }
  811. }
  812. // 推送消息
  813. function cbIntegrationCallBack(oData) {
  814. console.log(JSON.stringify(oData.responseMsg))
  815. }
  816. </script>
  817. <style rel="stylesheet/scss" lang="scss" scoped>
  818. @import '@/assets/styles/base.scss';
  819. .playWnd {
  820. margin: 4px 0 0 8px;
  821. width: 1020px; /*播放容器的宽和高设定*/
  822. height: 600px;
  823. border: 1px solid red;
  824. }
  825. </style>