monitor.vue 76 KB

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