monitor.vue 68 KB

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