monitor.vue 43 KB

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