monitor.vue 71 KB

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