leader.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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'" class="indexSupermapClass"
  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. getRy
  106. } from '@/api/leader'
  107. import supermap from '@/components/supermap' //超图
  108. import vheader from '@/components/v-header.vue' //一体化共用头部
  109. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  110. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  111. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  112. let echarts = require('echarts')
  113. export default {
  114. components: {
  115. supermap,
  116. vheader,
  117. vBottomMenu,
  118. eventLocation,
  119. TVWall
  120. },
  121. data() {
  122. return {
  123. iconCurrentIndex1: '1',
  124. listCurrentIndex1: '',
  125. listCurrentIndex2: '',
  126. //左右缩进
  127. indentStyle: '',
  128. indentleft: '',
  129. indentright: '',
  130. indentText: '收起左右栏',
  131. indentdisabled: false,
  132. visuForestCloudRYBO: [], //人员类型列表
  133. peopleList: [], //人员列表
  134. connectList: [], //画线
  135. xunLinListOne: [], //巡林计划
  136. zrs: 0, //总人数
  137. zxrs: 0 //在线人数
  138. }
  139. },
  140. created() {
  141. this.getInit()
  142. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  143. window.showDialog = this.showDialog
  144. window.choseLayerSwitching = this.choseLayerSwitching
  145. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  146. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  147. },
  148. methods: {
  149. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  150. showDialog(click) {
  151. if (click == 'eventLocation') {
  152. this.$refs.eventLocation.showEventLocation()
  153. this.$refs.supermap.isEditableLayers = false
  154. this.$refs.bottomMenu.showChild = false
  155. this.$refs.bottomMenu.showBanChild = false
  156. this.$refs.bottomMenu.showChangChild = false
  157. } else if (click == 'editableLayers') {
  158. this.$refs.bottomMenu.showChild = false
  159. this.$refs.bottomMenu.showBanChild = false
  160. this.$refs.bottomMenu.showChangChild = false
  161. if (!this.$refs.supermap.isEditableLayers) {
  162. this.$refs.supermap.isEditableLayers = true
  163. } else {
  164. this.$refs.supermap.isEditableLayers = false
  165. }
  166. } else if (click == 'layerSwitching') {
  167. this.$refs.supermap.isEditableLayers = false
  168. this.$refs.bottomMenu.showBanChild = false
  169. this.$refs.bottomMenu.showChangChild = false
  170. if (!this.$refs.bottomMenu.showChild) {
  171. this.$refs.bottomMenu.showChild = true
  172. } else {
  173. this.$refs.bottomMenu.showChild = false
  174. }
  175. } else if (click == 'TVWall') {
  176. this.$refs.TVWall.showTVWall()
  177. this.$refs.supermap.isEditableLayers = false
  178. this.$refs.bottomMenu.showChild = false
  179. this.$refs.bottomMenu.showBanChild = false
  180. this.$refs.bottomMenu.showChangChild = false
  181. } else if (click == 'forestban') {
  182. this.$refs.supermap.isEditableLayers = false
  183. this.$refs.bottomMenu.showChild = false
  184. this.$refs.bottomMenu.showChangChild = false
  185. if (!this.$refs.bottomMenu.showBanChild) {
  186. this.$refs.bottomMenu.showBanChild = true
  187. } else {
  188. this.$refs.bottomMenu.showBanChild = false
  189. }
  190. } else if (click == 'forestchang') {
  191. this.$refs.supermap.isEditableLayers = false
  192. this.$refs.bottomMenu.showBanChild = false
  193. this.$refs.bottomMenu.showChild = false
  194. if (!this.$refs.bottomMenu.showChangChild) {
  195. this.$refs.bottomMenu.showChangChild = true
  196. } else {
  197. this.$refs.bottomMenu.showChangChild = false
  198. }
  199. }
  200. },
  201. //选择图层
  202. choseLayerSwitching(url, isClear) {
  203. this.$refs.supermap.layerSwitching(url, isClear)
  204. },
  205. //选择图层(传递数组)
  206. choseLayerSwitchingList(urlList) {
  207. this.$refs.supermap.layerSwitchingList(urlList)
  208. },
  209. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  210. //初始化
  211. getInit() {
  212. let that = this
  213. this.iconCurrentIndex1 = '1'
  214. this.listCurrentIndex1 = ''
  215. this.listCurrentIndex2 = ''
  216. //获取左侧菜单列表
  217. getRy().then(res => {
  218. that.visuForestCloudRYBO = res.data.visuForestCloudRYBO
  219. that.zrs = res.data.visuForestCloudRyZxBO.zrs
  220. that.zxrs = res.data.visuForestCloudRyZxBO.zxrs
  221. this.personnelChart()
  222. })
  223. //获取巡林计划
  224. getPlanList().then(res => {
  225. this.xunLinListOne = res.data
  226. })
  227. },
  228. //获取左侧人员列表
  229. getForestLeader(linJob, linType) {
  230. this.listCurrentIndex1 = ''
  231. this.listCurrentIndex2 = ''
  232. this.iconCurrentIndex1 = linJob
  233. this.peopleList = []
  234. getForestLeader(linJob, linType).then(res => {
  235. this.peopleList = res.data
  236. })
  237. this.connectList = []
  238. this.$refs.supermap.clearC()
  239. },
  240. //点击左侧人员列表获取轨迹
  241. getLeaderTrack(userId) {
  242. this.listCurrentIndex1 = userId
  243. let that = this
  244. this.connectList = []
  245. getLeaderTrack(userId).then(res => {
  246. if (res.data != null && res.data.length > 0) {
  247. for (let i = 0; i < res.data.length; i++) {
  248. let latlng = {
  249. lat: res.data[i].latitude,
  250. lng: res.data[i].longitude
  251. }
  252. this.connectList.push(latlng)
  253. }
  254. setTimeout(() => {
  255. that.$refs.supermap.clearC()
  256. that.$refs.supermap.setConnectList(this.connectList, 'red')
  257. }, 1000)
  258. } else {
  259. that.$refs.supermap.clearC()
  260. }
  261. })
  262. },
  263. setConnectList(points, planName) {
  264. this.listCurrentIndex2 = planName
  265. this.connectList = []
  266. if (points != null && points != '') {
  267. this.connectList = JSON.parse(points)
  268. this.$refs.supermap.setConnectTwoList(this.connectList, 'red')
  269. }
  270. },
  271. //吉祥物收起左右框
  272. indent() {
  273. let list = document.getElementsByClassName('el-tooltip__popper')
  274. list[list.length - 1].style.display = 'none'
  275. if (this.indentStyle == '') {
  276. this.indentStyle = 'indent-style'
  277. this.indentleft = 'indent-left'
  278. this.indentright = 'indent-right'
  279. this.indentText = '展开左右栏'
  280. } else if (this.indentText == '展开左右栏') {
  281. this.indentStyle = ''
  282. this.indentleft = ''
  283. this.indentright = ''
  284. this.indentText = '收起左右栏'
  285. }
  286. },
  287. //人员chart
  288. personnelChart() {
  289. // 基于准备好的dom,初始化echarts实例
  290. let myChart = echarts.init(document.getElementById('personnel-chart'))
  291. // 绘制图表
  292. const handred = this.zrs
  293. let point = this.zxrs
  294. myChart.setOption({
  295. title: [{
  296. text: '总人数:' + handred + '人' + '\n' + '\n' + '在线人数:' + point + '人',
  297. x: '48%',
  298. y: '25%',
  299. textStyle: {
  300. fontWeight: 'normal',
  301. color: '#02d6fc',
  302. fontSize: '14'
  303. }
  304. }],
  305. series: [{
  306. name: 'circle',
  307. type: 'pie',
  308. center: ['22%', '50%'],
  309. radius: ['60%', '70%'],
  310. clockWise: true,
  311. label: {
  312. normal: {
  313. position: 'center'
  314. }
  315. },
  316. itemStyle: {
  317. normal: {
  318. label: {
  319. show: false
  320. },
  321. labelLine: {
  322. show: false
  323. }
  324. }
  325. },
  326. data: [{
  327. value: point,
  328. name: '当前在线',
  329. label: {
  330. show: true, //单独显示该数据项
  331. formatter: '{c}人',
  332. labelLayout: {
  333. top: '50%'
  334. },
  335. textStyle: {
  336. color: '#02d6fc',
  337. fontSize: 14
  338. }
  339. },
  340. itemStyle: {
  341. normal: {
  342. color: { // 完成的圆环的颜色
  343. colorStops: [{
  344. offset: 0,
  345. color: '#02d6fc' // 0% 处的颜色
  346. }, {
  347. offset: 1,
  348. color: '#367bec' // 100% 处的颜色
  349. }]
  350. },
  351. label: {
  352. show: false
  353. },
  354. labelLine: {
  355. show: false
  356. }
  357. }
  358. }
  359. }, {
  360. value: handred - point,
  361. itemStyle: {
  362. color: '#666'
  363. }
  364. }]
  365. }]
  366. })
  367. }
  368. }
  369. }
  370. </script>
  371. <style rel="stylesheet/scss" lang="scss" scoped>
  372. @import '@/assets/styles/base.scss';
  373. .h-27 {
  374. height: 27rem;
  375. }
  376. </style>