leader.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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:20vh;"></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. <!--&lt;!&ndash; <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> &ndash;&gt;-->
  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-73 overflow-y">
  76. <div class="d-l-con" :class="{on:listCurrentIndex2==item.planName}"
  77. v-for="(item,index) in xunLinListOne"
  78. @click="getPointList(item.id)">
  79. <div class="d-l-l-text">
  80. <i class="i-small"></i>
  81. <h4>{{ item.timeBegin }} - {{ item.timeEnd }}</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. getTrackList,
  105. getPointList,
  106. getPlanList,
  107. getRy
  108. } from '@/api/leader'
  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. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  148. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  149. },
  150. methods: {
  151. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  152. showDialog(click) {
  153. if (click == 'eventLocation') {
  154. this.$refs.eventLocation.showEventLocation()
  155. this.$refs.supermap.isEditableLayers = false
  156. this.$refs.bottomMenu.showChild = false
  157. this.$refs.bottomMenu.showBanChild = false
  158. this.$refs.bottomMenu.showChangChild = false
  159. } else if (click == 'editableLayers') {
  160. this.$refs.bottomMenu.showChild = false
  161. this.$refs.bottomMenu.showBanChild = false
  162. this.$refs.bottomMenu.showChangChild = false
  163. if (!this.$refs.supermap.isEditableLayers) {
  164. this.$refs.supermap.isEditableLayers = true
  165. } else {
  166. this.$refs.supermap.isEditableLayers = false
  167. }
  168. } else if (click == 'layerSwitching') {
  169. this.$refs.supermap.isEditableLayers = false
  170. this.$refs.bottomMenu.showBanChild = false
  171. this.$refs.bottomMenu.showChangChild = false
  172. if (!this.$refs.bottomMenu.showChild) {
  173. this.$refs.bottomMenu.showChild = true
  174. } else {
  175. this.$refs.bottomMenu.showChild = false
  176. }
  177. } else if (click == 'TVWall') {
  178. this.$refs.TVWall.showTVWall()
  179. this.$refs.supermap.isEditableLayers = false
  180. this.$refs.bottomMenu.showChild = false
  181. this.$refs.bottomMenu.showBanChild = false
  182. this.$refs.bottomMenu.showChangChild = false
  183. } else if (click == 'forestban') {
  184. this.$refs.supermap.isEditableLayers = false
  185. this.$refs.bottomMenu.showChild = false
  186. this.$refs.bottomMenu.showChangChild = false
  187. if (!this.$refs.bottomMenu.showBanChild) {
  188. this.$refs.bottomMenu.showBanChild = true
  189. } else {
  190. this.$refs.bottomMenu.showBanChild = false
  191. }
  192. } else if (click == 'forestchang') {
  193. this.$refs.supermap.isEditableLayers = false
  194. this.$refs.bottomMenu.showBanChild = false
  195. this.$refs.bottomMenu.showChild = false
  196. if (!this.$refs.bottomMenu.showChangChild) {
  197. this.$refs.bottomMenu.showChangChild = true
  198. } else {
  199. this.$refs.bottomMenu.showChangChild = false
  200. }
  201. }
  202. },
  203. //选择图层
  204. choseLayerSwitching(url, isClear) {
  205. this.$refs.supermap.layerSwitching(url, isClear)
  206. },
  207. //选择图层(传递数组)
  208. choseLayerSwitchingList(urlList) {
  209. this.$refs.supermap.layerSwitchingList(urlList)
  210. },
  211. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  212. //初始化
  213. getInit() {
  214. let that = this
  215. this.iconCurrentIndex1 = '1'
  216. this.listCurrentIndex1 = ''
  217. this.listCurrentIndex2 = ''
  218. //获取左侧菜单列表
  219. getRy().then(res => {
  220. that.visuForestCloudRYBO = res.data.visuForestCloudRYBO
  221. that.zrs = res.data.visuForestCloudRyZxBO.zrs
  222. that.zxrs = res.data.visuForestCloudRyZxBO.zxrs
  223. this.personnelChart()
  224. })
  225. //获取巡林计划
  226. // getPlanList().then(res => {
  227. // this.xunLinListOne = res.data
  228. // })
  229. // // 获取轨迹列表
  230. // getTrackList().then(res => {
  231. // this.xunLinListOne = res.data
  232. // })
  233. // 获取人员列表
  234. // getForestLeader(linJob, linType).then(res => {
  235. getForestLeader().then(res => {
  236. this.peopleList = res.data;
  237. console.log("人员",res.data)
  238. })
  239. this.connectList = []
  240. // this.$refs.supermap.clearC() //clearC undefined
  241. },
  242. //获取左侧人员列表
  243. getForestLeader(linJob, linType) {
  244. this.listCurrentIndex1 = ''
  245. this.listCurrentIndex2 = ''
  246. this.iconCurrentIndex1 = linJob
  247. this.peopleList = []
  248. getForestLeader(linJob, linType).then(res => {
  249. this.peopleList = res.data;
  250. })
  251. this.connectList = []
  252. this.$refs.supermap.clearC()
  253. },
  254. //点击左侧人员列表获取轨迹
  255. getLeaderTrack(personId) {
  256. getTrackList(personId).then(res => {
  257. console.log("轨迹",res.data);
  258. if(res.data.length > 0){// 当前资源人员有巡查轨迹 获取最新一条轨迹
  259. this.xunLinListOne = res.data;
  260. this.getPointList(res.data[0].id);
  261. }else {// 清空上一用户落点
  262. this.xunLinListOne = [{"timeBegin": "当前资源人员", "timeEnd": "暂无巡查轨迹"}];
  263. this.$refs.supermap.clearC()
  264. }
  265. })
  266. },
  267. getLeaderTrack_original(userId) {
  268. this.listCurrentIndex1 = userId
  269. let that = this
  270. this.connectList = []
  271. getLeaderTrack(userId).then(res => {
  272. // this.xunLinListOne = res.data;
  273. // 获取右侧轨迹列表
  274. // getPlanList().then(res => {
  275. // this.xunLinListOne = res.data
  276. // })
  277. if (res.data != null && res.data.length > 0) {
  278. for (let i = 0; i < res.data.length; i++) {
  279. let latlng = {
  280. lat: res.data[i].latitude,
  281. lng: res.data[i].longitude
  282. }
  283. this.connectList.push(latlng)
  284. }
  285. setTimeout(() => {
  286. that.$refs.supermap.clearC()
  287. that.$refs.supermap.setConnectList(this.connectList, 'red')
  288. }, 1000)
  289. } else {
  290. that.$refs.supermap.clearC()
  291. }
  292. })
  293. },
  294. getPointList(trackId) {
  295. let that = this;
  296. this.connectList = [];
  297. getPointList(trackId).then(res => {
  298. console.log("落点",res.data)
  299. if (res.data != null && res.data.length > 0) {
  300. for (let i = 0; i < res.data.length; i++) {
  301. let latlng = {
  302. lat: res.data[i].latitude,
  303. lng: res.data[i].longitude
  304. }
  305. this.connectList.push(latlng)
  306. }
  307. setTimeout(() => {
  308. that.$refs.supermap.clearC()
  309. that.$refs.supermap.setConnectList(this.connectList, 'red')
  310. }, 1000)
  311. } else {
  312. that.$refs.supermap.clearC()
  313. }
  314. })
  315. },
  316. setConnectList(points, planName) {
  317. this.listCurrentIndex2 = planName
  318. this.connectList = []
  319. if (points != null && points != '') {
  320. this.connectList = JSON.parse(points)
  321. this.$refs.supermap.setConnectTwoList(this.connectList, 'red')
  322. }
  323. },
  324. //吉祥物收起左右框
  325. indent() {
  326. let list = document.getElementsByClassName('el-tooltip__popper')
  327. list[list.length - 1].style.display = 'none'
  328. if (this.indentStyle == '') {
  329. this.indentStyle = 'indent-style'
  330. this.indentleft = 'indent-left'
  331. this.indentright = 'indent-right'
  332. this.indentText = '展开左右栏'
  333. } else if (this.indentText == '展开左右栏') {
  334. this.indentStyle = ''
  335. this.indentleft = ''
  336. this.indentright = ''
  337. this.indentText = '收起左右栏'
  338. }
  339. },
  340. //人员chart
  341. personnelChart() {
  342. // 基于准备好的dom,初始化echarts实例
  343. let myChart = echarts.init(document.getElementById('personnel-chart'))
  344. // 绘制图表
  345. const handred = this.zrs
  346. let point = this.zxrs
  347. myChart.setOption({
  348. title: [{
  349. text: '总人数:' + handred + '人' + '\n' + '\n' + '在线人数:' + point + '人',
  350. x: '48%',
  351. y: '25%',
  352. textStyle: {
  353. fontWeight: 'normal',
  354. color: '#02d6fc',
  355. fontSize: '14'
  356. }
  357. }],
  358. series: [{
  359. name: 'circle',
  360. type: 'pie',
  361. center: ['22%', '50%'],
  362. radius: ['60%', '70%'],
  363. clockWise: true,
  364. label: {
  365. normal: {
  366. position: 'center'
  367. }
  368. },
  369. itemStyle: {
  370. normal: {
  371. label: {
  372. show: false
  373. },
  374. labelLine: {
  375. show: false
  376. }
  377. }
  378. },
  379. data: [{
  380. value: point,
  381. name: '当前在线',
  382. label: {
  383. show: true, //单独显示该数据项
  384. formatter: '{c}人',
  385. labelLayout: {
  386. top: '50%'
  387. },
  388. textStyle: {
  389. color: '#02d6fc',
  390. fontSize: 14
  391. }
  392. },
  393. itemStyle: {
  394. normal: {
  395. color: { // 完成的圆环的颜色
  396. colorStops: [{
  397. offset: 0,
  398. color: '#02d6fc' // 0% 处的颜色
  399. }, {
  400. offset: 1,
  401. color: '#367bec' // 100% 处的颜色
  402. }]
  403. },
  404. label: {
  405. show: false
  406. },
  407. labelLine: {
  408. show: false
  409. }
  410. }
  411. }
  412. }, {
  413. value: handred - point,
  414. itemStyle: {
  415. color: '#666'
  416. }
  417. }]
  418. }]
  419. })
  420. }
  421. },
  422. //过滤器
  423. filters: {
  424. //标题截取前20
  425. ellipsis20(value) {
  426. if (!value) return '';
  427. if (value.length > 20) {
  428. return value.slice(0, 20) + '...'
  429. }
  430. return value
  431. }
  432. },
  433. }
  434. </script>
  435. <style rel="stylesheet/scss" lang="scss" scoped>
  436. @import '@/assets/styles/base.scss';
  437. .h-27 {
  438. height: 27rem;
  439. }
  440. </style>