monitor.vue 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696
  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="sj-search">
  43. <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small"
  44. prefix-icon="el-icon-search"/>
  45. </div>
  46. <div class="i-list-con" style="height: 62vh">
  47. <div class="head-container tree-scrollbar" style="height: 700px;overflow-y:auto;">
  48. <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
  49. :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="[100]"
  50. @node-click="handleNodeClick" />
  51. </div>
  52. </div>
  53. </div>
  54. </dv-border-box-13>
  55. </div>
  56. </div>
  57. <!-- 地图 -->
  58. <supermap ref="supermap" style="width: 100%;height: 100vh;" @preview="preview" @jump="jump">
  59. </supermap>
  60. <!-- 右侧 -->
  61. <div class="rightbar" :class="indentright" ref="right">
  62. <div class="forthis">
  63. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  64. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  65. <div class="this-title">
  66. <span>列表</span>
  67. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" />
  68. </div>
  69. <div class="sj-search">
  70. <el-input v-model="rightDeptName" :placeholder="placeholderMsg" clearable size="small"
  71. prefix-icon="el-icon-search"/>
  72. </div>
  73. <div class="i-list-con" style="height: 37vh;">
  74. <div class="d-l-con" v-for="(item,index) in visuForestCloudCameraBOListSearch"
  75. :class="{on:listCurrentIndex2 == index}" v-on:click="dropLocation(item.latitude,item.longitude,index)">
  76. <div class="d-l-l-text">
  77. <i class="iconfont sj-icon-jkzx icon-sxt"></i>
  78. <h4>{{ item.cameraName }}</h4>
  79. <h4 v-if="onChuan" v-html="cgqData[index]"></h4>
  80. </div>
  81. </div>
  82. </div>
  83. </dv-border-box-13>
  84. </div>
  85. <div class="forthis">
  86. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  87. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  88. <div class="this-title">
  89. <span>重点区域</span>
  90. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" />
  91. </div>
  92. <div class="i-list-con h-25">
  93. <div class="d-l-con" v-for="(item,index) in keyAreaList" :class="{on:listCurrentIndex3 == index}"
  94. @click="getRegionalFlag(item.id)">
  95. <div class="d-l-l-text">
  96. <i class="i-small"></i>
  97. <h4>{{ item.areaName }}</h4>
  98. </div>
  99. </div>
  100. </div>
  101. </dv-border-box-13>
  102. </div>
  103. </div>
  104. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  105. </div>
  106. <eventLocation ref="eventLocation"></eventLocation>
  107. <TVWall ref="TVWall"></TVWall>
  108. <TVWalls ref="TVWalls"></TVWalls>
  109. <el-dialog :title="cameraTitle" :visible.sync="cameraVisible" v-if="cameraVisible" customClass="videoCustomWidth"
  110. @close="cancelEventLocationShow()">
  111. <div style="width:1020px;height:625px;position:relative;">
  112. <!--视频窗口展示---海康-->
  113. <div id="playWnd" class="playWnd" style="left: 0px; top: 0px;"></div>
  114. </div>
  115. </el-dialog>
  116. </div>
  117. </template>
  118. <script>
  119. import {
  120. selectDeviceType,
  121. selectCameraByDeptId,
  122. getSensorListByDeptId,
  123. getDlblistBydeptId,
  124. selectKeyAreaList,
  125. getRegionalFlag,
  126. getCamerasByDeptId,
  127. getMonitorDeviceAndDataList
  128. } from '@/api/monitor'
  129. import {
  130. treeselect
  131. } from '@/api/system/dept'
  132. import supermap from '@/components/supermap-2.5d' //超图
  133. import vheader from '@/components/v-header.vue' //一体化共用头部
  134. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  135. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  136. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  137. import TVWalls from '@/components/TVWalls.vue' //电视墙弹窗
  138. import {getUserProfile} from "@/api/system/user";
  139. /** ----------------------------------摄像头预览开始------------------------------------- */
  140. import {
  141. getDahuaVideoServer
  142. } from '@/api/dahua/dahua'
  143. import {
  144. getHaiKangVideoServer
  145. } from '@/api/haikang/haikang'
  146. import DHWs from '@/dahua/lib/DHWs'
  147. /** ----------------------------------摄像头预览结束------------------------------------- */
  148. // import echarts from 'echarts'
  149. let echarts = require('echarts')
  150. import Cookies from 'js-cookie';
  151. export default {
  152. components: {
  153. supermap,
  154. vheader,
  155. vBottomMenu,
  156. eventLocation,
  157. TVWalls,
  158. TVWall
  159. },
  160. created() {
  161. /** ----------------------------------摄像头预览开始------------------------------------- */
  162. const DHWsInstance = DHWs.getInstance()
  163. this.ws = DHWsInstance
  164. /** ----------------------------------摄像头预览结束------------------------------------- */
  165. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  166. window.showDialog = this.showDialog
  167. window.choseLayerSwitching = this.choseLayerSwitching
  168. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  169. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  170. },
  171. mounted() {
  172. // 初始化地图数据
  173. this.getSuperMapUrl();
  174. this.selectKeyAreaList()
  175. this.bottomMenuList() //获取底部公共组件消息和任务
  176. this.getTreeselect()
  177. this.deptId = Cookies.get("deptId")
  178. //this.getSensorListByDeptIds()
  179. // this.chuanSet()
  180. this.getMonitorDeviceAndDataLists()
  181. this.getDlblistBydeptIds()
  182. this.selectDeviceType(-1)
  183. },
  184. data() {
  185. return {
  186. cgqData: [],
  187. //摄像头名称
  188. rightDeptName: undefined,
  189. visuForestCloudCameraBOListSearch: [],
  190. // 部门名称
  191. deptName: undefined,
  192. deptId: '',
  193. // 部门树选项
  194. deptOptions: undefined,
  195. defaultProps: {
  196. children: 'children',
  197. label: 'label'
  198. },
  199. listCurrentIndex1: '-1',
  200. listCurrentIndex2: '-1',
  201. listCurrentIndex3: '-1',
  202. graphicsList: [], //重点区域
  203. /** ----------------------------------摄像头预览开始------------------------------------- */
  204. //大华
  205. activePanel: 'key1',
  206. isLogin: false,
  207. cameraParams: [],
  208. ws: null,
  209. //海康
  210. cameraTitle: '',
  211. cameraVisible: false,
  212. initCount: 0,
  213. pubKey: '',
  214. oWebControl: null,
  215. /** ----------------------------------摄像头预览结束------------------------------------- */
  216. visuForestCloudMapDeviceBOList: [{
  217. deviceCount: 0,
  218. deviceName: "摄像头"
  219. }],
  220. visuForestCloudCameraBOList: [],
  221. cameraMarkersList: [],
  222. sourceData: [],
  223. keyAreaList: [], //重点区域
  224. iframeBoo: true,
  225. open: false,
  226. iframeVue: null,
  227. activeName: 'info',
  228. radio: '1',
  229. region: [],
  230. //左右缩进
  231. indentStyle: '',
  232. indentleft: '',
  233. indentright: '',
  234. indentText: '收起左右栏',
  235. indentdisabled: false,
  236. placeholderMsg: "请输入摄像头名称",
  237. domId: 'dom1',
  238. localMark: "she",
  239. onShe: false,
  240. onChuan: false,
  241. onLa: false,
  242. colors: "green",
  243. sensorNum: 0,
  244. loudspeakerNum: 0,
  245. values: Math.random()
  246. }
  247. },
  248. watch: {
  249. // 根据名称筛选部门树
  250. deptName(val) {
  251. this.$refs.tree.filter(val)
  252. },
  253. rightDeptName(val) {
  254. this.visuForestCloudCameraBOListSearch = [];
  255. for (let i in this.visuForestCloudCameraBOList) {
  256. if (this.visuForestCloudCameraBOList[i].cameraName.indexOf(val) != -1) {
  257. this.visuForestCloudCameraBOListSearch.push(this.visuForestCloudCameraBOList[i]);
  258. }
  259. }
  260. }
  261. },
  262. methods: {
  263. //初始化地图数据
  264. getSuperMapUrl(){
  265. getUserProfile().then(response => {
  266. let mapDeptId=response.mapDeptId
  267. let num = 0;
  268. if (mapDeptId == "365") {
  269. num = 0;
  270. } else if (mapDeptId == "369") {
  271. num = 1;
  272. } else if (mapDeptId == "371") {
  273. num = 2;
  274. } else if (mapDeptId == "373") {
  275. num = 3;
  276. } else if (mapDeptId == "372") {
  277. num = 4;
  278. } else if (mapDeptId == "370") {
  279. num = 5;
  280. }
  281. this.$refs.supermap.removeAllviewer(num, -1);
  282. });
  283. },
  284. jump() { // 跳转云广播页面
  285. window.open("https://sts.sty1818.com");
  286. },
  287. setcgqValue: function() {
  288. let that = this
  289. for (let i = 0; i < that.visuForestCloudCameraBOListSearch.length; i++) {
  290. var color = "green";
  291. var value = Math.random();
  292. var up = "▲";
  293. var down = "▼";
  294. if (value > 0.5) {
  295. color = "red";
  296. value = value + "" + up;
  297. } else {
  298. value = value + "" + down;
  299. }
  300. that.cgqData.push("<span style='color:" + color + "'>" + value + "</span>")
  301. }
  302. setInterval(function() {
  303. var color = "green";
  304. var value = Math.random();
  305. var up = "▲";
  306. var down = "▼";
  307. if (value > 0.5) {
  308. color = "red";
  309. value = value + "" + up;
  310. } else {
  311. value = value + "" + down;
  312. }
  313. that.cgqData.push("<span style='color:" + color + "'>" + value + "</span>")
  314. if (that.cgqData.length > that.visuForestCloudCameraBOListSearch.length) {
  315. console.log(that.cgqData)
  316. that.cgqData.splice(0, 1)
  317. }
  318. }, 5000)
  319. },
  320. /* 电视墙替换开始 */
  321. showTVWall(channelCode, channelName) {
  322. let tvListJson = [{
  323. "switchTab": "2",
  324. "treeLabels": [{
  325. "id": null,
  326. "labelCode": "999",
  327. "labelName": "电视墙",
  328. "cameraType": null,
  329. "parentLabelCode": ""
  330. },
  331. {
  332. "id": "spcamera00010",
  333. "labelCode": channelCode,
  334. "labelName": channelName,
  335. "cameraType": "1",
  336. "parentLabelCode": "999"
  337. }
  338. ],
  339. "labelChannels": [{
  340. "labelCode": channelCode,
  341. "channelDates": [{
  342. "channelCode": channelCode,
  343. "channelName": channelName,
  344. "channelSn": null,
  345. "cameraType": "1",
  346. "online": "1",
  347. "cameraCode": "1"
  348. }]
  349. }]
  350. }]
  351. this.$refs.TVWall.showTVWall(tvListJson, [{
  352. "channelId": channelCode
  353. }]);
  354. this.$refs.bottomMenu.showMeasure = false;
  355. this.$refs.bottomMenu.showChild = false;
  356. this.$refs.bottomMenu.showBanChild = false;
  357. this.$refs.bottomMenu.showChangChild = false;
  358. },
  359. /* 电视墙替换结束 */
  360. /** 部门树*/
  361. // 查询部门下拉树结构
  362. getTreeselect() {
  363. treeselect().then(response => {
  364. console.log(response.data)
  365. this.deptOptions = response.data
  366. })
  367. },
  368. // 筛选节点
  369. filterNode(value, data) {
  370. if (!value) return true
  371. return data.label.indexOf(value) !== -1
  372. },
  373. // 节点单击事件
  374. handleNodeClick(data) {
  375. let that = this
  376. that.deptId = data.id
  377. console.log("节点单击事件", data, that.localMark);
  378. // this.findCameraByDept(data.id)
  379. if (that.localMark == 'she') {
  380. that.selectCameraByDeptId(data.id);
  381. getCamerasByDeptId(data.id).then(res => {
  382. that.$refs.TVWalls.showTVWall(res.data, {
  383. longitude: data.deptLongitude,
  384. latitude: data.deptLatitude
  385. });
  386. })
  387. } else if (that.localMark == 'chuan') {
  388. //that.getSensorListByDeptId()
  389. that.getMonitorDeviceAndDataList()
  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.deptId = Cookies.get("deptId");
  401. clearInterval(this.cgqTimer);
  402. this.selectDeviceType();
  403. },
  404. laClick() {
  405. this.onLa = true;
  406. this.onShe = false;
  407. this.onChuan = false;
  408. this.localMark = "la";
  409. this.placeholderMsg = "请输入云广播名称";
  410. this.deptId = Cookies.get("deptId");
  411. clearInterval(this.cgqTimer);
  412. this.getDlblistBydeptId();
  413. },
  414. chuanClick() {
  415. this.onLa = false
  416. this.onShe = false
  417. this.onChuan = true
  418. this.localMark = 'chuan'
  419. this.placeholderMsg = "请输入传感器名称"
  420. this.deptId = Cookies.get("deptId")
  421. this.getMonitorDeviceAndDataList()
  422. },
  423. // 云广播
  424. getDlblistBydeptId() {
  425. let that = this;
  426. let markersList = [];
  427. getDlblistBydeptId(that.deptId).then(function(res) {
  428. that.loudspeakerNum = res.data.length
  429. that.visuForestCloudCameraBOListSearch = []
  430. if (res.data != null && res.data.length > 0) {
  431. for (let j = 0; j < res.data.length; j++) {
  432. let dat = {
  433. cameraName: res.data[j].name,
  434. longitude: res.data[j].longitude,
  435. latitude: res.data[j].latitude,
  436. }
  437. that.visuForestCloudCameraBOListSearch.push(dat)
  438. }
  439. for (let i = 0; i < res.data.length; i++) {
  440. let markersMap = {
  441. lng: 124.59,
  442. lat: 43.02,
  443. icon: "marker",
  444. bindPopupHtml: '<div class="map-tip">' +
  445. "<span>" +
  446. ' <div class="d-l-con">' +
  447. ' <div class="d-l-l-text">' +
  448. " <h4>名称:" +
  449. (res.data[i].name ? res.data[i].name : "") +
  450. "</h4>" +
  451. " </div>" +
  452. " </div>" +
  453. " </span>" +
  454. "<span>" +
  455. ' <div class="d-l-con">' +
  456. ' <div class="d-l-l-text">' +
  457. " <h4>位置:" +
  458. (res.data[i].position ? res.data[i].position : "") +
  459. "</h4>" +
  460. " </div>" +
  461. " </div>" +
  462. " </span>" +
  463. "<span>" +
  464. ' <div class="d-l-con">' +
  465. ' <div class="d-l-l-text">' +
  466. " <h4>备注:" +
  467. (res.data[i].remark ? res.data[i].remark : "") +
  468. "</h4>" +
  469. " </div>" +
  470. " </div>" +
  471. " </span>" +
  472. "<span>" +
  473. ' <div class="d-l-con">' +
  474. ' <div class="d-l-l-text">' +
  475. " <h4>经纬度:" +
  476. res.data[i].longitude + "," + res.data[i].latitude +
  477. "</h4>" +
  478. " </div>" +
  479. " </div>" +
  480. " </span>" +
  481. "</div>",
  482. click: 'jump',
  483. parameter: "",
  484. name: "",
  485. keepBindPopup: false,
  486. isAggregation: false,
  487. };
  488. markersMap.icon = "big-horn";
  489. markersMap.lng = res.data[i].longitude;
  490. markersMap.lat = res.data[i].latitude;
  491. markersList.push(markersMap);
  492. }
  493. setTimeout(() => {
  494. that.$refs.supermap.clearM();
  495. that.$refs.supermap.clearMRadius()
  496. that.$refs.supermap.setMarkers(markersList);
  497. }, 2000);
  498. } else {
  499. setTimeout(() => {
  500. that.$refs.supermap.clearM();
  501. that.$refs.supermap.clearMRadius()
  502. }, 2000);
  503. }
  504. })
  505. .catch(function(error) {
  506. console.error(error);
  507. });
  508. },
  509. getDlblistBydeptIds() {
  510. let that = this;
  511. getDlblistBydeptId(that.deptId).then(function(res) {
  512. that.loudspeakerNum = res.data.length
  513. })
  514. .catch(function(error) {
  515. console.error(error);
  516. });
  517. },
  518. chuanSet() {
  519. let that = this
  520. setInterval(function() {
  521. that.getMonitorDeviceAndDataList()
  522. }, 20 * 1000)
  523. },
  524. //传感器2
  525. getMonitorDeviceAndDataList() {
  526. let list = []
  527. let markersList = [];
  528. getMonitorDeviceAndDataList(this.deptId).then((res) => {
  529. this.visuForestCloudCameraBOListSearch = []
  530. list = res.data
  531. //this.sensorNum = list.length
  532. list.forEach(item => {
  533. let dat = {
  534. cameraName: item.deviceName,
  535. longitude: item.longitude,
  536. latitude: item.latitude,
  537. }
  538. this.visuForestCloudCameraBOListSearch.push(dat)
  539. let markersMap = {
  540. lng: 124.59,
  541. lat: 43.02,
  542. icon: "marker",
  543. bindPopupHtml: '<div class="map-tip">' +
  544. "<span>" +
  545. ' <div class="d-l-con">' +
  546. ' <div class="d-l-l-text">' +
  547. " <h4>名称:" +
  548. (item.deviceName ? item.deviceName : "") +
  549. "</h4>" +
  550. " </div>" +
  551. " </div>" +
  552. " </span>" +
  553. "<span>" +
  554. ' <div class="d-l-con">' +
  555. ' <div class="d-l-l-text">' +
  556. " <h4>厂家:" +
  557. (item.brand ? item.brand : "") +
  558. "</h4>" +
  559. " </div>" +
  560. " </div>" +
  561. " </span>" +
  562. "<span>" +
  563. ' <div class="d-l-con">' +
  564. ' <div class="d-l-l-text">' +
  565. " <h4>经纬度:" +
  566. item.longitude + "," + item.latitude +
  567. "</h4>" +
  568. " </div>" +
  569. " </div>" +
  570. " </span>" +
  571. "</div>",
  572. click: "",
  573. parameter: "",
  574. name: "",
  575. keepBindPopup: false,
  576. isAggregation: false,
  577. };
  578. if (item.deviceType == 1) { // 水质传感器
  579. markersMap.icon = "sj-icon-map-centerdata_water_quality_sensor";
  580. markersMap.bindPopupHtml += '<div class="map-tip">' +
  581. "<span>" +
  582. ' <div class="d-l-con">' +
  583. ' <div class="d-l-l-text">' +
  584. " <h4>水中PH:" +
  585. (item.data.waterPh ? item.data.waterPh + "pH" : "0pH") +
  586. "</h4>" +
  587. " </div>" +
  588. " </div>" +
  589. " </span>" +
  590. // "<span>" +
  591. // ' <div class="d-l-con">' +
  592. // ' <div class="d-l-l-text">' +
  593. // " <h4>生化需氧量:" +
  594. // (item.data.bod ? item.data.bod+"mg/L" : "") +
  595. // "</h4>" +
  596. // " </div>" +
  597. // " </div>" +
  598. // " </span>" +
  599. // "<span>" +
  600. // ' <div class="d-l-con">' +
  601. // ' <div class="d-l-l-text">' +
  602. // " <h4>信号强度:" +
  603. // (item.data.signalStrength ? item.data.signalStrength+"" : "") +
  604. // "</h4>" +
  605. // " </div>" +
  606. // " </div>" +
  607. // " </span>" +
  608. "<span>" +
  609. ' <div class="d-l-con">' +
  610. ' <div class="d-l-l-text">' +
  611. " <h4>化学需氧量:" +
  612. (item.data.cod ? item.data.cod + "mg/L" : "0mg/L") +
  613. "</h4>" +
  614. " </div>" +
  615. " </div>" +
  616. " </span>" +
  617. "<span>" +
  618. ' <div class="d-l-con">' +
  619. ' <div class="d-l-l-text">' +
  620. " <h4>氨氮:" +
  621. (item.data.ammoniaNitrogen ? item.data.ammoniaNitrogen + "mg/L" : "0mg/L") +
  622. "</h4>" +
  623. " </div>" +
  624. " </div>" +
  625. " </span>" +
  626. "<span>" +
  627. ' <div class="d-l-con">' +
  628. ' <div class="d-l-l-text">' +
  629. " <h4>水温:" +
  630. (item.data.waterTemperature ? item.data.waterTemperature + "°C" : "0°C") +
  631. "</h4>" +
  632. " </div>" +
  633. " </div>" +
  634. " </span>" +
  635. // "<span>" +
  636. // ' <div class="d-l-con">' +
  637. // ' <div class="d-l-l-text">' +
  638. // " <h4>水质悬浮物:" +
  639. // (item.data.waterQualitySuspension ? item.data.waterQualitySuspension : "") +
  640. // "</h4>" +
  641. // " </div>" +
  642. // " </div>" +
  643. // " </span>" +
  644. "</div>";
  645. } else if (item.deviceType == '002') { // 水尺
  646. markersMap.icon = "sj-icon-map-centerdata_water_gauge";
  647. } else if (item.deviceType == '003') { // 水文监测设备
  648. markersMap.icon = "sj-icon-map-centerdata_hydrological_monitoring_equipment";
  649. } else if (item.deviceType == 2) { // 土壤监测设备
  650. markersMap.icon = "sj-icon-map-centerdata_soil_monitoring_equipment";
  651. markersMap.bindPopupHtml += '<div class="map-tip">' +
  652. "<span>" +
  653. ' <div class="d-l-con">' +
  654. ' <div class="d-l-l-text">' +
  655. " <h4>钾含量:" +
  656. (item.data.potassium ? item.data.potassium + "mg/kg" : "0mg/kg") +
  657. "</h4>" +
  658. " </div>" +
  659. " </div>" +
  660. " </span>" +
  661. "<span>" +
  662. ' <div class="d-l-con">' +
  663. ' <div class="d-l-l-text">' +
  664. " <h4>导电率:" +
  665. (item.data.conductivity ? item.data.conductivity + "us/cm" : "0us/cm") +
  666. "</h4>" +
  667. " </div>" +
  668. " </div>" +
  669. " </span>" +
  670. "<span>" +
  671. ' <div class="d-l-con">' +
  672. ' <div class="d-l-l-text">' +
  673. " <h4>氮含量:" +
  674. (item.data.nitrogen ? item.data.nitrogen + "mg/kg" : "0mg/kg") +
  675. "</h4>" +
  676. " </div>" +
  677. " </div>" +
  678. " </span>" +
  679. // "<span>" +
  680. // ' <div class="d-l-con">' +
  681. // ' <div class="d-l-l-text">' +
  682. // " <h4>信号强度:" +
  683. // (item.data.signalStrength ? item.data.signalStrength : "") +
  684. // "</h4>" +
  685. // " </div>" +
  686. // " </div>" +
  687. // " </span>" +
  688. "<span>" +
  689. ' <div class="d-l-con">' +
  690. ' <div class="d-l-l-text">' +
  691. " <h4>温度:" +
  692. (item.data.temperature ? item.data.temperature + "°C" : "0°C") +
  693. "</h4>" +
  694. " </div>" +
  695. " </div>" +
  696. " </span>" +
  697. "<span>" +
  698. ' <div class="d-l-con">' +
  699. ' <div class="d-l-l-text">' +
  700. " <h4>ph值:" +
  701. (item.data.ph ? item.data.ph + "PH" : "0PH") +
  702. "</h4>" +
  703. " </div>" +
  704. " </div>" +
  705. " </span>" +
  706. "<span>" +
  707. ' <div class="d-l-con">' +
  708. ' <div class="d-l-l-text">' +
  709. " <h4>湿度:" +
  710. (item.data.humidity ? item.data.humidity + "%RH" : "0%RH") +
  711. "</h4>" +
  712. " </div>" +
  713. " </div>" +
  714. " </span>" +
  715. // "<span>" +
  716. // ' <div class="d-l-con">' +
  717. // ' <div class="d-l-l-text">' +
  718. // " <h4>错误码:" +
  719. // (item.data.errorCode ? item.data.errorCode : "") +
  720. // "</h4>" +
  721. // " </div>" +
  722. // " </div>" +
  723. // " </span>" +
  724. // "<span>" +
  725. // ' <div class="d-l-con">' +
  726. // ' <div class="d-l-l-text">' +
  727. // " <h4>版本号:" +
  728. // (item.data.version ? item.data.version : "") +
  729. // "</h4>" +
  730. // " </div>" +
  731. // " </div>" +
  732. // " </span>" +
  733. "<span>" +
  734. ' <div class="d-l-con">' +
  735. ' <div class="d-l-l-text">' +
  736. " <h4>磷含量:" +
  737. (item.data.phosphorus ? item.data.phosphorus + "mg/kg" : "0mg/kg") +
  738. "</h4>" +
  739. " </div>" +
  740. " </div>" +
  741. " </span>" +
  742. // "<span>" +
  743. // ' <div class="d-l-con">' +
  744. // ' <div class="d-l-l-text">' +
  745. // " <h4>电压:" +
  746. // (item.data.voltage ? item.data.voltage : "") +
  747. // "</h4>" +
  748. // " </div>" +
  749. // " </div>" +
  750. // " </span>"
  751. "</div>";
  752. } else if (item.deviceType == 4) { // 病虫害监测站
  753. markersMap.icon = "sj-icon-map-centerdata_pest_and_disease_monitoring_station";
  754. } else if (item.deviceType == 5) { // 大气传感器
  755. markersMap.icon = "sj-icon-map-centerdata_atmospheric_sensor";
  756. markersMap.bindPopupHtml += '<div class="map-tip">' +
  757. // "<span>" +
  758. // ' <div class="d-l-con">' +
  759. // ' <div class="d-l-l-text">' +
  760. // " <h4>总挥发性有机物:" +
  761. // (item.data.tvoc ? item.data.tvoc : "") +
  762. // "</h4>" +
  763. // " </div>" +
  764. // " </div>" +
  765. // " </span>" +
  766. "<span>" +
  767. ' <div class="d-l-con">' +
  768. ' <div class="d-l-l-text">' +
  769. " <h4>二氧化硫:" +
  770. (item.data.sulfurDioxide ? item.data.sulfurDioxide + "ug/m³" : "0ug/m³") +
  771. "</h4>" +
  772. " </div>" +
  773. " </div>" +
  774. " </span>" +
  775. // "<span>" +
  776. // ' <div class="d-l-con">' +
  777. // ' <div class="d-l-l-text">' +
  778. // " <h4>电池电压:" +
  779. // (item.data.batteryVoltage ? item.data.batteryVoltage : "") +
  780. // "</h4>" +
  781. // " </div>" +
  782. // " </div>" +
  783. // " </span>" +
  784. // "<span>" +
  785. // ' <div class="d-l-con">' +
  786. // ' <div class="d-l-l-text">' +
  787. // " <h4>信号强度:" +
  788. // (item.data.signalStrength ? item.data.signalStrength : "") +
  789. // "</h4>" +
  790. // " </div>" +
  791. // " </div>" +
  792. // " </span>" +
  793. // "<span>" +
  794. // ' <div class="d-l-con">' +
  795. // ' <div class="d-l-l-text">' +
  796. // " <h4>可吸入颗粒物:" +
  797. // (item.data.suctionParticle ? item.data.suctionParticle : "") +
  798. // "</h4>" +
  799. // " </div>" +
  800. // " </div>" +
  801. // " </span>" +
  802. "<span>" +
  803. ' <div class="d-l-con">' +
  804. ' <div class="d-l-l-text">' +
  805. " <h4>一氧化碳:" +
  806. (item.data.carbonMonoxide ? item.data.carbonMonoxide + "ug/m³" : "0ug/m³") +
  807. "</h4>" +
  808. " </div>" +
  809. " </div>" +
  810. " </span>" +
  811. // "<span>" +
  812. // ' <div class="d-l-con">' +
  813. // ' <div class="d-l-l-text">' +
  814. // " <h4>臭氧:" +
  815. // (item.data.ozone ? item.data.ozone : "") +
  816. // "</h4>" +
  817. // " </div>" +
  818. // " </div>" +
  819. // " </span>" +
  820. // "<span>" +
  821. // ' <div class="d-l-con">' +
  822. // ' <div class="d-l-l-text">' +
  823. // " <h4>总悬浮颗粒物:" +
  824. // (item.data.tsp ? item.data.tsp : "") +
  825. // "</h4>" +
  826. // " </div>" +
  827. // " </div>" +
  828. // " </span>" +
  829. "<span>" +
  830. ' <div class="d-l-con">' +
  831. ' <div class="d-l-l-text">' +
  832. " <h4>温度:" +
  833. (item.data.temperature ? item.data.temperature + "°C" : "0°C") +
  834. "</h4>" +
  835. " </div>" +
  836. " </div>" +
  837. " </span>" +
  838. // "<span>" +
  839. // ' <div class="d-l-con">' +
  840. // ' <div class="d-l-l-text">' +
  841. // " <h4>湿度:" +
  842. // (item.data.humidity ? item.data.humidity : "") +
  843. // "</h4>" +
  844. // " </div>" +
  845. // " </div>" +
  846. // " </span>" +
  847. // "<span>" +
  848. // ' <div class="d-l-con">' +
  849. // ' <div class="d-l-l-text">' +
  850. // " <h4>细颗粒:" +
  851. // (item.data.fineParticle ? item.data.fineParticle+"ug/m3" : "") +
  852. // "</h4>" +
  853. // " </div>" +
  854. // " </div>" +
  855. // " </span>" +
  856. "<span>" +
  857. ' <div class="d-l-con">' +
  858. ' <div class="d-l-l-text">' +
  859. " <h4>二氧化氮:" +
  860. (item.data.nitrogenDioxide ? item.data.nitrogenDioxide + "ug/m³" : "0ug/m³") +
  861. "</h4>" +
  862. " </div>" +
  863. " </div>" +
  864. " </span>" +
  865. // "<span>" +
  866. // ' <div class="d-l-con">' +
  867. // ' <div class="d-l-l-text">' +
  868. // " <h4>风向:" +
  869. // (item.data.windDirection ? item.data.windDirection : "") +
  870. // "</h4>" +
  871. // " </div>" +
  872. // " </div>" +
  873. // " </span>" +
  874. // "<span>" +
  875. // ' <div class="d-l-con">' +
  876. // ' <div class="d-l-l-text">' +
  877. // " <h4>风速:" +
  878. // (item.data.windSpeed ? item.data.windSpeed : "") +
  879. // "</h4>" +
  880. // " </div>" +
  881. // " </div>" +
  882. // " </span>" +
  883. "</div>";
  884. } else if (item.deviceType == 6) { // 水压传感器
  885. markersMap.icon = "sj-icon-map-centerdata_water_pressure_sensor";
  886. markersMap.bindPopupHtml += '<div class="map-tip">' +
  887. // "<span>" +
  888. // ' <div class="d-l-con">' +
  889. // ' <div class="d-l-l-text">' +
  890. // " <h4>设备编码:" +
  891. // (item.data.IMEI ? item.data.IMEI : "") +
  892. // "</h4>" +
  893. // " </div>" +
  894. // " </div>" +
  895. // " </span>" +
  896. "<span>" +
  897. ' <div class="d-l-con">' +
  898. ' <div class="d-l-l-text">' +
  899. " <h4>下限警报使能:" +
  900. (item.data.thresholdLowEnable ? item.data.thresholdLowEnable + "MPa" : "0MPa") +
  901. "</h4>" +
  902. " </div>" +
  903. " </div>" +
  904. " </span>" +
  905. "<span>" +
  906. ' <div class="d-l-con">' +
  907. ' <div class="d-l-l-text">' +
  908. " <h4>上限警报使能:" +
  909. (item.data.thresholdHighEnable ? item.data.thresholdHighEnable + "MPa" : "0MPa") +
  910. "</h4>" +
  911. " </div>" +
  912. " </div>" +
  913. " </span>" +
  914. // "<span>" +
  915. // ' <div class="d-l-con">' +
  916. // ' <div class="d-l-l-text">' +
  917. // " <h4>信号强度:" +
  918. // (item.data.signalPower ? item.data.signalPower : "") +
  919. // "</h4>" +
  920. // " </div>" +
  921. // " </div>" +
  922. // " </span>" +
  923. "<span>" +
  924. ' <div class="d-l-con">' +
  925. ' <div class="d-l-l-text">' +
  926. " <h4>水压力值:" +
  927. (item.data.hydraulicValue ? item.data.hydraulicValue + "MPa" : "0MPa") +
  928. "</h4>" +
  929. " </div>" +
  930. " </div>" +
  931. " </span>" +
  932. "<span>" +
  933. ' <div class="d-l-con">' +
  934. ' <div class="d-l-l-text">' +
  935. " <h4>水压下限阈值:" +
  936. (item.data.hydraulicThresholdMin ? item.data.hydraulicThresholdMin + "MPa" : "0MPa") +
  937. "</h4>" +
  938. " </div>" +
  939. " </div>" +
  940. " </span>" +
  941. "<span>" +
  942. ' <div class="d-l-con">' +
  943. ' <div class="d-l-l-text">' +
  944. " <h4>水压上限阈值:" +
  945. (item.data.hydraulicThresholdMax ? item.data.hydraulicThresholdMax + "MPa" : "0MPa") +
  946. "</h4>" +
  947. " </div>" +
  948. " </div>" +
  949. " </span>" +
  950. // "<span>" +
  951. // ' <div class="d-l-con">' +
  952. // ' <div class="d-l-l-text">' +
  953. // " <h4>水压力值:" +
  954. // (item.data.hydraulicValue ? item.data.hydraulicValue : "") +
  955. // "</h4>" +
  956. // " </div>" +
  957. // " </div>" +
  958. // " </span>" +
  959. // "<span>" +
  960. // ' <div class="d-l-con">' +
  961. // ' <div class="d-l-l-text">' +
  962. // " <h4>心跳周期:" +
  963. // (item.data.heartbeatTime ? item.data.heartbeatTime : "") +
  964. // "</h4>" +
  965. // " </div>" +
  966. // " </div>" +
  967. // " </span>" +
  968. // "<span>" +
  969. // ' <div class="d-l-con">' +
  970. // ' <div class="d-l-l-text">' +
  971. // " <h4>电池电压:" +
  972. // (item.data.batteryVoltage ? item.data.batteryVoltage : "") +
  973. // "</h4>" +
  974. // " </div>" +
  975. // " </div>" +
  976. // " </span>" +
  977. // "<span>" +
  978. // ' <div class="d-l-con">' +
  979. // ' <div class="d-l-l-text">' +
  980. // " <h4>电池电量:" +
  981. // (item.data.batteryValue ? item.data.batteryValue : "") +
  982. // "</h4>" +
  983. // " </div>" +
  984. // " </div>" +
  985. // " </span>" +
  986. "</div>";
  987. } else if (item.deviceType == 7) //水流速传感器
  988. {
  989. markersMap.icon = "sj-icon-map-centerdata_water_flow_rate";
  990. markersMap.bindPopupHtml += '<div class="map-tip">' +
  991. // "<span>" +
  992. // ' <div class="d-l-con">' +
  993. // ' <div class="d-l-l-text">' +
  994. // " <h4>两流量累计之和:" +
  995. // (item.data.Q ? item.data.Q : "") +
  996. // "</h4>" +
  997. // " </div>" +
  998. // " </div>" +
  999. // " </span>" +
  1000. // "<span>" +
  1001. // ' <div class="d-l-con">' +
  1002. // ' <div class="d-l-l-text">' +
  1003. // " <h4>瞬时流量:" +
  1004. // (item.data.Q1 ? item.data.Q1+"m3/s" : "") +
  1005. // "</h4>" +
  1006. // " </div>" +
  1007. // " </div>" +
  1008. // " </span>" +
  1009. "<span>" +
  1010. ' <div class="d-l-con">' +
  1011. ' <div class="d-l-l-text">' +
  1012. " <h4>瞬时流速:" +
  1013. (item.data.V1 ? item.data.V1 + "m/s" : "0m/s") +
  1014. "</h4>" +
  1015. " </div>" +
  1016. " </div>" +
  1017. " </span>" +
  1018. "<span>" +
  1019. ' <div class="d-l-con">' +
  1020. ' <div class="d-l-l-text">' +
  1021. " <h4>瞬时流量:" +
  1022. (item.data.Q ? item.data.Q + "m³/s" : "0m³/s") +
  1023. "</h4>" +
  1024. " </div>" +
  1025. " </div>" +
  1026. " </span></div>";
  1027. }
  1028. markersMap.lng = item.longitude;
  1029. markersMap.lat = item.latitude;
  1030. markersList.push(markersMap);
  1031. })
  1032. console.log(markersList)
  1033. })
  1034. setTimeout(() => {
  1035. this.$refs.supermap.clearM();
  1036. this.$refs.supermap.clearMRadius()
  1037. this.$refs.supermap.setMarkers(markersList);
  1038. }, 2000);
  1039. },
  1040. //传感器2
  1041. getMonitorDeviceAndDataLists() {
  1042. let that = this
  1043. getMonitorDeviceAndDataList(null).then((res) => {
  1044. that.sensorNum = res.data.length
  1045. })
  1046. },
  1047. // 传感器
  1048. getSensorListByDeptId() {
  1049. let that = this;
  1050. let markersList = [];
  1051. getSensorListByDeptId(that.deptId).then(function(res) {
  1052. that.visuForestCloudCameraBOListSearch = []
  1053. // that.sensorNum = res.data.length
  1054. if (res.data != null && res.data.length > 0) {
  1055. for (let j = 0; j < res.data.length; j++) {
  1056. let dat = {
  1057. cameraName: res.data[j].deviceName,
  1058. longitude: res.data[j].longitude,
  1059. latitude: res.data[j].latitude,
  1060. }
  1061. that.visuForestCloudCameraBOListSearch.push(dat)
  1062. }
  1063. for (let i = 0; i < res.data.length; i++) {
  1064. let markersMap = {
  1065. lng: 124.59,
  1066. lat: 43.02,
  1067. icon: "marker",
  1068. bindPopupHtml: "cgq",
  1069. click: "",
  1070. parameter: "",
  1071. name: i,
  1072. keepBindPopup: false,
  1073. isAggregation: false,
  1074. };
  1075. if (res.data[i].deviceType == 1) { // 水质传感器
  1076. markersMap.icon = "sj-icon-map-centerdata_water_quality_sensor";
  1077. } else if (res.data[i].deviceType == '002') { // 水尺
  1078. markersMap.icon = "sj-icon-map-centerdata_water_gauge";
  1079. } else if (res.data[i].deviceType == '003') { // 水文监测设备
  1080. markersMap.icon = "sj-icon-map-centerdata_hydrological_monitoring_equipment";
  1081. } else if (res.data[i].deviceType == 2) { // 土壤监测设备
  1082. markersMap.icon = "sj-icon-map-centerdata_soil_monitoring_equipment";
  1083. } else if (res.data[i].deviceType == 4) { // 病虫害监测站
  1084. markersMap.icon = "sj-icon-map-centerdata_pest_and_disease_monitoring_station";
  1085. } else if (res.data[i].deviceType == 5) { // 大气传感器
  1086. markersMap.icon = "sj-icon-map-centerdata_atmospheric_sensor";
  1087. } else if (res.data[i].deviceType == 6) { // 水压传感器
  1088. markersMap.icon = "sj-icon-map-centerdata_water_pressure_sensor";
  1089. }
  1090. markersMap.lng = res.data[i].longitude;
  1091. markersMap.lat = res.data[i].latitude;
  1092. markersList.push(markersMap);
  1093. }
  1094. that.setcgqValue()
  1095. setTimeout(() => {
  1096. that.$refs.supermap.clearM();
  1097. that.$refs.supermap.clearMRadius()
  1098. that.$refs.supermap.setMarkers(markersList);
  1099. }, 2000);
  1100. } else {
  1101. setTimeout(() => {
  1102. that.$refs.supermap.clearM();
  1103. that.$refs.supermap.clearMRadius()
  1104. }, 2000);
  1105. }
  1106. that.onLa = false
  1107. that.onShe = false
  1108. that.onChuan = true
  1109. })
  1110. .catch(function(error) {
  1111. console.error(error);
  1112. });
  1113. },
  1114. getSensorListByDeptIds() {
  1115. let that = this;
  1116. getSensorListByDeptId(that.deptId).then(function(res) {
  1117. that.sensorNum = res.data.length
  1118. })
  1119. .catch(function(error) {
  1120. console.error(error);
  1121. });
  1122. },
  1123. selectKeyAreaList() {
  1124. this.keyAreaList = []
  1125. //获取重点区域列表
  1126. let that = this
  1127. selectKeyAreaList().then(res => {
  1128. that.keyAreaList = res.data
  1129. })
  1130. },
  1131. getRegionalFlag(id) {
  1132. //获取重点区域
  1133. this.listCurrentIndex3 = id
  1134. let that = this
  1135. getRegionalFlag(id).then(res => {
  1136. that.graphicsList = []
  1137. //地图标记
  1138. if (res.data != null && res.data.length > 0) {
  1139. for (let i = 0; i < res.data.length; i++) {
  1140. that.graphicsList.push(res.data[i].lng)
  1141. that.graphicsList.push(res.data[i].lat)
  1142. }
  1143. setTimeout(() => {
  1144. that.$refs.supermap.clearG()
  1145. that.$refs.supermap.setGraphicsList(this.graphicsList, 'red', 0.8)
  1146. }, 1000)
  1147. } else {
  1148. that.$refs.supermap.clearG()
  1149. }
  1150. })
  1151. },
  1152. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  1153. bottomMenuList() {
  1154. this.$refs.bottomMenu.selectTaskList() //获取任务列表
  1155. this.$refs.bottomMenu.selectMessageList() //获取消息列表
  1156. },
  1157. showDialog(click) {
  1158. if (click == 'eventLocation') {
  1159. this.$refs.eventLocation.showEventLocation()
  1160. this.$refs.bottomMenu.showMeasure = false
  1161. this.$refs.bottomMenu.showChild = false
  1162. this.$refs.bottomMenu.showBanChild = false
  1163. this.$refs.bottomMenu.showChangChild = false
  1164. } else if (click == 'editableLayers') {
  1165. this.$refs.bottomMenu.showChild = false
  1166. this.$refs.bottomMenu.showBanChild = false
  1167. this.$refs.bottomMenu.showChangChild = false
  1168. if (!this.$refs.bottomMenu.showMeasure) {
  1169. this.$refs.bottomMenu.showMeasure = true
  1170. } else {
  1171. this.$refs.bottomMenu.showMeasure = false
  1172. }
  1173. } else if (click == 'layerSwitching') {
  1174. this.$refs.bottomMenu.showMeasure = false
  1175. this.$refs.bottomMenu.showBanChild = false
  1176. this.$refs.bottomMenu.showChangChild = false
  1177. if (!this.$refs.bottomMenu.showChild) {
  1178. this.$refs.bottomMenu.showChild = true
  1179. } else {
  1180. this.$refs.bottomMenu.showChild = false
  1181. }
  1182. } else if (click == 'TVWall') {
  1183. this.$refs.TVWall.showTVWall()
  1184. this.$refs.bottomMenu.showMeasure = false
  1185. this.$refs.bottomMenu.showChild = false
  1186. this.$refs.bottomMenu.showBanChild = false
  1187. this.$refs.bottomMenu.showChangChild = false
  1188. } else if (click == 'forestban') {
  1189. this.$refs.bottomMenu.showMeasure = false
  1190. this.$refs.bottomMenu.showChild = false
  1191. this.$refs.bottomMenu.showChangChild = false
  1192. if (!this.$refs.bottomMenu.showBanChild) {
  1193. this.$refs.bottomMenu.showBanChild = true
  1194. } else {
  1195. this.$refs.bottomMenu.showBanChild = false
  1196. }
  1197. } else if (click == 'forestchang') {
  1198. this.$refs.bottomMenu.showMeasure = false
  1199. this.$refs.bottomMenu.showBanChild = false
  1200. this.$refs.bottomMenu.showChild = false
  1201. if (!this.$refs.bottomMenu.showChangChild) {
  1202. this.$refs.bottomMenu.showChangChild = true
  1203. } else {
  1204. this.$refs.bottomMenu.showChangChild = false
  1205. }
  1206. }
  1207. },
  1208. //选择图层
  1209. choseLayerSwitching(url, isClear) {
  1210. this.$refs.supermap.layerSwitching(url, isClear)
  1211. },
  1212. //选择图层(传递数组)
  1213. choseLayerSwitchingList(urlList) {
  1214. this.$refs.supermap.layerSwitchingList(urlList)
  1215. },
  1216. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  1217. selectDeviceType() {
  1218. //获取左侧动态感知设备
  1219. let that = this
  1220. selectDeviceType().then(res => {
  1221. that.cameraMarkersList = []
  1222. that.visuForestCloudMapDeviceBOList = res.data.visuForestCloudMapDeviceBOList
  1223. that.region = res.data.visuForestCloudTodaySjfbBOList
  1224. if (res.data.visuForestCloudTodaySjfbBOList != null && res.data.visuForestCloudTodaySjfbBOList
  1225. .length > 0) {
  1226. for (let i = 0; i < res.data.visuForestCloudTodaySjfbBOList.length; i++) {
  1227. let aa = []
  1228. aa.push(res.data.visuForestCloudTodaySjfbBOList[i].deptName)
  1229. aa.push(Number(res.data.visuForestCloudTodaySjfbBOList[i].deptCount))
  1230. this.sourceData.push(aa)
  1231. }
  1232. }
  1233. that.visuForestCloudCameraBOList = res.data.visuForestCloudCameraBOList
  1234. that.visuForestCloudCameraBOListSearch = res.data.visuForestCloudCameraBOList
  1235. if (res.data.visuForestCloudCameraBOList != null && res.data.visuForestCloudCameraBOList.length >
  1236. 0) {
  1237. for (let i = 0; i < res.data.visuForestCloudCameraBOList.length; i++) {
  1238. let markersMap = {
  1239. lng: 124.59,
  1240. lat: 43.02,
  1241. icon: 'camera',
  1242. bindPopupHtml: '',
  1243. click: 'preview',
  1244. parameter: '',
  1245. name: i,
  1246. keepBindPopup: false,
  1247. isAggregation: false
  1248. }
  1249. if (res.data.visuForestCloudCameraBOList[i].channelCode != null) {
  1250. markersMap.parameter = {
  1251. code: res.data.visuForestCloudCameraBOList[i].cameraCode,
  1252. name: res.data.visuForestCloudCameraBOList[i].cameraName,
  1253. type: res.data.visuForestCloudCameraBOList[i].cameraFactory
  1254. }
  1255. } else {
  1256. markersMap.parameter = []
  1257. }
  1258. markersMap.lng = res.data.visuForestCloudCameraBOList[i].longitude
  1259. markersMap.lat = res.data.visuForestCloudCameraBOList[i].latitude
  1260. markersMap.radius = res.data.visuForestCloudCameraBOList[i].cameraRadius
  1261. markersMap.bindPopupHtml = '<div class="map-tip">' +
  1262. '<span>' +
  1263. ' <div class="d-l-con">' +
  1264. ' <div class="d-l-l-text">' +
  1265. ' <h4>经纬度:' + res.data.visuForestCloudCameraBOList[i].longitude +
  1266. ',' + res.data.visuForestCloudCameraBOList[i].latitude + '</h4>' +
  1267. ' </div>' +
  1268. ' </div>' +
  1269. ' </span>' +
  1270. '<span>' +
  1271. ' <div class="d-l-con">' +
  1272. ' <div class="d-l-l-text">' +
  1273. ' <h4>摄像头名称:' + res.data.visuForestCloudCameraBOList[i]
  1274. .cameraName + '</h4>' +
  1275. ' </div>' +
  1276. ' </div>' +
  1277. ' </span>' +
  1278. '<span>' +
  1279. ' <div class="d-l-con">' +
  1280. ' <div class="d-l-l-text">' +
  1281. ' <h4>网络运营商:' + (res.data.visuForestCloudCameraBOList[i].operatorType ==
  1282. "1" ?
  1283. "联通" : (res.data.visuForestCloudCameraBOList[i].operatorType == "2" ? "移动" : "电信")) +
  1284. '</h4>' +
  1285. ' </div>' +
  1286. ' </div>' +
  1287. ' </span>' +
  1288. '<span>' +
  1289. ' <div class="d-l-con">' +
  1290. ' <div class="d-l-l-text">' +
  1291. ' <h4>摄像头半径:' + res.data.visuForestCloudCameraBOList[i]
  1292. .cameraRadius + '米</h4>' +
  1293. ' </div>' +
  1294. ' </div>' +
  1295. ' </span>' +
  1296. '</div>'
  1297. this.cameraMarkersList.push(markersMap)
  1298. // cameraAccount: "1"
  1299. // cameraCode: "1000010"
  1300. // cameraFactory: "2"
  1301. // cameraIp: "1"
  1302. // cameraName: "2"
  1303. // cameraPasword: "2"
  1304. // cameraPort: 2
  1305. // cameraRadius: 20
  1306. // cameraRegion: "3"
  1307. // dataDeptId: null
  1308. // dataStatus: null
  1309. // eventType: null
  1310. // height: "11"
  1311. // id: "0d165fc362514f79b12a899ea66295fd"
  1312. // latitude: "49.325625"
  1313. // longitude: "125.3333"
  1314. }
  1315. setTimeout(() => {
  1316. that.$refs.supermap.clearM();
  1317. that.$refs.supermap.clearMRadius()
  1318. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  1319. }, 3000)
  1320. } else {
  1321. setTimeout(() => {
  1322. that.$refs.supermap.clearM();
  1323. that.$refs.supermap.clearMRadius()
  1324. }, 1000)
  1325. }
  1326. })
  1327. },
  1328. dropLocation(lat, lng, index) {
  1329. this.listCurrentIndex2 = index
  1330. this.$refs.supermap.dropLocation(lat, lng, 15)
  1331. },
  1332. selectCameraByDeptId(depId) {
  1333. this.listCurrentIndex1 = depId
  1334. let that = this
  1335. that.cameraMarkersList = []
  1336. that.visuForestCloudCameraBOList = []
  1337. selectCameraByDeptId(depId).then(res => {
  1338. //根据设备类型查看列表
  1339. that.visuForestCloudCameraBOList = res.data
  1340. that.visuForestCloudCameraBOListSearch = res.data
  1341. if (res.data != null && res.data.length > 0) {
  1342. for (let i = 0; i < res.data.length; i++) {
  1343. let markersMap = {
  1344. lng: 124.59,
  1345. lat: 43.02,
  1346. icon: 'camera',
  1347. bindPopupHtml: '',
  1348. click: 'preview',
  1349. parameter: '',
  1350. name: i,
  1351. keepBindPopup: false,
  1352. isAggregation: false
  1353. }
  1354. if (res.data[i].channelCode != null) {
  1355. markersMap.parameter = {
  1356. code: res.data[i].cameraCode,
  1357. name: res.data[i].cameraName,
  1358. type: res.data[i].cameraFactory
  1359. }
  1360. } else {
  1361. markersMap.parameter = []
  1362. }
  1363. markersMap.lng = res.data[i].longitude
  1364. markersMap.lat = res.data[i].latitude
  1365. markersMap.radius = res.data[i].cameraRadius
  1366. markersMap.bindPopupHtml = '<div class="map-tip">' +
  1367. '<span>' +
  1368. ' <div class="d-l-con">' +
  1369. ' <div class="d-l-l-text">' +
  1370. ' <h4>经纬度:' + res.data[i].longitude + ',' + res.data[i].latitude +
  1371. '</h4>' +
  1372. ' </div>' +
  1373. ' </div>' +
  1374. ' </span>' +
  1375. '<span>' +
  1376. ' <div class="d-l-con">' +
  1377. ' <div class="d-l-l-text">' +
  1378. ' <h4>摄像头名称:' + res.data[i].cameraName + '</h4>' +
  1379. ' </div>' +
  1380. ' </div>' +
  1381. ' </span>' +
  1382. '<span>' +
  1383. ' <div class="d-l-con">' +
  1384. ' <div class="d-l-l-text">' +
  1385. ' <h4>网络运营商:' + (res.data[i].operatorType == "1" ? "联通" : (res.data[i]
  1386. .operatorType == "2" ? "移动" : "电信")) + '</h4>' +
  1387. ' </div>' +
  1388. ' </div>' +
  1389. ' </span>' +
  1390. '<span>' +
  1391. ' <div class="d-l-con">' +
  1392. ' <div class="d-l-l-text">' +
  1393. ' <h4>摄像头半径:' + res.data[i]
  1394. .cameraRadius + '米</h4>' +
  1395. ' </div>' +
  1396. ' </div>' +
  1397. ' </span>' +
  1398. '</div>'
  1399. this.cameraMarkersList.push(markersMap)
  1400. }
  1401. setTimeout(() => {
  1402. that.$refs.supermap.clearMRadius()
  1403. that.$refs.supermap.clearM();
  1404. that.$refs.supermap.setMarkersRadius(this.cameraMarkersList)
  1405. }, 3000)
  1406. } else {
  1407. setTimeout(() => {
  1408. that.$refs.supermap.clearM();
  1409. that.$refs.supermap.clearMRadius()
  1410. }, 1000)
  1411. }
  1412. })
  1413. },
  1414. //吉祥物收起左右框
  1415. indent() {
  1416. let list = document.getElementsByClassName('el-tooltip__popper')
  1417. list[list.length - 1].style.display = 'none'
  1418. if (this.indentStyle == '') {
  1419. this.indentStyle = 'indent-style'
  1420. this.indentleft = 'indent-left'
  1421. this.indentright = 'indent-right'
  1422. this.indentText = '展开左右栏'
  1423. } else if (this.indentText == '展开左右栏') {
  1424. this.indentStyle = ''
  1425. this.indentleft = ''
  1426. this.indentright = ''
  1427. this.indentText = '收起左右栏'
  1428. }
  1429. },
  1430. /** ----------------------------------摄像头预览开始------------------------------------- */
  1431. alertLogin: function() {
  1432. this.$modal.msg('登录中....')
  1433. },
  1434. alertLoginSuccess: function() {
  1435. this.$modal.msgSuccess('登录成功!')
  1436. },
  1437. alertLoginFailed: function() {
  1438. this.$modal.msgError('登陆失败!')
  1439. },
  1440. alertReinstall: function() {
  1441. this.$modal.msgWarning('请重新安装客户端')
  1442. },
  1443. cancelEventLocationShow() {
  1444. if (this.oWebControl != null) {
  1445. this.oWebControl.JS_HideWnd() // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题
  1446. this.oWebControl.JS_Disconnect().then(function() { // 断开与插件服务连接成功
  1447. },
  1448. function() { // 断开与插件服务连接失败
  1449. })
  1450. }
  1451. },
  1452. /** 预览按钮操作 */
  1453. preview(cameraParam) {
  1454. this.showTVWall(cameraParam.code, cameraParam.name);
  1455. },
  1456. /** 预览按钮操作 */
  1457. preview_废弃(cameraParam) {
  1458. if (cameraParam.type == '1') {
  1459. getDahuaVideoServer().then(newResponse => {
  1460. console.log(newResponse)
  1461. this.ws.detectConnectQt().then(res => {
  1462. if (res) { // 连接客户端成功
  1463. this.alertLogin()
  1464. this.ws.login({
  1465. loginIp: newResponse.loginIp,
  1466. loginPort: newResponse.loginPort,
  1467. userName: newResponse.userName,
  1468. userPwd: newResponse.userPwd,
  1469. token: '',
  1470. https: 1
  1471. })
  1472. this.ws.on('loginState', (res) => {
  1473. this.isLogin = res
  1474. console.log('---res-----', res)
  1475. if (res) {
  1476. this.alertLoginSuccess()
  1477. this.activePanel = 'key2'
  1478. this.realTimeVideoDialog(cameraParam.code)
  1479. } else {
  1480. this.alertLoginFailed()
  1481. }
  1482. })
  1483. } else { // 连接客户端失败
  1484. this.alertReinstall()
  1485. }
  1486. })
  1487. })
  1488. } else if (cameraParam.type == '0') {
  1489. let that = this
  1490. that.cameraVisible = true
  1491. getHaiKangVideoServer({
  1492. cameraCode: cameraParam.code
  1493. }).then(newResponse => {
  1494. that.cameraTitle = '摄像头-' + newResponse.data.cameraName
  1495. that.initPlugin(newResponse.data.appkey, newResponse.data.loginIp, newResponse.data.secret,
  1496. newResponse
  1497. .data.loginPort)
  1498. setTimeout(function() {
  1499. that.playhk(newResponse.data.channelCode)
  1500. }, 5000)
  1501. })
  1502. }
  1503. },
  1504. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  1505. if (!this.isLogin) {
  1506. this.$Message.info('正在登陆客户端,请稍等......')
  1507. return false
  1508. }
  1509. const params = [cameraParams];
  1510. this.ws.openVideo(params)
  1511. },
  1512. /** ----------------------------------摄像头预览结束------------------------------------- */
  1513. /** ----------------------------------海康摄像头预览开始------------------------------------- */
  1514. // 创建播放实例
  1515. initPlugin(newappkey, newloginIp, newsecret, newloginPort) {
  1516. let that = this
  1517. that.oWebControl = new WebControl({
  1518. szPluginContainer: 'playWnd', // 指定容器id
  1519. iServicePortStart: 15900, // 指定起止端口号,建议使用该值
  1520. iServicePortEnd: 15909,
  1521. szClassId: '23BF3B0A-2C56-4D97-9C03-0CB103AA8F11', // 用于IE10使用ActiveX的clsid
  1522. cbConnectSuccess: function() { // 创建WebControl实例成功
  1523. that.oWebControl.JS_StartService('window', { // WebControl实例创建成功后需要启动服务
  1524. dllPath: './VideoPluginConnect.dll' // 值"./VideoPluginConnect.dll"写死
  1525. }).then(function() { // 启动插件服务成功
  1526. that.oWebControl.JS_SetWindowControlCallback({ // 设置消息回调
  1527. cbIntegrationCallBack: cbIntegrationCallBack
  1528. })
  1529. that.oWebControl.JS_CreateWnd('playWnd', 1020, 600).then(
  1530. function() { //JS_CreateWnd创建视频播放窗口,宽高可设定
  1531. that.init(newappkey, newloginIp, newsecret, newloginPort) // 创建播放实例成功后初始化
  1532. })
  1533. }, function() { // 启动插件服务失败
  1534. })
  1535. },
  1536. cbConnectError: function() { // 创建WebControl实例失败
  1537. that.oWebControl = null
  1538. $('#playWnd').html('插件未启动,正在尝试启动,请稍候...<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  1539. WebControl.JS_WakeUp('VideoWebPlugin://') // 程序未启动时执行error函数,采用wakeup来启动程序
  1540. initCount++
  1541. if (initCount < 3) {
  1542. setTimeout(function() {
  1543. that.initPlugin(newappkey, newloginIp, newsecret, newloginPort)
  1544. }, 3000)
  1545. } else {
  1546. $('#playWnd').html('插件启动失败,请检查插件是否安装!<a href="./hk/VideoWebPlugin.exe">点击下载插件</a>')
  1547. }
  1548. },
  1549. cbConnectClose: function(bNormalClose) {
  1550. // 异常断开:bNormalClose = false
  1551. // JS_Disconnect正常断开:bNormalClose = true
  1552. console.log('cbConnectClose')
  1553. that.oWebControl = null
  1554. }
  1555. })
  1556. },
  1557. //播放海康摄像头
  1558. playhk(channelCode) {
  1559. var cameraIndexCode = channelCode //获取输入的监控点编号值,必填
  1560. var streamMode = 0 //主子码流标识:0-主码流,1-子码流
  1561. var transMode = 1 //传输协议:0-UDP,1-TCP
  1562. var gpuMode = 0 //是否启用GPU硬解,0-不启用,1-启用
  1563. var wndId = -1 //播放窗口序号(在2x2以上布局下可指定播放窗口)
  1564. cameraIndexCode = cameraIndexCode.replace(/(^\s*)/g, '')
  1565. cameraIndexCode = cameraIndexCode.replace(/(\s*$)/g, '')
  1566. this.oWebControl.JS_RequestInterface({
  1567. funcName: 'startPreview',
  1568. argument: JSON.stringify({
  1569. cameraIndexCode: cameraIndexCode, //监控点编号
  1570. streamMode: streamMode, //主子码流标识
  1571. transMode: transMode, //传输协议
  1572. gpuMode: gpuMode, //是否开启GPU硬解
  1573. wndId: wndId //可指定播放窗口
  1574. })
  1575. })
  1576. },
  1577. //初始化
  1578. init(newappkey, newloginIp, newsecret, newloginPort) {
  1579. let that = this
  1580. that.getPubKey(function() {
  1581. ////////////////////////////////// 请自行修改以下变量值 ////////////////////////////////////
  1582. var appkey = newappkey //综合安防管理平台提供的appkey,必填
  1583. var secret = that.setEncrypt(newsecret) //综合安防管理平台提供的secret,必填
  1584. var ip = newloginIp //综合安防管理平台IP地址,必填
  1585. var playMode = 0 //初始播放模式:0-预览,1-回放
  1586. var port = Number(newloginPort) //综合安防管理平台端口,若启用HTTPS协议,默认443
  1587. var snapDir = 'D:\\SnapDir' //抓图存储路径
  1588. var videoDir = 'D:\\VideoDir' //紧急录像或录像剪辑存储路径
  1589. var layout = '1x1' //playMode指定模式的布局
  1590. var enableHTTPS = 1 //是否启用HTTPS协议与综合安防管理平台交互,这里总是填1
  1591. var encryptedFields = 'secret' //加密字段,默认加密领域为secret
  1592. var showToolbar = 1 //是否显示工具栏,0-不显示,非0-显示
  1593. var showSmart = 1 //是否显示智能信息(如配置移动侦测后画面上的线框),0-不显示,非0-显示
  1594. var buttonIDs = '0,16,256,257,258,259,260,512,513,514,515,516,517,768,769' //自定义工具条按钮
  1595. ////////////////////////////////// 请自行修改以上变量值 ////////////////////////////////////
  1596. that.oWebControl.JS_RequestInterface({
  1597. funcName: 'init',
  1598. argument: JSON.stringify({
  1599. appkey: appkey, //API网关提供的appkey
  1600. secret: secret, //API网关提供的secret
  1601. ip: ip, //API网关IP地址
  1602. playMode: playMode, //播放模式(决定显示预览还是回放界面)
  1603. port: port, //端口
  1604. snapDir: snapDir, //抓图存储路径
  1605. videoDir: videoDir, //紧急录像或录像剪辑存储路径
  1606. layout: layout, //布局
  1607. enableHTTPS: enableHTTPS, //是否启用HTTPS协议
  1608. encryptedFields: encryptedFields, //加密字段
  1609. showToolbar: showToolbar, //是否显示工具栏
  1610. showSmart: showSmart, //是否显示智能信息
  1611. buttonIDs: buttonIDs //自定义工具条按钮
  1612. })
  1613. }).then(function(oData) {
  1614. that.oWebControl.JS_Resize(1020, 600) // 初始化后resize一次,规避firefox下首次显示窗口后插件窗口未与DIV窗口重合问题
  1615. })
  1616. })
  1617. },
  1618. //获取公钥
  1619. getPubKey(callback) {
  1620. let that = this
  1621. that.oWebControl.JS_RequestInterface({
  1622. funcName: 'getRSAPubKey',
  1623. argument: JSON.stringify({
  1624. keyLength: 1024
  1625. })
  1626. }).then(function(oData) {
  1627. console.log(oData)
  1628. if (oData.responseMsg.data) {
  1629. that.pubKey = oData.responseMsg.data
  1630. callback()
  1631. }
  1632. })
  1633. },
  1634. //RSA加密
  1635. setEncrypt(value) {
  1636. var encrypt = new JSEncrypt()
  1637. encrypt.setPublicKey(this.pubKey)
  1638. return encrypt.encrypt(value)
  1639. },
  1640. /** ----------------------------------海康摄像头预览结束------------------------------------- */
  1641. }
  1642. }
  1643. // 推送消息
  1644. function cbIntegrationCallBack(oData) {
  1645. console.log(JSON.stringify(oData.responseMsg))
  1646. }
  1647. </script>
  1648. <style rel="stylesheet/scss" lang="scss" scoped>
  1649. @import '@/assets/styles/base.scss';
  1650. .playWnd {
  1651. margin: 4px 0 0 8px;
  1652. width: 1020px;
  1653. /*播放容器的宽和高设定*/
  1654. height: 600px;
  1655. border: 1px solid red;
  1656. }
  1657. </style>