monitor.vue 43 KB

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