leader.vue 17 KB

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