monitor.vue 41 KB

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