leader.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div class="visual-con">
  3. <!--头部-->
  4. <vheader></vheader>
  5. <!--主体-->
  6. <div class="visual-body">
  7. <!-- 左侧 -->
  8. <div class="leftbar" :class="indentleft" ref="left">
  9. <div class="forthis">
  10. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  11. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  12. <div class="this-title">
  13. <span>人员分布</span>
  14. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" />
  15. </div>
  16. <div class="i-list-con h-25">
  17. <div id="personnel-chart" style="width: 100%;height:12vh;"></div>
  18. <div class="d-l-con-icon">
  19. <div class="icon-con w-50" :class="{on:iconCurrentIndex1==item.jobValue}"
  20. v-for="(item,index) in visuForestCloudRYBO"
  21. @click="getForestLeader(item.jobValue,item.jobType)">
  22. <div class="icon icon-mid el-icon-user"></div>
  23. <div class="icon-text">
  24. <h5>{{item.job}}</h5>
  25. <h6>{{item.number}}</h6>
  26. </div>
  27. </div>
  28. <!-- <div class="icon-con w-50 m-btm-no" :class="{on:listCurrentIndex1==item.jobType}" v-for="(item,index) in visuForestCloudRYBO" v-if="index%2!=0" @click="getForestLeader(item.jobValue,item.jobType)">
  29. <div class="icon icon-mid el-icon-user"></div>
  30. <div class="icon-text">
  31. <h5>{{item.job}}</h5>
  32. <h6>{{item.number}}</h6>
  33. </div>
  34. </div> -->
  35. </div>
  36. </div>
  37. </dv-border-box-13>
  38. </div>
  39. <!-- avatar: ""-->
  40. <!-- deptName: "锦程社区第一网格"-->
  41. <!-- nickName: "李猛"-->
  42. <!-- userId: 102-->
  43. <!-- userName: "limeng"-->
  44. <div class="forthis">
  45. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  46. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  47. <div class="i-list-con h-27">
  48. <div class="d-l-con-icon">
  49. <div class="icon-con" :class="{on:listCurrentIndex1==item.userId}"
  50. v-for="(item,index) in peopleList" @click="getLeaderTrack(item.userId)">
  51. <div class="icon icon-mid el-icon-user"></div>
  52. <div class="icon-text personnel-name">
  53. <h6>{{item.nickName}}</h6>
  54. <h5>{{item.deptName}}</h5>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </dv-border-box-13>
  60. </div>
  61. </div>
  62. <!-- 地图 -->
  63. <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'"
  64. :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>
  65. <!-- 右侧 -->
  66. <div class="rightbar" :class="indentright" ref="right">
  67. <div class="forthis">
  68. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  69. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  70. <div class="this-title">
  71. <span>巡林计划</span>
  72. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" />
  73. </div>
  74. <div class="i-list-con h-73">
  75. <div class="h-19 overflow-y">
  76. <div class="d-l-con" :class="{on:listCurrentIndex2==item.planName}"
  77. v-for="(item,index) in xunLinListOne"
  78. @click="setConnectList(item.planLine,item.planName)">
  79. <div class="d-l-l-text">
  80. <i class="i-small"></i>
  81. <h4>{{item.planName}}</h4>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </dv-border-box-13>
  87. </div>
  88. </div>
  89. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  90. <el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">
  91. <div class="mascot" ref="mascot" :class="indentStyle" @click="indent">
  92. <img src="@/assets/images/mascot.png" />
  93. </div>
  94. </el-tooltip>
  95. </div>
  96. <eventLocation ref="eventLocation"></eventLocation>
  97. <TVWall ref="TVWall"></TVWall>
  98. </div>
  99. </template>
  100. <script>
  101. import {
  102. getForestLeader,
  103. getLeaderTrack,
  104. getPlanList
  105. } from '@/api/leader'
  106. import {
  107. getBaseInfo
  108. } from '@/api/forest'
  109. import supermap from '@/components/supermap' //超图
  110. import vheader from '@/components/v-header.vue' //一体化共用头部
  111. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  112. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  113. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  114. let echarts = require('echarts')
  115. export default {
  116. components: {
  117. supermap,
  118. vheader,
  119. vBottomMenu,
  120. eventLocation,
  121. TVWall,
  122. },
  123. data() {
  124. return {
  125. iconCurrentIndex1: '1',
  126. listCurrentIndex1: '',
  127. listCurrentIndex2: '',
  128. //左右缩进
  129. indentStyle: '',
  130. indentleft: '',
  131. indentright: '',
  132. indentText: '收起左右栏',
  133. indentdisabled: false,
  134. visuForestCloudRYBO: [], //人员类型列表
  135. peopleList: [], //人员列表
  136. connectList: [], //画线
  137. xunLinListOne: [], //巡林计划
  138. zrs: 0, //总人数
  139. zxrs: 0 //在线人数
  140. }
  141. },
  142. created() {
  143. this.getInit()
  144. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  145. window.showDialog = this.showDialog
  146. window.choseLayerSwitching = this.choseLayerSwitching
  147. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  148. },
  149. methods: {
  150. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  151. showDialog(click) {
  152. if (click == 'eventLocation') {
  153. this.$refs.eventLocation.showEventLocation()
  154. this.$refs.supermap.isEditableLayers = false
  155. this.$refs.bottomMenu.showChild = false
  156. } else if (click == 'editableLayers') {
  157. this.$refs.bottomMenu.showChild = false
  158. if (!this.$refs.supermap.isEditableLayers) {
  159. this.$refs.supermap.isEditableLayers = true
  160. } else {
  161. this.$refs.supermap.isEditableLayers = false
  162. }
  163. } else if (click == 'layerSwitching') {
  164. this.$refs.supermap.isEditableLayers = false
  165. if (!this.$refs.bottomMenu.showChild) {
  166. this.$refs.bottomMenu.showChild = true
  167. } else {
  168. this.$refs.bottomMenu.showChild = false
  169. }
  170. } else if (click == 'TVWall') {
  171. this.$refs.TVWall.showTVWall()
  172. this.$refs.supermap.isEditableLayers = false
  173. this.$refs.bottomMenu.showChild = false
  174. }
  175. },
  176. //选择图层
  177. choseLayerSwitching(url) {
  178. this.$refs.supermap.layerSwitching(url, true)
  179. },
  180. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  181. //初始化
  182. getInit() {
  183. let that = this
  184. this.iconCurrentIndex1 = '1'
  185. this.listCurrentIndex1 = ''
  186. this.listCurrentIndex2 = ''
  187. //获取左侧菜单列表
  188. getBaseInfo().then(res => {
  189. that.visuForestCloudRYBO = res.data.visuForestCloudRYBO
  190. that.zrs = res.data.visuForestCloudRyZxBO.zrs
  191. that.zxrs = res.data.visuForestCloudRyZxBO.zxrs
  192. this.personnelChart()
  193. })
  194. //获取巡林计划
  195. getPlanList().then(res => {
  196. this.xunLinListOne = res.data
  197. })
  198. },
  199. //获取左侧人员列表
  200. getForestLeader(linJob, linType) {
  201. this.listCurrentIndex1 = ''
  202. this.listCurrentIndex2 = ''
  203. this.iconCurrentIndex1 = linJob
  204. this.peopleList = []
  205. getForestLeader(linJob, linType).then(res => {
  206. this.peopleList = res.data
  207. })
  208. this.connectList = []
  209. this.$refs.supermap.clearC()
  210. },
  211. //点击左侧人员列表获取轨迹
  212. getLeaderTrack(userId) {
  213. this.listCurrentIndex1 = userId
  214. let that = this
  215. this.connectList = []
  216. getLeaderTrack(userId).then(res => {
  217. if (res.data != null && res.data.length > 0) {
  218. for (let i = 0; i < res.data.length; i++) {
  219. let latlng = {
  220. lat: res.data[i].latitude,
  221. lng: res.data[i].longitude
  222. }
  223. this.connectList.push(latlng)
  224. }
  225. setTimeout(() => {
  226. that.$refs.supermap.clearC()
  227. that.$refs.supermap.setConnectList(this.connectList, 'red')
  228. }, 1000)
  229. } else {
  230. that.$refs.supermap.clearC()
  231. }
  232. })
  233. },
  234. setConnectList(points, planName) {
  235. this.listCurrentIndex2 = planName
  236. this.connectList = []
  237. if (points != null && points != '') {
  238. this.connectList = JSON.parse(points)
  239. this.$refs.supermap.setConnectTwoList(this.connectList, 'red')
  240. }
  241. },
  242. //吉祥物收起左右框
  243. indent() {
  244. let list = document.getElementsByClassName('el-tooltip__popper')
  245. list[list.length - 1].style.display = 'none'
  246. if (this.indentStyle == '') {
  247. this.indentStyle = 'indent-style'
  248. this.indentleft = 'indent-left'
  249. this.indentright = 'indent-right'
  250. this.indentText = '展开左右栏'
  251. } else if (this.indentText == '展开左右栏') {
  252. this.indentStyle = ''
  253. this.indentleft = ''
  254. this.indentright = ''
  255. this.indentText = '收起左右栏'
  256. }
  257. },
  258. //人员chart
  259. personnelChart() {
  260. // 基于准备好的dom,初始化echarts实例
  261. let myChart = echarts.init(document.getElementById('personnel-chart'))
  262. // 绘制图表
  263. const handred = this.zrs
  264. let point = this.zxrs
  265. myChart.setOption({
  266. title: [{
  267. text: '总人数:' + handred + '人' + '\n' + '\n' + '在线人数:' + point + '人',
  268. x: '48%',
  269. y: '25%',
  270. textStyle: {
  271. fontWeight: 'normal',
  272. color: '#02d6fc',
  273. fontSize: '14'
  274. }
  275. }],
  276. series: [{
  277. name: 'circle',
  278. type: 'pie',
  279. center: ['22%', '50%'],
  280. radius: ['60%', '70%'],
  281. clockWise: true,
  282. label: {
  283. normal: {
  284. position: 'center'
  285. }
  286. },
  287. itemStyle: {
  288. normal: {
  289. label: {
  290. show: false
  291. },
  292. labelLine: {
  293. show: false
  294. }
  295. }
  296. },
  297. data: [{
  298. value: point,
  299. name: '当前在线',
  300. label: {
  301. show: true, //单独显示该数据项
  302. formatter: '{c}人',
  303. labelLayout: {
  304. top: '50%'
  305. },
  306. textStyle: {
  307. color: '#02d6fc',
  308. fontSize: 14
  309. }
  310. },
  311. itemStyle: {
  312. normal: {
  313. color: { // 完成的圆环的颜色
  314. colorStops: [{
  315. offset: 0,
  316. color: '#02d6fc' // 0% 处的颜色
  317. }, {
  318. offset: 1,
  319. color: '#367bec' // 100% 处的颜色
  320. }]
  321. },
  322. label: {
  323. show: false
  324. },
  325. labelLine: {
  326. show: false
  327. }
  328. }
  329. }
  330. }, {
  331. value: handred - point,
  332. itemStyle: {
  333. color: '#666'
  334. }
  335. }]
  336. }]
  337. })
  338. }
  339. }
  340. }
  341. </script>
  342. <style rel="stylesheet/scss" lang="scss" scoped>
  343. @import '@/assets/styles/base.scss';
  344. .h-27 {
  345. height: 27rem;
  346. }
  347. </style>