monitor.vue 42 KB

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