leader.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  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.dictType}"
  20. v-for="(item,index) in visuForestCloudRYBO" @click="getRyListByJob(item.dictType)">
  21. <div class="icon icon-mid el-icon-user"></div>
  22. <div class="icon-text">
  23. <h5>{{ item.job }}</h5>
  24. <h6>{{ item.number }}</h6>
  25. </div>
  26. </div>
  27. <!-- <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="getTrafficLeader(item.jobValue,item.jobType)">
  28. <div class="icon icon-mid el-icon-user"></div>
  29. <div class="icon-text">
  30. <h5>{{item.job}}</h5>
  31. <h6>{{item.number}}</h6>
  32. </div>
  33. </div> -->
  34. </div>
  35. </div>
  36. </dv-border-box-13>
  37. </div>
  38. <!-- avatar: ""-->
  39. <!-- deptName: "锦程社区第一网格"-->
  40. <!-- nickName: "李猛"-->
  41. <!-- userId: 102-->
  42. <!-- userName: "limeng"-->
  43. <div class="forthis">
  44. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  45. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  46. <div class="i-list-con h-27">
  47. <el-input v-model="name" placeholder="请输入姓名" clearable size="small" prefix-icon="el-icon-search"
  48. style="margin-bottom: 20px" />
  49. <div class="d-l-con-icon">
  50. <div class="icon-con" :class="{on:listCurrentIndex1==item.userId}" v-for="(item,index) in peopleList2"
  51. @click="getPlanList(item.userId)">
  52. <div class="icon icon-mid el-icon-user"></div>
  53. <div class="icon-text personnel-name">
  54. <h6>{{ item.name }} <span v-if="item.phone != undefined"> - {{ item.phone }}</span></h6>
  55. <h5>{{ item.deptName }}</h5>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </dv-border-box-13>
  61. </div>
  62. </div>
  63. <!-- 地图 -->
  64. <!-- <supermap ref="supermap" style="width: 100%;height: 100vh;" :mapDiv="'forestMap'" class="indexSupermapClass"-->
  65. <!-- :mapSite="{doubleClickZoom:false}" :codes="['9fa5']" :isSideBySide="false"></supermap>-->
  66. <supermap ref="supermap" style="width: 100%;height: 100vh;"></supermap>
  67. <!-- 右侧 -->
  68. <div class="rightbar" :class="indentright" ref="right">
  69. <div class="forthis">
  70. <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
  71. <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;" />
  72. <div class="this-title">
  73. <span>巡查任务</span>
  74. <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;" />
  75. </div>
  76. <div class="i-list-con h-73">
  77. <div class="h-73 overflow-y">
  78. <el-collapse accordion>
  79. <el-collapse-item v-for="(item,index) in xunLinListOne">
  80. <template slot="title">
  81. <div class="d-l-con sj-collapse" @click="getRecordList(item.id, item.patrolTrajectory)">
  82. <div class="d-l-l-text">
  83. <el-tooltip class="item" effect="dark" placement="left" style="width:10rem ;"
  84. :disabled="(item.taskName.length <= 20)">
  85. <div slot="content">
  86. <h4 class="collapse-title" style="width: 200px;">
  87. {{ item.taskName}}
  88. </h4>
  89. </div>
  90. <h4 class="collapse-title" style="width: 100px;">
  91. {{ item.taskName | ellipsis20}}
  92. </h4>
  93. </el-tooltip>
  94. </div>
  95. <div class="d-l-l-count">({{ item.recordCount }}/{{ item.planCount }})
  96. </div>
  97. </div>
  98. </template>
  99. <div class="d-l-con this-child sj-collapse" @click="getPointList(child.id)"
  100. v-for="(child,index) in recordList">
  101. <div class="d-l-l-text">
  102. <h4>{{child.beginTime}} - {{child.endTime}}</h4>
  103. </div>
  104. <!--<div class="d-l-l-count">{{index}}</div>-->
  105. </div>
  106. <div class="d-l-con this-child sj-collapse"
  107. v-if="showNothing && (recordList == null || recordList == '' || recordList == [])">
  108. <div class="d-l-l-text">
  109. <h4 class="text-gray">暂无信息</h4>
  110. </div>
  111. </div>
  112. </el-collapse-item>
  113. </el-collapse>
  114. <!--<div class="d-l-con" :class="{on:listCurrentIndex2==item.planName}"
  115. v-for="(item,index) in xunLinListOne"
  116. @click="setConnectList(item.planLine,item.planName)">
  117. <div class="d-l-l-text">
  118. <i class="i-small"></i>
  119. <h4>{{ item.planName }}</h4>
  120. </div>
  121. </div>-->
  122. </div>
  123. </div>
  124. </dv-border-box-13>
  125. </div>
  126. </div>
  127. <vBottomMenu ref="bottomMenu"></vBottomMenu>
  128. <!-- <el-tooltip :content="indentText" placement="top" :disabled="indentdisabled">-->
  129. <!-- <div class="mascot" ref="mascot" :class="indentStyle" @click="indent">-->
  130. <!-- <img src="@/assets/images/mascot.png"/>-->
  131. <!-- </div>-->
  132. <!-- </el-tooltip>-->
  133. </div>
  134. <eventLocation ref="eventLocation"></eventLocation>
  135. <TVWall ref="TVWall"></TVWall>
  136. </div>
  137. </template>
  138. <script>
  139. import {
  140. getTrafficLeader,
  141. getPlanList,
  142. getRecordList,
  143. getPointList,
  144. getRy
  145. } from '@/api/leader'
  146. import supermap from '@/components/supermap-2.5d' //超图
  147. import vheader from '@/components/v-header.vue' //一体化共用头部
  148. import vBottomMenu from '@/components/vBottomMenu.vue' //一体化公共底部菜单
  149. import eventLocation from '@/components/eventLocation.vue' //事件定位弹窗
  150. import TVWall from '@/components/TVWall.vue' //电视墙弹窗
  151. import {
  152. getRyList,
  153. getRyListByJob
  154. } from "@/api/forest"; //电视墙弹窗
  155. let echarts = require('echarts')
  156. export default {
  157. components: {
  158. supermap,
  159. vheader,
  160. vBottomMenu,
  161. eventLocation,
  162. TVWall
  163. },
  164. data() {
  165. return {
  166. iconCurrentIndex1: '1',
  167. listCurrentIndex1: '',
  168. listCurrentIndex2: '',
  169. //左右缩进
  170. indentStyle: '',
  171. indentleft: '',
  172. indentright: '',
  173. indentText: '收起左右栏',
  174. indentdisabled: false,
  175. visuForestCloudRYBO: [], //人员类型列表
  176. personId: null, //人员
  177. peopleList: [], //人员列表
  178. name: '',
  179. peopleList2: [], //人员列表
  180. connectList: [], //画线
  181. patrolTrajectory: null, //任务画线
  182. xunLinListOne: [], //巡查任务
  183. recordList: [], //巡查记录
  184. showNothing: false, //暂无信息
  185. zrs: 0, //总人数
  186. zxrs: 0 //在线人数
  187. }
  188. },
  189. created() {
  190. this.getRyList()
  191. //this.getInit()
  192. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  193. window.showDialog = this.showDialog
  194. window.choseLayerSwitching = this.choseLayerSwitching
  195. window.choseLayerSwitchingList = this.choseLayerSwitchingList
  196. window.choseLayerSwitchingList_Data = this.choseLayerSwitchingList_Data
  197. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  198. },
  199. mounted() {
  200. this.bottomMenuList() //获取底部公共组件消息和任务
  201. },
  202. watch: {
  203. name(val) {
  204. this.peopleList2 = [];
  205. for (let i in this.peopleList) {
  206. if (this.peopleList[i].name.indexOf(val) != -1) {
  207. this.peopleList2.push(this.peopleList[i]);
  208. }
  209. }
  210. console.log(this.peopleList2)
  211. }
  212. },
  213. methods: {
  214. /** ----------------------------------底部按钮公用组件开始------------------------------------- */
  215. bottomMenuList() {
  216. this.$refs.bottomMenu.selectMessageList() //获取消息列表
  217. },
  218. showDialog(click) {
  219. if (click == 'eventLocation') {
  220. this.$refs.eventLocation.showEventLocation()
  221. this.$refs.supermap.isEditableLayers = false
  222. this.$refs.bottomMenu.showChild = false
  223. this.$refs.bottomMenu.showBanChild = false
  224. this.$refs.bottomMenu.showChangChild = false
  225. } else if (click == 'editableLayers') {
  226. this.$refs.bottomMenu.showChild = false
  227. this.$refs.bottomMenu.showBanChild = false
  228. this.$refs.bottomMenu.showChangChild = false
  229. if (!this.$refs.supermap.isEditableLayers) {
  230. this.$refs.supermap.isEditableLayers = true
  231. } else {
  232. this.$refs.supermap.isEditableLayers = false
  233. }
  234. } else if (click == 'layerSwitching') {
  235. this.$refs.supermap.isEditableLayers = false
  236. this.$refs.bottomMenu.showBanChild = false
  237. this.$refs.bottomMenu.showChangChild = false
  238. if (!this.$refs.bottomMenu.showChild) {
  239. this.$refs.bottomMenu.showChild = true
  240. } else {
  241. this.$refs.bottomMenu.showChild = false
  242. }
  243. } else if (click == 'TVWall') {
  244. this.$refs.TVWall.showTVWall()
  245. this.$refs.supermap.isEditableLayers = false
  246. this.$refs.bottomMenu.showChild = false
  247. this.$refs.bottomMenu.showBanChild = false
  248. this.$refs.bottomMenu.showChangChild = false
  249. } else if (click == 'forestban') {
  250. this.$refs.supermap.isEditableLayers = false
  251. this.$refs.bottomMenu.showChild = false
  252. this.$refs.bottomMenu.showChangChild = false
  253. if (!this.$refs.bottomMenu.showBanChild) {
  254. this.$refs.bottomMenu.showBanChild = true
  255. } else {
  256. this.$refs.bottomMenu.showBanChild = false
  257. }
  258. } else if (click == 'forestchang') {
  259. this.$refs.supermap.isEditableLayers = false
  260. this.$refs.bottomMenu.showBanChild = false
  261. this.$refs.bottomMenu.showChild = false
  262. if (!this.$refs.bottomMenu.showChangChild) {
  263. this.$refs.bottomMenu.showChangChild = true
  264. } else {
  265. this.$refs.bottomMenu.showChangChild = false
  266. }
  267. }
  268. },
  269. //选择图层
  270. choseLayerSwitching(url, isClear) {
  271. this.$refs.supermap.layerSwitching(url, isClear)
  272. },
  273. //选择图层(传递数组)
  274. choseLayerSwitchingList(urlList) {
  275. this.$refs.supermap.layerSwitchingList(urlList)
  276. },
  277. //选择图层(传递数组) 带数据
  278. choseLayerSwitchingList_Data(urlList) {
  279. this.$refs.supermap.layerSwitchingList_Data(urlList)
  280. },
  281. /** ----------------------------------底部按钮公用组件结束------------------------------------- */
  282. // 获取人员信息(河长、路长、田长)
  283. getRyList() {
  284. let that = this
  285. that.iconCurrentIndex1 = '1'
  286. that.listCurrentIndex1 = ''
  287. that.listCurrentIndex2 = ''
  288. getRyList({
  289. leadType: "3"
  290. }).then(function(response) {
  291. // console.log(JSON.stringify(response.data));
  292. that.visuForestCloudRYBO = response.data.ryList
  293. that.zrs = response.data.num
  294. that.personnelChart()
  295. })
  296. },
  297. getRyListByJob(jobValue) {
  298. let that = this
  299. that.listCurrentIndex1 = ''
  300. that.listCurrentIndex2 = ''
  301. that.iconCurrentIndex1 = jobValue
  302. that.name = ''
  303. that.peopleList = []
  304. that.peopleList2 = []
  305. getRyListByJob({
  306. leadType: "3",
  307. dictType: jobValue
  308. }).then(function(response) {
  309. // console.log(JSON.stringify(response.data));
  310. that.peopleList = response.data
  311. that.peopleList2 = response.data
  312. })
  313. },
  314. //初始化
  315. getInit() {
  316. let that = this
  317. this.iconCurrentIndex1 = '1'
  318. this.listCurrentIndex1 = ''
  319. this.listCurrentIndex2 = ''
  320. //获取左侧菜单列表
  321. getRy().then(res => {
  322. that.visuForestCloudRYBO = res.data.visuForestCloudRYBO
  323. that.zrs = res.data.visuForestCloudRyZxBO.zrs
  324. that.zxrs = res.data.visuForestCloudRyZxBO.zxrs
  325. this.personnelChart()
  326. })
  327. },
  328. //获取左侧人员列表
  329. getTrafficLeader(linJob, linType) {
  330. this.listCurrentIndex1 = ''
  331. this.listCurrentIndex2 = ''
  332. this.iconCurrentIndex1 = linJob
  333. this.peopleList = []
  334. this.peopleList2 = []
  335. getTrafficLeader(linJob, linType).then(res => {
  336. this.peopleList = res.data
  337. this.peopleList2 = res.data
  338. })
  339. this.connectList = []
  340. this.personId = null;
  341. this.xunLinListOne = [];
  342. this.patrolTrajectory = null;
  343. this.$refs.supermap.clearC()
  344. this.$refs.supermap.clearTwoC();
  345. },
  346. //点击左侧人员列表获取 巡查轨迹
  347. getPlanList(personId) {
  348. if (this.personId == personId) { //当前人员已经被点击一次 不再重复加载
  349. return;
  350. }
  351. this.personId = personId;
  352. this.showNothing = false;
  353. this.recordList = [];
  354. getPlanList(personId).then(res => {
  355. this.xunLinListOne = res.data;
  356. })
  357. this.patrolTrajectory = null;
  358. this.$refs.supermap.clearC()
  359. this.$refs.supermap.clearTwoC();
  360. },
  361. //点击右侧巡查轨迹获取 巡查记录
  362. getRecordList(id, patrolTrajectory) {
  363. this.showNothing = false;
  364. this.recordList = [];
  365. getRecordList(id).then(res => {
  366. this.recordList = res.data;
  367. })
  368. this.$refs.supermap.clearC();
  369. this.$refs.supermap.clearTwoC();
  370. this.setTaskPointList(patrolTrajectory);
  371. },
  372. //点击右侧巡查记录获取 巡查轨迹
  373. getPointList(id) {
  374. getPointList(id).then(res => {
  375. // console.log("落点",res.data);
  376. this.setPointList(res);
  377. })
  378. },
  379. // //点击巡查人员 巡查任务落点
  380. setTaskPointList(patrolTrajectory) {
  381. console.log("巡查任务落点", typeof JSON.parse(patrolTrajectory));
  382. if (this.patrolTrajectory == patrolTrajectory) {
  383. this.patrolTrajectory = null;
  384. } else {
  385. this.patrolTrajectory = patrolTrajectory;
  386. this.drawTaskPoint(this.patrolTrajectory);
  387. }
  388. },
  389. // 巡查任务落点
  390. drawTaskPoint(patrolTrajectory) {
  391. let list = JSON.parse(patrolTrajectory)
  392. let data = []
  393. for (var i = 0; i < list.length; i++) {
  394. data.push(list[i].lng);
  395. data.push(list[i].lat);
  396. }
  397. setTimeout(() => {
  398. this.$refs.supermap.clearC();
  399. this.$refs.supermap.clearTwoC();
  400. this.$refs.supermap.setConnectList(data, '#04f', 0.8);
  401. }, 1000)
  402. },
  403. //点击巡查轨迹时段 巡查轨迹落点
  404. setPointList(res) {
  405. let that = this;
  406. this.connectList = [];
  407. console.log("落点", res.data)
  408. if (res.data != null && res.data.length > 0) {
  409. for (let i = 0; i < res.data.length; i++) {
  410. that.connectList.push(res.data[i].longitude)
  411. that.connectList.push(res.data[i].latitude)
  412. }
  413. setTimeout(() => {
  414. that.$refs.supermap.clearTwoC()
  415. that.$refs.supermap.setConnectTwoList(that.connectList, '#f40', 0.8)
  416. }, 1000)
  417. } else {
  418. that.$refs.supermap.clearTwoC()
  419. }
  420. },
  421. setConnectList(points, planName) {
  422. this.listCurrentIndex2 = planName
  423. this.connectList = []
  424. if (points != null && points != '') {
  425. this.connectList = JSON.parse(points)
  426. this.$refs.supermap.setConnectTwoList(this.connectList, 'red')
  427. }
  428. },
  429. //吉祥物收起左右框
  430. indent() {
  431. let list = document.getElementsByClassName('el-tooltip__popper')
  432. list[list.length - 1].style.display = 'none'
  433. if (this.indentStyle == '') {
  434. this.indentStyle = 'indent-style'
  435. this.indentleft = 'indent-left'
  436. this.indentright = 'indent-right'
  437. this.indentText = '展开左右栏'
  438. } else if (this.indentText == '展开左右栏') {
  439. this.indentStyle = ''
  440. this.indentleft = ''
  441. this.indentright = ''
  442. this.indentText = '收起左右栏'
  443. }
  444. },
  445. //人员chart
  446. personnelChart() {
  447. // 基于准备好的dom,初始化echarts实例
  448. let myChart = echarts.init(document.getElementById('personnel-chart'))
  449. // 绘制图表
  450. const handred = this.zrs
  451. let point = this.zxrs
  452. myChart.setOption({
  453. title: [{
  454. text: '总人数:' + handred + '人',
  455. x: '48%',
  456. y: '25%',
  457. textStyle: {
  458. fontWeight: 'normal',
  459. color: '#02d6fc',
  460. fontSize: '14'
  461. }
  462. }],
  463. series: [{
  464. name: 'circle',
  465. type: 'pie',
  466. center: ['22%', '50%'],
  467. radius: ['60%', '70%'],
  468. clockWise: true,
  469. label: {
  470. normal: {
  471. position: 'center'
  472. }
  473. },
  474. itemStyle: {
  475. normal: {
  476. label: {
  477. show: false
  478. },
  479. labelLine: {
  480. show: false
  481. }
  482. }
  483. },
  484. data: [{
  485. value: handred,
  486. name: '当前在线',
  487. label: {
  488. show: true, //单独显示该数据项
  489. formatter: '{c}人',
  490. labelLayout: {
  491. top: '50%'
  492. },
  493. textStyle: {
  494. color: '#02d6fc',
  495. fontSize: 14
  496. }
  497. },
  498. itemStyle: {
  499. normal: {
  500. color: { // 完成的圆环的颜色
  501. colorStops: [{
  502. offset: 0,
  503. color: '#02d6fc' // 0% 处的颜色
  504. }, {
  505. offset: 1,
  506. color: '#367bec' // 100% 处的颜色
  507. }]
  508. },
  509. label: {
  510. show: false
  511. },
  512. labelLine: {
  513. show: false
  514. }
  515. }
  516. }
  517. }, {
  518. value: 0,
  519. itemStyle: {
  520. color: '#666'
  521. }
  522. }]
  523. }]
  524. })
  525. }
  526. },
  527. //过滤器
  528. filters: {
  529. //标题截取前20
  530. ellipsis20(value) {
  531. if (!value) return '';
  532. if (value.length > 20) {
  533. return value.slice(0, 20) + '...'
  534. }
  535. return value
  536. }
  537. },
  538. }
  539. </script>
  540. <style rel="stylesheet/scss" lang="scss" scoped>
  541. @import '@/assets/styles/base.scss';
  542. .h-27 {
  543. height: 27rem;
  544. }
  545. </style>