leader.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <div class="visual-con">
  3. <!--头部-->
  4. <vheader></vheader>
  5. <!--主体-->
  6. <div class="visual-body">
  7. <!-- 左侧 -->
  8. <div class="leftbar" 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="getPlanList(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" 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. <el-collapse accordion>
  77. <el-collapse-item v-for="(item,index) in xunLinListOne">
  78. <template slot="title">
  79. <div class="d-l-con sj-collapse"
  80. @click="getRecordList(item.id, item.patrolTrajectory)">
  81. <div class="d-l-l-text">
  82. <el-tooltip class="item" effect="dark" placement="left"
  83. style="width:10rem ;" :disabled="(item.taskName!=null&&item.taskName.length <= 20)">
  84. <div slot="content">
  85. <h4 class="collapse-title" style="width: 200px;">
  86. {{ item.taskName}}</h4>
  87. </div>
  88. <h4 class="collapse-title" style="width: 100px;">
  89. {{ item.taskName | ellipsis20}}</h4>
  90. </el-tooltip>
  91. </div>
  92. <div class="d-l-l-count">({{ item.recordCount }}/{{ item.planCount }})
  93. </div>
  94. </div>
  95. </template>
  96. <div class="d-l-con this-child sj-collapse" @click="getPointList(child.id)"
  97. v-for="(child,index) in recordList">
  98. <div class="d-l-l-text">
  99. <h4>{{child.beginTime}} - {{child.endTime}}</h4>
  100. </div>
  101. <!--<div class="d-l-l-count">{{index}}</div>-->
  102. </div>
  103. <div class="d-l-con this-child sj-collapse"
  104. v-if="showNothing && (recordList == null || recordList == '' || recordList == [])">
  105. <div class="d-l-l-text">
  106. <h4 class="text-gray">暂无信息</h4>
  107. </div>
  108. </div>
  109. </el-collapse-item>
  110. </el-collapse>
  111. <!--<div class="d-l-con" :class="{on:listCurrentIndex2==item.planName}"
  112. v-for="(item,index) in xunLinListOne"
  113. @click="setConnectList(item.planLine,item.planName)">
  114. <div class="d-l-l-text">
  115. <i class="i-small"></i>
  116. <h4>{{ item.planName }}</h4>
  117. </div>
  118. </div>-->
  119. </div>
  120. </div>
  121. </dv-border-box-13>
  122. </div>
  123. </div>
  124. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  125. </div>
  126. <eventLocation ref="eventLocation"></eventLocation>
  127. <TVWall ref="TVWall"></TVWall>
  128. </div>
  129. </template>
  130. <script>
  131. import {
  132. getForestLeader,
  133. getPlanList,
  134. getRecordList,
  135. getPointList,
  136. getRy,
  137. getlinleaderMap
  138. } from '@/api/leader'
  139. import supermap from '@/components/supermap' //超图
  140. import vheader from '@/components/v-header.vue' //一体化共用头部
  141. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  142. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  143. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  144. let echarts = require('echarts')
  145. export default {
  146. components: {
  147. supermap,
  148. vheader,
  149. vBottomMenu,
  150. eventLocation,
  151. TVWall
  152. },
  153. data() {
  154. return {
  155. iconCurrentIndex1: '1',
  156. listCurrentIndex1: '',
  157. listCurrentIndex2: '',
  158. visuForestCloudRYBO: [], //人员类型列表
  159. personId: null, //人员
  160. peopleList: [], //人员列表
  161. connectList: [], //画线
  162. patrolTrajectory: null, //任务画线
  163. xunLinListOne: [], //巡林任务
  164. recordList: [], //巡查记录
  165. showNothing: false, //暂无信息
  166. zrs: 0, //总人数
  167. zxrs: 0 //在线人数
  168. }
  169. },
  170. created() {
  171. this.getInit()
  172. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  173. window.showDialog = this.showDialog
  174. window.choseLayerSwitching = this.choseLayerSwitching
  175. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  176. window.choseLayerSwitchingList_Data = this.choseLayerSwitchingList_Data
  177. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  178. },
  179. mounted(){
  180. this.bottomMenuList() //获取底部公共组件消息和任务
  181. },
  182. methods: {
  183. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  184. bottomMenuList() {
  185. this.$refs.bottomMenu.selectTaskList()//获取任务列表
  186. this.$refs.bottomMenu.selectMessageList()//获取消息列表
  187. },
  188. showDialog(click) {
  189. if (click == 'eventLocation') {
  190. this.$refs.eventLocation.showEventLocation()
  191. this.$refs.supermap.isEditableLayers = false
  192. this.$refs.bottomMenu.showChild = false
  193. this.$refs.bottomMenu.showBanChild = false
  194. this.$refs.bottomMenu.showChangChild = false
  195. } else if (click == 'editableLayers') {
  196. this.$refs.bottomMenu.showChild = false
  197. this.$refs.bottomMenu.showBanChild = false
  198. this.$refs.bottomMenu.showChangChild = false
  199. if (!this.$refs.supermap.isEditableLayers) {
  200. this.$refs.supermap.isEditableLayers = true
  201. } else {
  202. this.$refs.supermap.isEditableLayers = false
  203. }
  204. } else if (click == 'layerSwitching') {
  205. this.$refs.supermap.isEditableLayers = false
  206. this.$refs.bottomMenu.showBanChild = false
  207. this.$refs.bottomMenu.showChangChild = false
  208. if (!this.$refs.bottomMenu.showChild) {
  209. this.$refs.bottomMenu.showChild = true
  210. } else {
  211. this.$refs.bottomMenu.showChild = false
  212. }
  213. } else if (click == 'TVWall') {
  214. this.$refs.TVWall.showTVWall()
  215. this.$refs.supermap.isEditableLayers = false
  216. this.$refs.bottomMenu.showChild = false
  217. this.$refs.bottomMenu.showBanChild = false
  218. this.$refs.bottomMenu.showChangChild = false
  219. } else if (click == 'forestban') {
  220. this.$refs.supermap.isEditableLayers = false
  221. this.$refs.bottomMenu.showChild = false
  222. this.$refs.bottomMenu.showChangChild = false
  223. if (!this.$refs.bottomMenu.showBanChild) {
  224. this.$refs.bottomMenu.showBanChild = true
  225. } else {
  226. this.$refs.bottomMenu.showBanChild = false
  227. }
  228. } else if (click == 'forestchang') {
  229. this.$refs.supermap.isEditableLayers = false
  230. this.$refs.bottomMenu.showBanChild = false
  231. this.$refs.bottomMenu.showChild = false
  232. if (!this.$refs.bottomMenu.showChangChild) {
  233. this.$refs.bottomMenu.showChangChild = true
  234. } else {
  235. this.$refs.bottomMenu.showChangChild = false
  236. }
  237. }
  238. },
  239. //选择图层
  240. choseLayerSwitching(url, isClear) {
  241. this.$refs.supermap.layerSwitching(url, isClear)
  242. },
  243. //选择图层(传递数组)
  244. choseLayerSwitchingList(urlList) {
  245. this.$refs.supermap.layerSwitchingList(urlList)
  246. },
  247. //选择图层(传递数组) 带数据
  248. choseLayerSwitchingList_Data(urlList) {
  249. this.$refs.supermap.layerSwitchingList_Data(urlList)
  250. },
  251. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  252. //初始化
  253. getInit() {
  254. let that = this
  255. this.iconCurrentIndex1 = '1'
  256. this.listCurrentIndex1 = ''
  257. this.listCurrentIndex2 = ''
  258. //获取左侧菜单列表
  259. getRy().then(res => {
  260. that.visuForestCloudRYBO = res.data.visuForestCloudRYBO
  261. that.zrs = res.data.visuForestCloudRyZxBO.zrs
  262. that.zxrs = res.data.visuForestCloudRyZxBO.zxrs
  263. this.personnelChart()
  264. })
  265. },
  266. //获取左侧人员列表
  267. getForestLeader(linJob, linType) {
  268. let that = this
  269. that.listCurrentIndex1 = ''
  270. that.listCurrentIndex2 = ''
  271. that.iconCurrentIndex1 = linJob
  272. that.peopleList = []
  273. getForestLeader(linJob, linType).then(res => {
  274. that.peopleList = res.data
  275. })
  276. that.connectList = []
  277. this.personId = null;
  278. this.xunLinListOne = [];
  279. this.patrolTrajectory = null;
  280. that.$refs.supermap.clearC()
  281. },
  282. //点击左侧人员列表获取 巡林计划
  283. getPlanList(personId) {
  284. if(this.personId == personId){//当前人员已经被点击一次 不再重复加载
  285. return;
  286. }
  287. let that = this
  288. that.showNothing = false;
  289. that.recordList = [];
  290. that.listCurrentIndex1 = personId
  291. getPlanList(personId).then(res => {
  292. console.log("点击左侧人员列表获取 巡林计划=", res.data)
  293. that.xunLinListOne = res.data;
  294. })
  295. getlinleaderMap(personId).then(res => {
  296. that.choseLayerSwitching(res.data, true)
  297. })
  298. this.patrolTrajectory = null;
  299. that.$refs.supermap.clearC()
  300. },
  301. //点击右侧巡林计划获取 巡查记录
  302. getRecordList(id, patrolTrajectory) {
  303. alert(patrolTrajectory)
  304. let that = this
  305. that.showNothing = false;
  306. that.recordList = [];
  307. getRecordList(id).then(res => {
  308. that.recordList = res.data;
  309. })
  310. that.$refs.supermap.clearC();
  311. this.setTaskPointList(patrolTrajectory);
  312. },
  313. //点击右侧巡查记录获取 巡查轨迹
  314. getPointList(id) {
  315. let that = this
  316. getPointList(id).then(res => {
  317. // console.log("落点",res.data);
  318. that.setPointList(res);
  319. })
  320. },
  321. //点击巡查人员 巡查任务落点
  322. setTaskPointList(patrolTrajectory) {
  323. console.log("巡查任务落点", typeof JSON.parse(patrolTrajectory));
  324. if(this.patrolTrajectory){
  325. this.patrolTrajectory = null;
  326. }else {
  327. this.patrolTrajectory = patrolTrajectory;
  328. this.drawTaskPoint(this.patrolTrajectory);
  329. }
  330. },
  331. // 巡查任务落点
  332. drawTaskPoint(patrolTrajectory) {
  333. setTimeout(() => {
  334. this.$refs.supermap.clearC();
  335. this.$refs.supermap.setConnectList(JSON.parse(patrolTrajectory), '#04f');
  336. }, 1000)
  337. },
  338. //点击巡查轨迹时段 巡查轨迹落点
  339. setPointList(res) {
  340. let that = this;
  341. that.connectList = [];
  342. console.log("落点", res.data)
  343. if (res.data != null && res.data.length > 0) {
  344. for (let i = 0; i < res.data.length; i++) {
  345. let latlng = {
  346. lat: res.data[i].latitude,
  347. lng: res.data[i].longitude
  348. }
  349. that.connectList.push(latlng)
  350. }
  351. setTimeout(() => {
  352. // that.$refs.supermap.clearC()
  353. that.$refs.supermap.setConnectList(that.connectList, '#f40')
  354. }, 1000)
  355. } else {
  356. that.$refs.supermap.clearC()
  357. }
  358. },
  359. setConnectList(points, planName) {
  360. this.listCurrentIndex2 = planName
  361. this.connectList = []
  362. if (points != null && points != '') {
  363. this.connectList = JSON.parse(points)
  364. this.$refs.supermap.setConnectTwoList(this.connectList, 'red')
  365. }
  366. },
  367. //人员chart
  368. personnelChart() {
  369. // 基于准备好的dom,初始化echarts实例
  370. let myChart = echarts.init(document.getElementById('personnel-chart'))
  371. // 绘制图表
  372. const handred = this.zrs
  373. let point = this.zxrs
  374. myChart.setOption({
  375. title: [{
  376. text: '总人数:' + handred + '人' + '\n' + '\n' + '在线人数:' + point + '人',
  377. x: '48%',
  378. y: '25%',
  379. textStyle: {
  380. fontWeight: 'normal',
  381. color: '#02d6fc',
  382. fontSize: '14'
  383. }
  384. }],
  385. series: [{
  386. name: 'circle',
  387. type: 'pie',
  388. center: ['22%', '50%'],
  389. radius: ['60%', '70%'],
  390. clockWise: true,
  391. label: {
  392. normal: {
  393. position: 'center'
  394. }
  395. },
  396. itemStyle: {
  397. normal: {
  398. label: {
  399. show: false
  400. },
  401. labelLine: {
  402. show: false
  403. }
  404. }
  405. },
  406. data: [{
  407. value: point,
  408. name: '当前在线',
  409. label: {
  410. show: true, //单独显示该数据项
  411. formatter: '{c}人',
  412. labelLayout: {
  413. top: '50%'
  414. },
  415. textStyle: {
  416. color: '#02d6fc',
  417. fontSize: 14
  418. }
  419. },
  420. itemStyle: {
  421. normal: {
  422. color: { // 完成的圆环的颜色
  423. colorStops: [{
  424. offset: 0,
  425. color: '#02d6fc' // 0% 处的颜色
  426. }, {
  427. offset: 1,
  428. color: '#367bec' // 100% 处的颜色
  429. }]
  430. },
  431. label: {
  432. show: false
  433. },
  434. labelLine: {
  435. show: false
  436. }
  437. }
  438. }
  439. }, {
  440. value: handred - point,
  441. itemStyle: {
  442. color: '#666'
  443. }
  444. }]
  445. }]
  446. })
  447. }
  448. },
  449. //过滤器
  450. filters: {
  451. //标题截取前20
  452. ellipsis20(value) {
  453. if (!value) return '';
  454. if (value.length > 20) {
  455. return value.slice(0, 20) + '...'
  456. }
  457. return value
  458. }
  459. },
  460. }
  461. </script>
  462. <style rel="stylesheet/scss" lang="scss" scoped>
  463. @import '@/assets/styles/base.scss';
  464. .h-27 {
  465. height: 27rem;
  466. }
  467. </style>