monitor.vue 44 KB

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