monitor.vue 70 KB

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