monitor.vue 75 KB

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