monitor.vue 41 KB

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