monitor.vue 72 KB

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