leader.vue 10 KB

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