afforestation.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <!--植树造林-->
  2. <template>
  3. <div class="visual-con">
  4. <!--头部-->
  5. <vheader></vheader>
  6. <!--主体-->
  7. <div class="visual-body">
  8. <!-- 左侧 -->
  9. <div class="leftbar" :class="indentleft" ref="left">
  10. <div class="forthis">
  11. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  12. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  13. <div class="this-title" style="margin: 1rem 0; padding-right:1rem">
  14. <el-date-picker v-model="pickYear" @change="getInit()" type="year" placeholder="选择年">
  15. </el-date-picker>
  16. </div>
  17. <div class="i-list-con h-19">
  18. <div class="d-l-con" v-if="afforestationList!=null&&afforestationList.length>0" :class="{on:listCurrentIndex1 == item.id}" v-for="(item,index) in afforestationList"
  19. @click="getAfforestationArea(item.id)">
  20. <div class="d-l-l-text">
  21. <i class="i-small"></i>
  22. <h4>{{ item.planName }}</h4>
  23. </div>
  24. </div>
  25. </div>
  26. </dv-border-box-13>
  27. </div>
  28. <div class="forthis">
  29. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  30. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  31. <div class="i-list-con h-51">
  32. <div class="d-l-con" :class="{on:listCurrentIndex2 == item.points}"
  33. v-for="(item,index) in AfforestationAreaList" @click="setGraphicsList(item.points)">
  34. <div class="d-l-l-text">
  35. <i class="i-small"></i>
  36. <h4>区域{{ index + 1 }}</h4>
  37. </div>
  38. </div>
  39. </div>
  40. </dv-border-box-13>
  41. </div>
  42. </div>
  43. <!-- 地图 -->
  44. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'disasterMap'" class="indexSupermapClass"
  45. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>
  46. <!--底部 -->
  47. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  48. </div>
  49. <eventLocation ref="eventLocation"></eventLocation>
  50. <TVWall ref="TVWall"></TVWall>
  51. </div>
  52. </template>
  53. <script>
  54. import {
  55. getAfforestation, getAfforestationArea
  56. } from '@/api/afforestation'
  57. /** ----------------------------------摄像头预览开始------------------------------------- */
  58. import {
  59. getDahuaVideoServer
  60. } from '@/api/dahua/dahua'
  61. import DHWs from '@/dahua/lib/DHWs'
  62. /** ----------------------------------摄像头预览结束------------------------------------- */
  63. import supermap from '@/components/supermap' //超图
  64. import vheader from '@/components/v-header.vue' //一体化共用头部
  65. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  66. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  67. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  68. let echarts = require('echarts')
  69. export default {
  70. dicts: ['event_source'],
  71. components: {
  72. supermap,
  73. vheader,
  74. vBottomMenu,
  75. eventLocation,
  76. TVWall
  77. },
  78. created() {
  79. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  80. window.showDialog = this.showDialog
  81. window.choseLayerSwitching = this.choseLayerSwitching
  82. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  83. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  84. },
  85. mounted() {
  86. this.getInit()
  87. },
  88. data() {
  89. return {
  90. listCurrentIndex1: '1',
  91. listCurrentIndex2: '2',
  92. pickYear: new Date(), //选择年份
  93. afforestationList: [],
  94. AfforestationAreaList: [],
  95. graphicsList: [],//地图区域
  96. //左右缩进
  97. indentStyle: '',
  98. indentleft: '',
  99. indentright: '',
  100. indentText: '收起左右栏',
  101. indentdisabled: false
  102. }
  103. },
  104. methods: {
  105. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  106. showDialog(click) {
  107. if (click == 'eventLocation') {
  108. this.$refs.eventLocation.showEventLocation()
  109. this.$refs.supermap.isEditableLayers = false
  110. this.$refs.bottomMenu.showChild = false
  111. this.$refs.bottomMenu.showBanChild = false
  112. this.$refs.bottomMenu.showChangChild = false
  113. } else if (click == 'editableLayers') {
  114. this.$refs.bottomMenu.showChild = false
  115. this.$refs.bottomMenu.showBanChild = false
  116. this.$refs.bottomMenu.showChangChild = false
  117. if (!this.$refs.supermap.isEditableLayers) {
  118. this.$refs.supermap.isEditableLayers = true
  119. } else {
  120. this.$refs.supermap.isEditableLayers = false
  121. }
  122. } else if (click == 'layerSwitching') {
  123. this.$refs.supermap.isEditableLayers = false
  124. this.$refs.bottomMenu.showBanChild = false
  125. this.$refs.bottomMenu.showChangChild = false
  126. if (!this.$refs.bottomMenu.showChild) {
  127. this.$refs.bottomMenu.showChild = true
  128. } else {
  129. this.$refs.bottomMenu.showChild = false
  130. }
  131. } else if (click == 'TVWall') {
  132. this.$refs.TVWall.showTVWall()
  133. this.$refs.supermap.isEditableLayers = false
  134. this.$refs.bottomMenu.showChild = false
  135. this.$refs.bottomMenu.showBanChild = false
  136. this.$refs.bottomMenu.showChangChild = false
  137. } else if (click == 'forestban') {
  138. this.$refs.supermap.isEditableLayers = false
  139. this.$refs.bottomMenu.showChild = false
  140. this.$refs.bottomMenu.showChangChild = false
  141. if (!this.$refs.bottomMenu.showBanChild) {
  142. this.$refs.bottomMenu.showBanChild = true
  143. } else {
  144. this.$refs.bottomMenu.showBanChild = false
  145. }
  146. } else if (click == 'forestchang') {
  147. this.$refs.supermap.isEditableLayers = false
  148. this.$refs.bottomMenu.showBanChild = false
  149. this.$refs.bottomMenu.showChild = false
  150. if (!this.$refs.bottomMenu.showChangChild) {
  151. this.$refs.bottomMenu.showChangChild = true
  152. } else {
  153. this.$refs.bottomMenu.showChangChild = false
  154. }
  155. }
  156. },
  157. //选择图层
  158. choseLayerSwitching(url, isClear) {
  159. this.$refs.supermap.layerSwitching(url, isClear)
  160. },
  161. //选择图层(传递数组)
  162. choseLayerSwitchingList(urlList) {
  163. this.$refs.supermap.layerSwitchingList(urlList)
  164. },
  165. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  166. getInit() {
  167. this.listCurrentIndex1 = '1'
  168. this.listCurrentIndex2 = '2'
  169. let that = this
  170. this.afforestationList = []
  171. this.AfforestationAreaList = []
  172. //获取左侧菜单列表
  173. getAfforestation(this.pickYear.getYear() + 1900).then(res => {
  174. this.afforestationList = res.data
  175. setTimeout(() => {
  176. this.$refs.supermap.clearG()
  177. }, 1000)
  178. })
  179. },
  180. getAfforestationArea(afforestationId) {
  181. this.listCurrentIndex1 = afforestationId
  182. let that = this
  183. //获取左侧菜单列表
  184. getAfforestationArea(afforestationId).then(res => {
  185. this.AfforestationAreaList = res.data
  186. })
  187. },
  188. setGraphicsList(points) {
  189. this.listCurrentIndex2 = points
  190. this.graphicsList = []
  191. if (points != null && points != '') {
  192. this.graphicsList = JSON.parse(points)
  193. this.$refs.supermap.clearG()
  194. this.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  195. } else {
  196. this.$refs.supermap.clearG()
  197. }
  198. },
  199. //吉祥物收起左右框
  200. indent() {
  201. let list = document.getElementsByClassName('el-tooltip__popper')
  202. list[list.length - 1].style.display = 'none'
  203. if (this.indentStyle == '') {
  204. this.indentStyle = 'indent-style'
  205. this.indentleft = 'indent-left'
  206. this.indentright = 'indent-right'
  207. this.indentText = '展开左右栏'
  208. } else if (this.indentText == '展开左右栏') {
  209. this.indentStyle = ''
  210. this.indentleft = ''
  211. this.indentright = ''
  212. this.indentText = '收起左右栏'
  213. }
  214. },
  215. dropLocation(lat, lng) {
  216. this.$refs.supermap.dropLocation(lat, lng)
  217. },
  218. /** ----------------------------------摄像头预览开始------------------------------------- */
  219. alertLogin: function() {
  220. this.$modal.msg('登录中....')
  221. },
  222. alertLoginSuccess: function() {
  223. this.$modal.msgSuccess('登录成功!')
  224. },
  225. alertLoginFailed: function() {
  226. this.$modal.msgError('登陆失败!')
  227. },
  228. alertReinstall: function() {
  229. this.$modal.msgWarning('请重新安装客户端')
  230. },
  231. /** 预览按钮操作 */
  232. preview(channelCode) {
  233. getDahuaVideoServer().then(newResponse => {
  234. this.ws.detectConnectQt().then(res => {
  235. if (res) { // 连接客户端成功
  236. this.alertLogin()
  237. this.ws.login({
  238. loginIp: newResponse.loginIp,
  239. loginPort: newResponse.loginPort,
  240. userName: newResponse.userName,
  241. userPwd: newResponse.userPwd,
  242. token: '',
  243. https: 1
  244. })
  245. this.ws.on('loginState', (res) => {
  246. this.isLogin = res
  247. console.log('---res-----', res)
  248. if (res) {
  249. this.alertLoginSuccess()
  250. this.activePanel = 'key2'
  251. this.realTimeVideoDialog(channelCode)
  252. } else {
  253. this.alertLoginFailed()
  254. }
  255. })
  256. } else { // 连接客户端失败
  257. this.alertReinstall()
  258. }
  259. })
  260. })
  261. },
  262. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  263. if (!this.isLogin) {
  264. this.$Message.info('正在登陆客户端,请稍等......')
  265. return false
  266. }
  267. this.ws.openVideo(cameraParams)
  268. }
  269. /** ----------------------------------摄像头预览结束------------------------------------- */
  270. }
  271. }
  272. </script>
  273. <style lang="scss" scoped>
  274. @import '@/assets/styles/base.scss';
  275. .el-table__header {
  276. width: auto !important;
  277. }
  278. .d-dialog-con {
  279. position: absolute;
  280. left: -19rem;
  281. top: 0;
  282. }
  283. </style>