afforestation.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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. <!-- 右侧 -->
  48. <div class="rightbar" :class="indentright" ref="right">
  49. <div class="forthis">
  50. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  51. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
  52. <div class="this-title">
  53. <span>植树任务</span>
  54. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
  55. </div>
  56. <div class="i-list-con h-73">
  57. <div class="overflow-y" style="height: 72vh">
  58. <div class="d-l-con"
  59. v-for="(item,index) in forestationTaskList"
  60. v-on:click="selectWorkCountById(item.points)">
  61. <div class="d-l-l-text">
  62. <i class="i-small"></i>
  63. <h4>{{ item.name }}</h4>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </dv-border-box-13>
  69. </div>
  70. </div>
  71. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  72. </div>
  73. <eventLocation ref="eventLocation"></eventLocation>
  74. <TVWall ref="TVWall"></TVWall>
  75. </div>
  76. </template>
  77. <script>
  78. import {
  79. getAfforestation, getAfforestationArea,listPublishTask,selectWorkCountById
  80. } from '@/api/afforestation'
  81. /** ----------------------------------摄像头预览开始------------------------------------- */
  82. import {
  83. getDahuaVideoServer
  84. } from '@/api/dahua/dahua'
  85. import DHWs from '@/dahua/lib/DHWs'
  86. /** ----------------------------------摄像头预览结束------------------------------------- */
  87. import supermap from '@/components/supermap' //超图
  88. import vheader from '@/components/v-header.vue' //一体化共用头部
  89. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  90. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  91. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  92. let echarts = require('echarts')
  93. export default {
  94. dicts: ['event_source'],
  95. components: {
  96. supermap,
  97. vheader,
  98. vBottomMenu,
  99. eventLocation,
  100. TVWall
  101. },
  102. created() {
  103. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  104. window.showDialog = this.showDialog
  105. window.choseLayerSwitching = this.choseLayerSwitching
  106. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  107. window.choseLayerSwitchingList_Data = this.choseLayerSwitchingList_Data
  108. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  109. },
  110. mounted() {
  111. this.getInit();
  112. this.listPublishTask();
  113. this.bottomMenuList() //获取底部公共组件消息和任务
  114. },
  115. data() {
  116. return {
  117. listCurrentIndex1: '1',
  118. listCurrentIndex2: '2',
  119. pickYear: new Date(), //选择年份
  120. afforestationList: [],
  121. AfforestationAreaList: [],
  122. graphicsList: [],//地图区域
  123. //左右缩进
  124. indentStyle: '',
  125. indentleft: '',
  126. indentright: '',
  127. indentText: '收起左右栏',
  128. indentdisabled: false,
  129. //植树造林任务集合
  130. forestationTaskList:[],
  131. forestationDone: {}
  132. }
  133. },
  134. methods: {
  135. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  136. bottomMenuList() {
  137. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  138. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  139. },
  140. showDialog(click) {
  141. if (click == 'eventLocation') {
  142. this.$refs.eventLocation.showEventLocation()
  143. this.$refs.supermap.isEditableLayers = false
  144. this.$refs.bottomMenu.showChild = false
  145. this.$refs.bottomMenu.showBanChild = false
  146. this.$refs.bottomMenu.showChangChild = false
  147. } else if (click == 'editableLayers') {
  148. this.$refs.bottomMenu.showChild = false
  149. this.$refs.bottomMenu.showBanChild = false
  150. this.$refs.bottomMenu.showChangChild = false
  151. if (!this.$refs.supermap.isEditableLayers) {
  152. this.$refs.supermap.isEditableLayers = true
  153. } else {
  154. this.$refs.supermap.isEditableLayers = false
  155. }
  156. } else if (click == 'layerSwitching') {
  157. this.$refs.supermap.isEditableLayers = false
  158. this.$refs.bottomMenu.showBanChild = false
  159. this.$refs.bottomMenu.showChangChild = false
  160. if (!this.$refs.bottomMenu.showChild) {
  161. this.$refs.bottomMenu.showChild = true
  162. } else {
  163. this.$refs.bottomMenu.showChild = false
  164. }
  165. } else if (click == 'TVWall') {
  166. this.$refs.TVWall.showTVWall()
  167. this.$refs.supermap.isEditableLayers = false
  168. this.$refs.bottomMenu.showChild = false
  169. this.$refs.bottomMenu.showBanChild = false
  170. this.$refs.bottomMenu.showChangChild = false
  171. } else if (click == 'forestban') {
  172. this.$refs.supermap.isEditableLayers = false
  173. this.$refs.bottomMenu.showChild = false
  174. this.$refs.bottomMenu.showChangChild = false
  175. if (!this.$refs.bottomMenu.showBanChild) {
  176. this.$refs.bottomMenu.showBanChild = true
  177. } else {
  178. this.$refs.bottomMenu.showBanChild = false
  179. }
  180. } else if (click == 'forestchang') {
  181. this.$refs.supermap.isEditableLayers = false
  182. this.$refs.bottomMenu.showBanChild = false
  183. this.$refs.bottomMenu.showChild = false
  184. if (!this.$refs.bottomMenu.showChangChild) {
  185. this.$refs.bottomMenu.showChangChild = true
  186. } else {
  187. this.$refs.bottomMenu.showChangChild = false
  188. }
  189. }
  190. },
  191. //选择图层
  192. choseLayerSwitching(url, isClear) {
  193. this.$refs.supermap.layerSwitching(url, isClear)
  194. },
  195. //选择图层(传递数组)
  196. choseLayerSwitchingList(urlList) {
  197. this.$refs.supermap.layerSwitchingList(urlList)
  198. },
  199. //选择图层(传递数组) 带数据
  200. choseLayerSwitchingList_Data(urlList) {
  201. this.$refs.supermap.layerSwitchingList_Data(urlList)
  202. },
  203. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  204. getInit() {
  205. this.listCurrentIndex1 = '1'
  206. this.listCurrentIndex2 = '2'
  207. let that = this
  208. this.afforestationList = []
  209. this.AfforestationAreaList = []
  210. //获取左侧菜单列表
  211. getAfforestation(this.pickYear.getYear() + 1900).then(res => {
  212. this.afforestationList = res.data
  213. setTimeout(() => {
  214. this.$refs.supermap.clearG()
  215. }, 1000)
  216. })
  217. },
  218. listPublishTask() {
  219. listPublishTask({}).then(res => {
  220. this.forestationTaskList = res.data
  221. })
  222. },
  223. selectWorkCountById(points){
  224. const graphicsList = JSON.parse( points );
  225. this.$refs.supermap.clearGTwo();
  226. this.$refs.supermap.setGraphicsListTwo(graphicsList, 'blue');
  227. },
  228. getAfforestationArea(afforestationId) {
  229. this.listCurrentIndex1 = afforestationId
  230. let that = this
  231. //获取左侧菜单列表
  232. getAfforestationArea(afforestationId).then(res => {
  233. this.AfforestationAreaList = res.data
  234. })
  235. },
  236. setGraphicsList(points) {
  237. this.listCurrentIndex2 = points
  238. this.graphicsList = []
  239. if (points != null && points != '') {
  240. this.graphicsList = JSON.parse(points)
  241. this.$refs.supermap.clearG()
  242. this.$refs.supermap.setGraphicsList(this.graphicsList, 'red')
  243. } else {
  244. this.$refs.supermap.clearG()
  245. }
  246. },
  247. //吉祥物收起左右框
  248. indent() {
  249. let list = document.getElementsByClassName('el-tooltip__popper')
  250. list[list.length - 1].style.display = 'none'
  251. if (this.indentStyle == '') {
  252. this.indentStyle = 'indent-style'
  253. this.indentleft = 'indent-left'
  254. this.indentright = 'indent-right'
  255. this.indentText = '展开左右栏'
  256. } else if (this.indentText == '展开左右栏') {
  257. this.indentStyle = ''
  258. this.indentleft = ''
  259. this.indentright = ''
  260. this.indentText = '收起左右栏'
  261. }
  262. },
  263. dropLocation(lat, lng) {
  264. this.$refs.supermap.dropLocation(lat, lng)
  265. },
  266. /** ----------------------------------摄像头预览开始------------------------------------- */
  267. alertLogin: function() {
  268. this.$modal.msg('登录中....')
  269. },
  270. alertLoginSuccess: function() {
  271. this.$modal.msgSuccess('登录成功!')
  272. },
  273. alertLoginFailed: function() {
  274. this.$modal.msgError('登陆失败!')
  275. },
  276. alertReinstall: function() {
  277. this.$modal.msgWarning('请重新安装客户端')
  278. },
  279. /** 预览按钮操作 */
  280. preview(channelCode) {
  281. getDahuaVideoServer().then(newResponse => {
  282. this.ws.detectConnectQt().then(res => {
  283. if (res) { // 连接客户端成功
  284. this.alertLogin()
  285. this.ws.login({
  286. loginIp: newResponse.loginIp,
  287. loginPort: newResponse.loginPort,
  288. userName: newResponse.userName,
  289. userPwd: newResponse.userPwd,
  290. token: '',
  291. https: 1
  292. })
  293. this.ws.on('loginState', (res) => {
  294. this.isLogin = res
  295. console.log('---res-----', res)
  296. if (res) {
  297. this.alertLoginSuccess()
  298. this.activePanel = 'key2'
  299. this.realTimeVideoDialog(channelCode)
  300. } else {
  301. this.alertLoginFailed()
  302. }
  303. })
  304. } else { // 连接客户端失败
  305. this.alertReinstall()
  306. }
  307. })
  308. })
  309. },
  310. realTimeVideoDialog(cameraParams) { // 调用弹窗实时播放接口
  311. if (!this.isLogin) {
  312. this.$Message.info('正在登陆客户端,请稍等......')
  313. return false
  314. }
  315. this.ws.openVideo(cameraParams)
  316. }
  317. /** ----------------------------------摄像头预览结束------------------------------------- */
  318. }
  319. }
  320. </script>
  321. <style lang="scss" scoped>
  322. @import '@/assets/styles/base.scss';
  323. .el-table__header {
  324. width: auto !important;
  325. }
  326. .d-dialog-con {
  327. position: absolute;
  328. left: -19rem;
  329. top: 0;
  330. }
  331. </style>