forest.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <!--可视化公共模板 林业-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar" ref="left">
  10. <!-- 3 组织机构 -->
  11. <div class="forthis">
  12. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  13. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  14. <div class="i-list-con h-80" style="padding-left: 1rem;">
  15. <el-collapse accordion>
  16. <el-collapse-item v-for="(item,index) in villageTypeXlList" :key="index">
  17. <!-- deptId -->
  18. <template slot="title">
  19. <div class="d-l-con sj-collapse" :class="{on:listCurrentIndex1==item.deptId}"
  20. v-on:click="selectCameraByDeptId(item.deptId)">
  21. <div class="d-l-l-text">
  22. <h4 class="collapse-title">{{ item.deptName }}</h4>
  23. </div>
  24. <div class="d-l-l-count">{{ item.eventCount }}</div>
  25. </div>
  26. </template>
  27. </el-collapse-item>
  28. </el-collapse>
  29. <div class="i-list-con small-bottom-margin h-30">
  30. </div>
  31. </div>
  32. </dv-border-box-13>
  33. </div>
  34. </div>
  35. <!-- 地图 -->
  36. <supermap ref="supermap" style="width: 100%;height: 100vh;" class="indexSupermapClass" :mapDiv="'forestMap'"
  37. :dynamicPlotting="false"
  38. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"
  39. @showEventDialog="showEventDialog"/>
  40. <!-- 右侧 -->
  41. <div class="rightbar rightbar-index" ref="right">
  42. <div class="right-item1">
  43. </div>
  44. <div class="right-item2">
  45. <!-- 日历 -->
  46. <div class="forthis">
  47. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  48. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  49. <div class="i-list-con small-bottom-margin h-30">
  50. <dateChoose @selectDay="selectDay"></dateChoose>
  51. </div>
  52. </dv-border-box-13>
  53. </div>
  54. <!-- 事件列表 -->
  55. <div class="forthis">
  56. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  57. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  58. <div class="this-title">
  59. <span>事件列表</span>
  60. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  61. </div>
  62. <div class="i-list-con small-bottom-margin h-44">
  63. <div class="event-list-search">
  64. <el-input
  65. placeholder="请输入内容"
  66. prefix-icon="el-icon-search"
  67. v-model="eventSearch" @change="searchEvent(eventSearch)">
  68. </el-input>
  69. </div>
  70. <div class="d-l-con padding-box nowrap" v-for="(item,index) in eventList"
  71. @click="dropLocation(item.latitude,item.longitude)">
  72. <div class="bgt-img">
  73. <img v-if="item.picturePath!=null&&item.picturePath!=''&& isAssetTypeAnImage(item.picturePath)"
  74. :src="item.picturePath"
  75. style="width: 93px;height: 64px"/>
  76. <img v-else src="../assets/images/integrated/event-img-sub.png" style="width: 93px;height: 64px"/>
  77. </div>
  78. <div class="bgt-info">
  79. <div v-if="item.eventStatusValue=='forest_event_status_1'&&item.urgeCount==0"
  80. class="event-state-sb">
  81. <i class="el-icon-caret-left"></i>
  82. <div class="event-list-state-sb">
  83. 新上报
  84. </div>
  85. </div>
  86. <div v-if="item.eventStatusValue=='forest_event_status_1'&&item.urgeCount>0" class="event-state-cb">
  87. <i class="el-icon-caret-left"></i>
  88. <div class="event-list-state-cb">
  89. 催办
  90. </div>
  91. </div>
  92. <div v-if="item.eventStatusValue=='forest_event_status_2'" class="event-state-qs">
  93. <i class="el-icon-caret-left"></i>
  94. <div class="event-list-state-qs">
  95. 签收
  96. </div>
  97. </div>
  98. <div v-if="item.eventStatusValue=='forest_event_status_3'" class="event-state-wb">
  99. <i class="el-icon-caret-left"></i>
  100. <div class="event-list-state-wb">
  101. 误报
  102. </div>
  103. </div>
  104. <div v-if="item.eventStatusValue=='forest_event_status_4'" class="event-state-cf">
  105. <i class="el-icon-caret-left"></i>
  106. <div class="event-list-state-cf">
  107. 重复
  108. </div>
  109. </div>
  110. <div v-if="item.eventStatusValue=='forest_event_status_5'" class="event-state-bj">
  111. <i class="el-icon-caret-left"></i>
  112. <div class="event-list-state-bj">
  113. 办结
  114. </div>
  115. </div>
  116. <div v-if="item.eventStatusValue=='forest_event_status_6'" class="event-state-gd">
  117. <i class="el-icon-caret-left"></i>
  118. <div class="event-list-state-gd">
  119. 归档
  120. </div>
  121. </div>
  122. <div class="bgt-info-name">{{ item.reportor }} {{ item.eventName }}</div>
  123. <div class="bgt-info-place">
  124. <ul>
  125. <li>{{ item.reportTime }}</li>
  126. </ul>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </dv-border-box-13>
  132. </div>
  133. </div>
  134. </div>
  135. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  136. </div>
  137. <eventdetailsdialog ref="eventdetailsdialog" :calendarDay="calendarDay" @getEventList="getEventList" ></eventdetailsdialog>
  138. <eventLocation ref="eventLocation"></eventLocation>
  139. <TVWall ref="TVWall"></TVWall>
  140. </div>
  141. </template>
  142. <script>
  143. import dateChoose from '@/views/date.vue'//日历
  144. /** ----------------------------------weosocket开始------------------------------------- */
  145. import Cookies from 'js-cookie'
  146. /** ----------------------------------weosocket结束------------------------------------- */
  147. import {
  148. getDeptEventCount,
  149. getEventList,
  150. } from '@/api/forest'
  151. import {
  152. selectVillageTypeXl,
  153. } from '@/api/village'
  154. import supermap from '@/components/supermap' //超图
  155. import supermapNotProcessed from '@/components/supermap' //超图
  156. import supermapProcessed from '@/components/supermap' //超图
  157. import vheader from '@/components/v-header.vue' //一体化共用头部
  158. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  159. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  160. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  161. import eventdetailsdialog from '@/views/eventdetailsdialog.vue' //事件详情弹窗
  162. /** ----------------------------------摄像头预览开始------------------------------------- */
  163. import {
  164. getDahuaVideoServer
  165. } from '@/api/dahua/dahua'
  166. import DHWs from '@/dahua/lib/DHWs'
  167. /** ----------------------------------摄像头预览结束------------------------------------- */
  168. let echarts = require('echarts')
  169. export default {
  170. components: {
  171. supermap,
  172. supermapNotProcessed,
  173. supermapProcessed,
  174. vheader,
  175. vBottomMenu,
  176. eventLocation,
  177. TVWall,
  178. dateChoose,
  179. eventdetailsdialog
  180. },
  181. created() {
  182. /** ----------------------------------摄像头预览开始------------------------------------- */
  183. const DHWsInstance = DHWs.getInstance()
  184. this.ws = DHWsInstance
  185. /** ----------------------------------摄像头预览结束------------------------------------- */
  186. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  187. window.showDialog = this.showDialog
  188. window.choseLayerSwitching = this.choseLayerSwitching
  189. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  190. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  191. },
  192. mounted() {
  193. this.selectVillageTypeXl(this.getCurrentDataStr())
  194. this.getEventList(this.getCurrentDataStr())
  195. /** ----------------------------------weosocket开始------------------------------------- */
  196. // this.initWebSocket()
  197. /** ----------------------------------weosocket结束------------------------------------- */
  198. this.selectTaskList()//获取任务
  199. },
  200. data() {
  201. return {
  202. calendarDay: this.getCurrentDataStr(),
  203. //左侧部门事件数量
  204. villageTypeXlList: [],
  205. //右侧事件列表
  206. eventList: [],
  207. eventListnew: [],
  208. eventListAll: [],
  209. eventSearch: '',//事件列表搜索
  210. listCurrentIndex1: '',
  211. /** ----------------------------------weosocket开始------------------------------------- */
  212. weosocket: false,
  213. websock: '',
  214. setIntervalWesocketPush: null,
  215. /** ----------------------------------weosocket结束------------------------------------- */
  216. /** ----------------------------------摄像头预览开始------------------------------------- */
  217. activePanel: 'key1',
  218. isLogin: false,
  219. cameraParams: [],
  220. ws: null,
  221. /** ----------------------------------摄像头预览结束------------------------------------- */
  222. markersList: [], //点位列表
  223. cameraList: [] //摄像头列表
  224. }
  225. },
  226. /** ----------------------------------weosocket开始------------------------------------- */
  227. destroyed() { //离开页面关闭Socket连接
  228. if (this.websock) {
  229. clearInterval(this.setIntervalWesocketPush)
  230. this.websock.close()
  231. this.websock = null
  232. }
  233. },
  234. /** ----------------------------------weosocket结束------------------------------------- */
  235. methods: {
  236. searchEvent(eventSearch) {
  237. let that = this
  238. //事件列表搜索
  239. this.eventListnew = []
  240. if (eventSearch != null && eventSearch != '') {
  241. for (var i = 0; i < this.eventListAll.length; i++) {
  242. if (this.eventListAll[i].reportor.indexOf(eventSearch) > -1) {
  243. this.eventListnew.push(this.eventListAll[i])
  244. }
  245. }
  246. this.eventList = this.eventListnew
  247. } else {
  248. this.eventList = this.eventListAll
  249. }
  250. if (this.eventList != null && this.eventList.length > 0) {
  251. for (let i = 0; i < this.eventList.length; i++) {
  252. let markersMap = {
  253. lng: 124.59,
  254. lat: 43.02,
  255. icon: 'marker',
  256. bindPopupHtml: '',
  257. click: '',
  258. parameter: '',
  259. keepBindPopup: false,
  260. isAggregation: false
  261. }
  262. if (this.eventList.length > 200) {
  263. markersMap.isAggregation = true
  264. }
  265. if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount == 0) {
  266. markersMap.click = 'showEventDialog'
  267. markersMap.icon = 'sj-icon-map-xinshangbao'
  268. }
  269. if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount > 0) {
  270. markersMap.click = 'showEventDialog'
  271. markersMap.icon = 'sj-icon-map-cuiban'
  272. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_2') {
  273. markersMap.click = 'showEventDialog'
  274. markersMap.icon = 'sj-icon-map-qianshou'
  275. markersMap.isAggregation = false
  276. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_5') {
  277. markersMap.click = 'showEventDialog'
  278. markersMap.icon = 'sj-icon-map-banjie'
  279. markersMap.isAggregation = false
  280. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_6') {
  281. markersMap.click = 'showEventDialog'
  282. markersMap.icon = 'sj-icon-map-guidang'
  283. }
  284. markersMap.parameter = this.eventList[i].eventCode
  285. markersMap.lng = this.eventList[i].longitude
  286. markersMap.lat = this.eventList[i].latitude
  287. markersMap.bindPopupHtml = '<div class="map-tip">' +
  288. '<span>' +
  289. ' <div class="d-l-con">' +
  290. ' <div class="d-l-l-text">' +
  291. ' <h4>经纬度:' + this.eventList[i].longitude + ',' + this.eventList[i].latitude + '</h4>' +
  292. ' </div>' +
  293. ' </div>' +
  294. ' </span>' +
  295. '<span>' +
  296. ' <div class="d-l-con">' +
  297. ' <div class="d-l-l-text">' +
  298. ' <h4>事件名称:' + this.eventList[i].eventName + '</h4>' +
  299. ' </div>' +
  300. ' </div>' +
  301. ' </span>' +
  302. '<span>' +
  303. ' <div class="d-l-con">' +
  304. ' <div class="d-l-l-text">' +
  305. ' <h4>事件时间:' + this.eventList[i].reportTime + '</h4>' +
  306. ' </div>' +
  307. ' </div>' +
  308. ' </span>'
  309. if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != '' && this.isAssetTypeAnImage(this.eventList[i].picturePath)) {
  310. markersMap.bindPopupHtml += '<span>' +
  311. ' <div class="d-l-con">' +
  312. ' <div class="d-l-l-text">' +
  313. '<img src="' + this.eventList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  314. ' </div>' +
  315. ' </div>' +
  316. ' </span>'
  317. }
  318. markersMap.bindPopupHtml += '</div>'
  319. that.markersList.push(markersMap)
  320. }
  321. setTimeout(() => {
  322. that.$refs.supermap.clearM(false)
  323. that.$refs.supermap.clearM(true)
  324. that.$refs.supermap.setMarkers(that.markersList)
  325. }, 2000)
  326. } else {
  327. setTimeout(() => {
  328. that.$refs.supermap.clearM(false)
  329. that.$refs.supermap.clearM(true)
  330. }, 2000)
  331. }
  332. },
  333. dropLocation(lat, lng) {
  334. this.$refs.supermap.dropLocation(lat, lng)
  335. },
  336. showEventDialog(eventCode) {
  337. //事件信息弹出
  338. this.$refs.eventdetailsdialog.showEventDialog(eventCode)
  339. },
  340. getCurrentDataStr() {
  341. let date = new Date()
  342. let y = date.getFullYear()
  343. let m = date.getMonth() + 1
  344. m = m < 10 ? '0' + m : m
  345. let d = date.getDate()
  346. d = d < 10 ? '0' + d : d
  347. return y + '-' + m + '-' + d
  348. },
  349. selectDay(day) {//日历点击
  350. this.selectVillageTypeXl(day)
  351. this.getEventList(day)
  352. this.calendarDay = day
  353. },
  354. selectTaskList() {
  355. this.$refs.bottomMenu.selectTaskList()
  356. },
  357. selectVillageTypeXl(day) {
  358. let that = this
  359. //左侧获取事件部门数量
  360. selectVillageTypeXl({ day: day }).then(res => {
  361. this.villageTypeXlList = res.data
  362. })
  363. },
  364. getEventList(day) {
  365. let that = this
  366. this.eventList = []
  367. this.eventListAll = []
  368. //右侧获取事件列表
  369. getEventList({ day: day }).then(res => {
  370. this.eventList = res.data
  371. this.eventListAll = res.data
  372. that.markersList = []
  373. if (this.eventList != null && this.eventList.length > 0) {
  374. for (let i = 0; i < this.eventList.length; i++) {
  375. let markersMap = {
  376. lng: 124.59,
  377. lat: 43.02,
  378. icon: 'marker',
  379. bindPopupHtml: '',
  380. click: '',
  381. parameter: '',
  382. keepBindPopup: false,
  383. isAggregation: false
  384. }
  385. if (this.eventList.length > 200) {
  386. markersMap.isAggregation = true
  387. }
  388. if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount == 0) {
  389. markersMap.click = 'showEventDialog'
  390. markersMap.icon = 'sj-icon-map-xinshangbao'
  391. }
  392. if (this.eventList[i].eventStatusValue == 'forest_event_status_1' && this.eventList[i].urgeCount > 0) {
  393. markersMap.click = 'showEventDialog'
  394. markersMap.icon = 'sj-icon-map-cuiban'
  395. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_2') {
  396. markersMap.click = 'showEventDialog'
  397. markersMap.icon = 'sj-icon-map-qianshou'
  398. markersMap.isAggregation = false
  399. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_5') {
  400. markersMap.click = 'showEventDialog'
  401. markersMap.icon = 'sj-icon-map-banjie'
  402. markersMap.isAggregation = false
  403. } else if (this.eventList[i].eventStatusValue == 'forest_event_status_6') {
  404. markersMap.click = 'showEventDialog'
  405. markersMap.icon = 'sj-icon-map-guidang'
  406. }
  407. markersMap.parameter = this.eventList[i].eventCode
  408. markersMap.lng = this.eventList[i].longitude
  409. markersMap.lat = this.eventList[i].latitude
  410. markersMap.bindPopupHtml = '<div class="map-tip">' +
  411. '<span>' +
  412. ' <div class="d-l-con">' +
  413. ' <div class="d-l-l-text">' +
  414. ' <h4>经纬度:' + this.eventList[i].longitude + ',' + this.eventList[i].latitude + '</h4>' +
  415. ' </div>' +
  416. ' </div>' +
  417. ' </span>' +
  418. '<span>' +
  419. ' <div class="d-l-con">' +
  420. ' <div class="d-l-l-text">' +
  421. ' <h4>事件名称:' + this.eventList[i].eventName + '</h4>' +
  422. ' </div>' +
  423. ' </div>' +
  424. ' </span>' +
  425. '<span>' +
  426. ' <div class="d-l-con">' +
  427. ' <div class="d-l-l-text">' +
  428. ' <h4>事件时间:' + this.eventList[i].reportTime + '</h4>' +
  429. ' </div>' +
  430. ' </div>' +
  431. ' </span>'
  432. if (this.eventList[i].picturePath != null && this.eventList[i].picturePath != '' && this.isAssetTypeAnImage(this.eventList[i].picturePath)) {
  433. markersMap.bindPopupHtml += '<span>' +
  434. ' <div class="d-l-con">' +
  435. ' <div class="d-l-l-text">' +
  436. '<img src="' + this.eventList[i].picturePath + '" style="width: 150px;height: 100px"/>' +
  437. ' </div>' +
  438. ' </div>' +
  439. ' </span>'
  440. }
  441. markersMap.bindPopupHtml += '</div>'
  442. that.markersList.push(markersMap)
  443. }
  444. setTimeout(() => {
  445. that.$refs.supermap.clearM(false)
  446. that.$refs.supermap.clearM(true)
  447. that.$refs.supermap.setMarkers(that.markersList)
  448. }, 2000)
  449. } else {
  450. setTimeout(() => {
  451. that.$refs.supermap.clearM(false)
  452. that.$refs.supermap.clearM(true)
  453. }, 2000)
  454. }
  455. })
  456. },
  457. // 判断是否为图片
  458. isAssetTypeAnImage(filePath) {
  459. //获取最后一个.的位置
  460. var index = filePath.lastIndexOf('.')
  461. //获取后缀
  462. var ext = filePath.substr(index + 1)
  463. let aa = ['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext.toLowerCase()) !== -1
  464. return aa
  465. },
  466. /** ----------------------------------weosocket开始------------------------------------- */
  467. initWebSocket() { //初始化weosocket
  468. const wsuri = 'wss://www.hmzzxc.com:10012/websocket/forest-' + Cookies.get('username')
  469. this.websock = new WebSocket(wsuri)
  470. console.log('建立websocket连接')
  471. this.websock.onopen = this.websocketonopen
  472. this.websock.onmessage = this.websocketonmessage
  473. this.websock.onerror = this.websocketonerror
  474. this.websock.onclose = this.websocketclose
  475. this.websock.onclose = this.websocketclose
  476. },
  477. websocketonopen() { //连接建立之后执行send方法发送数据
  478. console.log('websocket连接成功')
  479. this.weosocket = true
  480. this.sendPing()
  481. },
  482. websocketonerror() { //连接建立失败重连
  483. this.initWebSocket()
  484. },
  485. websocketonmessage(e) { //数据接收
  486. console.log('接收数据', e.data)
  487. },
  488. websocketsend(Data) { //数据发送
  489. this.websock.send(Data)
  490. },
  491. websocketclose(e) { //关闭
  492. console.log('断开连接', e)
  493. // clearInterval(this.setIntervalWesocketPush)
  494. this.weosocket = false
  495. },
  496. /**发送心跳
  497. * @param {number} time 心跳间隔毫秒 默认5000
  498. * @param {string} ping 心跳名称 默认字符串ping
  499. */
  500. sendPing(time = 5000, ping = {
  501. 'fromId': 'forest',
  502. 'fromUserId': Cookies.get('username'),
  503. 'toUserId': Cookies.get('username')
  504. }) {
  505. clearInterval(this.setIntervalWesocketPush)
  506. this.websock.send(JSON.stringify(ping))
  507. this.setIntervalWesocketPush = setInterval(() => {
  508. if (this.weosocket) {
  509. this.websock.send(JSON.stringify(ping))
  510. } else {
  511. this.initWebSocket()
  512. }
  513. }, time)
  514. },
  515. /** ----------------------------------weosocket结束------------------------------------- */
  516. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  517. showDialog(click) {
  518. if (click == 'eventLocation') {
  519. this.$refs.eventLocation.showEventLocation()
  520. this.$refs.supermap.isEditableLayers = false
  521. this.$refs.bottomMenu.showChild = false
  522. this.$refs.bottomMenu.showBanChild = false
  523. this.$refs.bottomMenu.showChangChild = false
  524. } else if (click == 'editableLayers') {
  525. this.$refs.bottomMenu.showChild = false
  526. this.$refs.bottomMenu.showBanChild = false
  527. this.$refs.bottomMenu.showChangChild = false
  528. if (!this.$refs.supermap.isEditableLayers) {
  529. this.$refs.supermap.isEditableLayers = true
  530. } else {
  531. this.$refs.supermap.isEditableLayers = false
  532. }
  533. } else if (click == 'layerSwitching') {
  534. this.$refs.supermap.isEditableLayers = false
  535. this.$refs.bottomMenu.showBanChild = false
  536. this.$refs.bottomMenu.showChangChild = false
  537. if (!this.$refs.bottomMenu.showChild) {
  538. this.$refs.bottomMenu.showChild = true
  539. } else {
  540. this.$refs.bottomMenu.showChild = false
  541. }
  542. } else if (click == 'TVWall') {
  543. this.$refs.TVWall.showTVWall()
  544. this.$refs.supermap.isEditableLayers = false
  545. this.$refs.bottomMenu.showChild = false
  546. this.$refs.bottomMenu.showBanChild = false
  547. this.$refs.bottomMenu.showChangChild = false
  548. } else if (click == 'forestban') {
  549. this.$refs.supermap.isEditableLayers = false
  550. this.$refs.bottomMenu.showChild = false
  551. this.$refs.bottomMenu.showChangChild = false
  552. if (!this.$refs.bottomMenu.showBanChild) {
  553. this.$refs.bottomMenu.showBanChild = true
  554. } else {
  555. this.$refs.bottomMenu.showBanChild = false
  556. }
  557. } else if (click == 'forestchang') {
  558. this.$refs.supermap.isEditableLayers = false
  559. this.$refs.bottomMenu.showBanChild = false
  560. this.$refs.bottomMenu.showChild = false
  561. if (!this.$refs.bottomMenu.showChangChild) {
  562. this.$refs.bottomMenu.showChangChild = true
  563. } else {
  564. this.$refs.bottomMenu.showChangChild = false
  565. }
  566. }
  567. },
  568. //选择图层
  569. choseLayerSwitching(url, isClear) {
  570. this.$refs.supermap.layerSwitching(url, isClear)
  571. },
  572. //选择图层(传递数组)
  573. choseLayerSwitchingList(urlList) {
  574. this.$refs.supermap.layerSwitchingList(urlList)
  575. },
  576. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  577. /** ----------------------------------事件弹窗开始------------------------------------- */
  578. /** ----------------------------------事件弹窗结束------------------------------------- */
  579. /** ----------------------------------摄像头预览开始------------------------------------- */
  580. alertLogin: function() {
  581. this.$modal.msg('登录中....')
  582. },
  583. alertLoginSuccess: function() {
  584. this.$modal.msgSuccess('登录成功!')
  585. },
  586. alertLoginFailed: function() {
  587. this.$modal.msgError('登陆失败!')
  588. },
  589. alertReinstall: function() {
  590. this.$modal.msgWarning('请重新安装客户端')
  591. },
  592. /** 预览按钮操作 */
  593. preview(channelCode) {
  594. getDahuaVideoServer().then(newResponse => {
  595. this.ws.detectConnectQt().then(res => {
  596. if (res) { // 连接客户端成功
  597. this.alertLogin()
  598. this.ws.login({
  599. loginIp: newResponse.loginIp,
  600. loginPort: newResponse.loginPort,
  601. userName: newResponse.userName,
  602. userPwd: newResponse.userPwd,
  603. token: '',
  604. https: 1
  605. })
  606. this.ws.on('loginState', (res) => {
  607. this.isLogin = res
  608. if (res) {
  609. this.alertLoginSuccess()
  610. this.activePanel = 'key2'
  611. this.realTimeVideoDialog(channelCode)
  612. } else {
  613. this.alertLoginFailed()
  614. }
  615. })
  616. } else { // 连接客户端失败
  617. this.alertReinstall()
  618. }
  619. })
  620. })
  621. },
  622. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  623. if (!this.isLogin) {
  624. this.$Message.info('正在登陆客户端,请稍等......')
  625. return false
  626. }
  627. this.ws.openVideo(cameraParams)
  628. }
  629. /** ----------------------------------摄像头预览结束------------------------------------- */
  630. }
  631. }
  632. </script>
  633. <style rel="stylesheet/scss" lang="scss" scoped>
  634. @import '@/assets/styles/base.scss';
  635. </style>