index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <div style="width:100%;height:100%;position:relative">
  3. <headerdiv ref="headerDiv" :currentindexP = currentindexNew ></headerdiv>
  4. <div style="display: inline-flex;width:100%">
  5. <div style="width:15%;height:100%;">
  6. <div style="width:100%">
  7. <div class='droneleftTree'>
  8. <!-- <el-input
  9. placeholder="输入关键字进行过滤"
  10. v-model="filterText"
  11. style="margin-top:1rem">
  12. </el-input> -->
  13. <div style="height:83vh;margin-top:2rem">
  14. <!-- <el-scrollbar style="height:110%;"> -->
  15. <el-tree
  16. icon-class='iconClass'
  17. :data="treeData"
  18. lazy
  19. :expand-on-click-node="false"
  20. node-key="id"
  21. :props="defaultProps"
  22. :default-expand-all= isExpand
  23. ref="tree"
  24. @node-click = 'treeChange'
  25. style="background-color:#04283C;color:#C5D0D4"
  26. >
  27. </el-tree>
  28. <!-- </el-scrollbar> -->
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div style="width:50%;height:95vh">
  34. <mapdiv ref="mapdiv" style=""></mapdiv>
  35. </div>
  36. <div style="width:35%;height:100%;">
  37. <div style="width:100%;padding-left:1rem">
  38. <div class="publicTitle" style="margin-top:1.5rem">
  39. <img src="../../assets/images/icon.png" style="width:1.8rem;height:1.8rem;margin-top:0.3rem"/>
  40. <div style="font-size:1.6rem;font-family: Adobe Heiti Std;font-weight: normal;color: #DFEEF3;margin-left:0.5rem">巡逻记录</div>
  41. </div>
  42. <div>
  43. <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="4.5rem">
  44. <el-form-item label="时间" prop="time" style="margin-top:0.1rem">
  45. <el-date-picker
  46. v-model="dateRange"
  47. size="small"
  48. style="width: 24rem"
  49. value-format="yyyy-MM-dd"
  50. type="daterange"
  51. range-separator="至"
  52. start-placeholder="开始日期"
  53. end-placeholder="结束日期"
  54. ></el-date-picker>
  55. </el-form-item>
  56. <el-form-item>
  57. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
  58. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  59. <el-button type="primary" icon="el-icon-search" size="mini" @click="exportQuery">导出</el-button>
  60. </el-form-item>
  61. <el-form-item label="区域" prop="areaName">
  62. <el-select v-model="queryParams.areaName" placeholder="请选择区域" clearable size="small" style="width:16rem">
  63. <!-- <el-option
  64. key="0"
  65. label="全部"
  66. value="0"
  67. /> -->
  68. <el-option
  69. v-for="dict in dict.type.tl_xun_area"
  70. :key="dict.value"
  71. :label="dict.label"
  72. :value="dict.label"
  73. />
  74. </el-select>
  75. </el-form-item>
  76. <el-form-item label="巡逻车" prop="imei" label-width="6rem">
  77. <el-select v-model="queryParams.imei" placeholder="请选择巡逻车" clearable size="small" style="width:16rem">
  78. <!-- <el-option
  79. key="0"
  80. label="全部"
  81. value="0"
  82. /> -->
  83. <el-option
  84. v-for="obj in treeData"
  85. :key="obj.imei"
  86. :label="obj.deviceName"
  87. :value="obj.imei"
  88. />
  89. </el-select>
  90. </el-form-item>
  91. </el-form>
  92. </div>
  93. <div style='height:38rem'>
  94. <el-table :data="carRecordList" stripe
  95. class="my_table"
  96. max-height=350
  97. :row-class-name="tableRowClassName"
  98. :header-cell-style="{background:'#24A3B3 50%',color: '#C5D0D4'}">
  99. <el-table-column type="index" label="序号" width="55" align="center" />
  100. <el-table-column label="编号" align="center" prop="imei" />
  101. <el-table-column label="时间" align="center" prop="gpsTime" />
  102. <el-table-column label="设备名称" align="center" prop="deviceName" />
  103. <el-table-column label="累计里程数(KM)" align="center" prop="mileage" />
  104. <el-table-column label="当天里程数(KM)" align="center" prop="dayMileage" />
  105. </el-table>
  106. </div>
  107. <div class="publicTitle" style="margin-top:1rem">
  108. <img src="../../assets/images/icon.png" style="width:1.8rem;height:1.8rem;margin-top:0.3rem"/>
  109. <div style="font-size:1.6rem;font-family: Adobe Heiti Std;font-weight: normal;color: #DFEEF3;margin-left:0.5rem">巡逻车统计</div>
  110. </div>
  111. <div style="height:25rem;width:100%;margin-top:0.5rem">
  112. <el-table :data="carList" stripe
  113. class="my_table"
  114. max-height=400
  115. :row-class-name="tableRowClassName"
  116. :header-cell-style="{background:'#24A3B3 50%',color: '#C5D0D4'}">
  117. <el-table-column type="index" label="序号" width="55" align="center" />
  118. <el-table-column label="地点" align="center" prop="areaName" />
  119. <el-table-column label="巡逻车总数" align="center" prop="totalCar" />
  120. <el-table-column label="使用中" align="center" prop="onlineCar" />
  121. </el-table>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="bottombg">
  127. <div class="item item2" @click="changeMapTab(1)"><div class="num">{{staticCount}}</div><div>静态资源</div></div>
  128. <div class="item item1 item2" @click="changeMapTab(2)"><div class="num">{{dynamicCount}}</div><div>动态资源</div></div>
  129. <div class="item item1 " @click="changeMapTab(3)"><div class="num">{{areaCount}}</div><div>行政区划</div></div>
  130. <!-- <div class="item"><div class="num" @click="changeMapTab(4)">16</div><div>实时告警</div></div> -->
  131. </div>
  132. .
  133. <div class="topbg">
  134. <div style='display: flex;
  135. flex-direction: row;
  136. margin-left:3rem'>
  137. <div style="">
  138. <div><img style='width:2.2rem;height:2.2rem' src='../../assets/images/elertic/巡逻车.png' /></div>
  139. </div>
  140. <div style='margin-left:1.5rem'>
  141. <div style="font-size: 1.6rem;
  142. font-family: Microsoft YaHei;
  143. font-weight: 400;
  144. color: #D6DEE7;">巡逻车总数</div>
  145. <div style="width: 134px;
  146. height: 38px;
  147. background: rgba(9,36,45,0.4000);
  148. border: 1px solid #30FFE7;
  149. margin-top:1rem">
  150. <div style="padding-top:0.1rem;
  151. padding-left:0.8rem;
  152. font-size: 2.4rem;
  153. font-family: Myriad Pro;
  154. font-weight: 400;
  155. color: #44D5FF;">
  156. {{carStaticCount.totalCar}}
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <div style='display: flex;
  162. flex-direction: row;
  163. margin-left:10rem'>
  164. <div style="">
  165. <div><img style='width:2.2rem;height:2.2rem' src='../../assets/images/elertic/卡口在线率.png' /></div>
  166. </div>
  167. <div style='margin-left:1.5rem'>
  168. <div style="font-size: 1.6rem;
  169. font-family: Microsoft YaHei;
  170. font-weight: 400;
  171. color: #D6DEE7;">巡逻车在线率</div>
  172. <div style="width: 134px;
  173. height: 38px;
  174. background: rgba(9,36,45,0.4000);
  175. border: 1px solid #30FFE7;
  176. margin-top:1rem">
  177. <div style="padding-top:0.1rem;
  178. padding-left:0.8rem;
  179. font-size: 2.4rem;
  180. font-family: Myriad Pro;
  181. font-weight: 400;
  182. color: #38FFC6;">
  183. {{carStaticCount.onlinePercent}}
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. <!-- <div style='display: flex;
  189. flex-direction: row;
  190. margin-left:10rem'>
  191. <div style="">
  192. <div><img style='width:2.2rem;height:2.2rem' src='../../assets/images/elertic/故障状态 (1).png' /></div>
  193. </div>
  194. <div style='margin-left:1.5rem'>
  195. <div style="font-size: 1.6rem;
  196. font-family: Microsoft YaHei;
  197. font-weight: 400;
  198. color: #D6DEE7;">巡逻车故障</div>
  199. <div style="width: 134px;
  200. height: 38px;
  201. background: rgba(9,36,45,0.4000);
  202. border: 1px solid #30FFE7;
  203. margin-top:1rem">
  204. <div style="padding-top:0.1rem;
  205. padding-left:0.8rem;
  206. font-size: 2.4rem;
  207. font-family: Myriad Pro;
  208. font-weight: 400;
  209. color: #44D5FF;">
  210. {{}}
  211. </div>
  212. </div>
  213. </div>
  214. </div> -->
  215. </div>
  216. <!-- <videodiv :cameracode="ccode" style="width:700px;height:300px;position:absolute;top:100px;left:100px"></videodiv> -->
  217. </div>
  218. </template>
  219. <script>
  220. import moment from "moment";
  221. import mapdiv from "../../components/map/index.vue"
  222. import headerdiv from '@/components/HeaderDiv/index.vue'
  223. import { httpRequest } from "@/api/data/http";
  224. import { getLineData,getResource,getgovern } from "@/api/qdtl/data";
  225. import { queryAllList,queryCarStaticByArea,queryLocationRecord,getAllElectricDetail } from "@/api/qdtl/electri";
  226. import videodiv from "../../components/Videoplayer/index.vue"
  227. export default {
  228. dicts: ['tl_area_type','tl_device_type','tl_xun_area'],
  229. name: "big",
  230. data() {
  231. return {
  232. isExpand:true,
  233. userList:[],
  234. areaList:[],
  235. tdxjCount:111,
  236. tdcsCount:152,
  237. currentindexNew:12,
  238. ccode:"32068166001320000235",
  239. videoParams:{
  240. url:'http://2.90.220.252:9017/artemis-web/debug',
  241. params:'{"httpMethod":"POST","path":"/api/resource/v1/cameras","headers":{},"query":{},"parameter":{},"body":{"pageNo": 1,"pageSize": 5000,"treeCode": "0"},"contentType":"application/json;charset=UTF-8","mock":false,"appKey":"27794545","appSecret":"5Xi27Gl7JrbHHF1MpdaB"}'
  242. },
  243. lcChartData:{},
  244. videoChartDate:{},
  245. staticCount:0,
  246. dynamicCount:2,
  247. areaCount:0,
  248. menuNameNew:'设置监测',
  249. lcData:{
  250. weeks:[],
  251. counts:[]
  252. },
  253. treeData:[],
  254. carStaticCount:{},
  255. carList:[],
  256. dateRange:'',
  257. queryParams:{},
  258. carRecordList:[],
  259. defaultProps: {
  260. children: 'children',
  261. label: 'label'
  262. },
  263. carArryData:[],
  264. };
  265. },
  266. components:{
  267. mapdiv,
  268. headerdiv,
  269. videodiv,
  270. },
  271. mounted() {
  272. console.log(111)
  273. this.getResource();
  274. this.getvideoList();
  275. // this.getGovern();
  276. this.queryAllList();
  277. this.queryCarStaticByArea();
  278. this.getAllElectricDetail();
  279. this.getDateRange();
  280. // this.queryLocationRecord()();
  281. },
  282. methods:{
  283. exportQuery(){
  284. this.download('/qdtl/electricLocation/export', {
  285. ...this.queryParams
  286. }, `巡逻车_${new Date().getTime()}.xlsx`)
  287. },
  288. getAllElectricDetail(){
  289. getAllElectricDetail().then(response =>{
  290. this.carStaticCount.totalCar = response.data.totalCar
  291. this.carStaticCount.onlinePercent = response.data.onlinePercent
  292. var carArry = response.data.detail;
  293. for(var index in carArry){
  294. carArry[index].fence = carArry[index].lng +","+carArry[index].lat
  295. }
  296. this.carArryData = carArry
  297. this.$refs.mapdiv.addPoints(carArry,'police.png',0.6,'car');
  298. })
  299. },
  300. queryLocationRecord(){
  301. queryLocationRecord(this.queryParams).then(response =>{
  302. console.log(response);
  303. this.carRecordList = response.data
  304. ; })
  305. },
  306. queryCarStaticByArea(){
  307. queryCarStaticByArea().then(response =>{
  308. this.carList = response.data
  309. ; })
  310. },
  311. queryAllList(){
  312. queryAllList().then(response=>{
  313. console.log(response);
  314. for(var index in response.data){
  315. var obj = response.data[index]
  316. // obj.id = obj.indexCode;
  317. obj.label = obj.deviceName;
  318. obj.data = obj;
  319. // console.log(obj);
  320. this.treeData.push(obj);
  321. }
  322. })
  323. console.log(this.treeData);
  324. },
  325. tableRowClassName({ row, rowIndex }) {
  326. if ((rowIndex + 1) % 2 === 0) {
  327. return "warning-row";
  328. } else {
  329. return "success-row";
  330. }
  331. },
  332. changeMapTab(index){
  333. this.$refs.mapdiv.iconSelect = index
  334. },
  335. getResource(){
  336. getResource().then(response =>{
  337. var trainArry = [];
  338. var bridgeArry = [];
  339. var railArry = [];
  340. var stationLocation = [];
  341. var areaList = [];
  342. for(var index in response.data.staticLocation){
  343. var obj = response.data.staticLocation[index]
  344. obj.fence = obj.lnglat
  345. obj.name = obj.locationName
  346. stationLocation.push(obj)
  347. }
  348. for(var index in response.data.area){
  349. var obj = response.data.area[index]
  350. if(obj.areaType == '1'){
  351. areaList.push(obj);
  352. }else if(obj.areaType == '2'){
  353. obj.name = obj.areaName
  354. trainArry.push(obj);
  355. }else if(obj.areaType == '3'){
  356. obj.name = obj.areaName
  357. bridgeArry.push(obj);
  358. }else if(obj.areaType == '4'){
  359. obj.name = obj.areaName
  360. railArry.push(obj);
  361. }
  362. }
  363. for(var index in areaList){
  364. var json = JSON.parse(areaList[index].fence)
  365. this.$refs.mapdiv.addPolygon(json);
  366. }
  367. for(var key in response.data.deviceTrail){
  368. var jsonStr = '['
  369. for(var index in response.data.deviceTrail[key]){
  370. var obj = response.data.deviceTrail[key][index]
  371. if(index == response.data.deviceTrail[key].length - 1){
  372. var location = '['+obj.fence.split(',')[0]+','+obj.fence.split(',')[1]+']'
  373. }else{
  374. var location = '['+obj.fence.split(',')[0]+','+obj.fence.split(',')[1]+'],'
  375. }
  376. jsonStr += location
  377. // deviceArry.push(obj.fence.split(','));
  378. }
  379. jsonStr += ']'
  380. var json = JSON.parse(jsonStr);
  381. this.$refs.mapdiv.addPoints(response.data.deviceTrail[key],'device.png',0.6,'device');
  382. this.$refs.mapdiv.addline(json,'device');
  383. }
  384. this.$refs.mapdiv.addPoints(trainArry,'train.png',0.6,'train');
  385. this.$refs.mapdiv.addPoints(bridgeArry,'bridge.png',0.6,'bridge');
  386. this.$refs.mapdiv.addPoints(railArry,'rail.png',0.6,'rail');
  387. this.$refs.mapdiv.addPoints(stationLocation,'location.png',0.6,'location');
  388. this.areaCount += response.data.area.length
  389. this.staticCount += response.data.drone.length + stationLocation.length;
  390. // this.dynamicCount += response.data.deviceTrail.length
  391. this.dynamicCount += Object.getOwnPropertyNames(response.data.deviceTrail).length
  392. })
  393. },
  394. getvideoList(){
  395. httpRequest(this.videoParams).then(data =>{
  396. var json = JSON.parse(data.data);
  397. this.staticCount += json.data.list.length
  398. this.$refs.mapdiv.addPoints(json.data.list,'video.png',0.6,'video');
  399. });
  400. },
  401. treeChange(data, node){
  402. var view = this.$refs.mapdiv.map.getView();
  403. console.log(view.getCenter());
  404. for(var index in this.carArryData){
  405. if(this.carArryData[index].deviceName == data.deviceName){
  406. console.log(this.carArryData[index].fence);
  407. // var lngArry = [];
  408. // lngArry.push();
  409. // lngArry.push();
  410. view.setCenter(this.carArryData[index].fence.split(','));
  411. this.$refs.mapdiv.clickObj = this.carArryData[index]
  412. this.$refs.mapdiv.isShowCar = true
  413. this.$refs.mapdiv.carStyle = 'left:80rem;top:35rem'
  414. }
  415. }
  416. },
  417. handleQuery(){
  418. console.log(this.queryParams);
  419. // console.log(this.dateRange);
  420. this.queryParams.startDate = this.dateRange[0]
  421. this.queryParams.endDate = this.dateRange[1]
  422. queryLocationRecord(this.queryParams).then(response =>{
  423. console.log(response);
  424. this.carRecordList = response.data
  425. for(var index in this.carRecordList){
  426. var obj = this.carRecordList[index]
  427. // console.log(obj.mileage);
  428. if(obj.mileage != null){
  429. obj.mileage = (obj.mileage/1000).toFixed(2)
  430. // console.log(obj.mileage);
  431. }
  432. if(obj.dayMileage != null){
  433. obj.dayMileage = (obj.dayMileage/1000).toFixed(2)
  434. }
  435. }
  436. })
  437. },
  438. resetQuery(){
  439. this.queryParams = [];
  440. },
  441. getDateRange(){
  442. var endDate = new Date().toLocaleDateString().split('/').map(item=>{if (item<10){return '0'+ item}else {return item}}).join('-')
  443. var startDaate = new Date(new Date().getTime()-3600*24*1000)
  444. var startDate = startDaate.toLocaleDateString().split('/').map(item=>{if (item<10){return '0'+ item}else {return item}}).join('-')
  445. this.dateRange = [];
  446. this.dateRange.push(startDate);
  447. this.dateRange.push(endDate);
  448. this.handleQuery();
  449. },
  450. }
  451. };
  452. </script>
  453. <style rel="stylesheet/scss" lang="scss" scoped>
  454. .publicTitle{
  455. background: url("~@/assets/images/title@2x.png") no-repeat;
  456. background-size: 100% 100%;
  457. width:95%;
  458. height:3.9rem;
  459. padding-left:1.5rem;
  460. padding-top:0.7rem;
  461. display: inline-flex;
  462. }
  463. .prcentClass{
  464. background: url("~@/assets/images/goverce/prcent.png") no-repeat;
  465. background-size: 100% 100%;
  466. width:95%;
  467. height:28rem;
  468. padding-left:25rem
  469. }
  470. .tdgove{
  471. background: url("~@/assets/images/goverce/态势1@2x.png") no-repeat;
  472. background-size: 100% 100%;
  473. width:32rem;
  474. height:9.6rem;
  475. margin-left:3.5rem;
  476. margin-top:1rem;
  477. display: inline-flex;
  478. // display: inline-flex;
  479. }
  480. .tdgove2{
  481. background: url("~@/assets/images/goverce/态势2@2x.png") no-repeat;
  482. background-size: 100% 100%;
  483. width:37.2rem;
  484. height:9.9rem;
  485. margin-left:3.5rem;
  486. display: inline-flex;
  487. // display: inline-flex;
  488. }
  489. .fontClass{
  490. font-size: 1.5rem;
  491. font-family: Microsoft YaHei;
  492. font-weight: 400;
  493. color: #FFFFFF;
  494. line-height: 2.6rem;
  495. }
  496. .EngClass{
  497. font-size: 1.2rem;
  498. font-family: AlibabaSans;
  499. font-weight: 400;
  500. color: #B7D0FA;
  501. line-height: 1.1rem;
  502. opacity: 0.4;
  503. }
  504. .countClass{
  505. font-size: 2.1rem;
  506. font-family: Microsoft YaHei;
  507. font-weight: 400;
  508. color: #25FFDE;
  509. line-height: 2rem;
  510. }
  511. .countClass2{
  512. font-size: 1.5rem;
  513. font-family: Microsoft YaHei;
  514. font-weight: 400;
  515. color: #FFFFFF;
  516. line-height: 2.6rem;
  517. }
  518. .isTop{
  519. margin-top:1.5rem
  520. }
  521. .droneleftTree{
  522. /* float:left; */
  523. width:100%;
  524. background-color:#04283C;
  525. padding: 1rem;
  526. padding-top:0 ;
  527. min-height: 95vh;
  528. z-index:1001;
  529. }
  530. .bottombg{
  531. background: url("../../assets/images/底部菜单bg@2x.png");
  532. position: absolute;
  533. background-size: 100% 100%;
  534. z-index: 1;
  535. width: 85.1rem;
  536. height: 16.3rem;
  537. bottom: 0;
  538. left: 40%;
  539. transform: translate(-50%,-0%);
  540. display: flex;
  541. flex-direction: row;
  542. align-items: center;
  543. color:#fff;
  544. font-size:1.6rem;
  545. .item:hover{
  546. cursor: pointer;
  547. }
  548. .item{
  549. width: 33%;
  550. text-align: center;
  551. justify-content: center;
  552. position: relative;
  553. .num{
  554. font-size:3rem;
  555. color:#25f8bd;
  556. }
  557. }
  558. .item1{
  559. width: 33%;
  560. }
  561. .item2::after{
  562. content: "";
  563. background: url("../../assets/images/图层\ 2@2x.png");
  564. background-size: 100% 100%;
  565. width: 0.2rem;
  566. height: 7.3rem;
  567. position: absolute;
  568. top: 0;
  569. right: 0;
  570. }
  571. }
  572. .topbg{
  573. position: absolute;
  574. background-size: 100% 100%;
  575. z-index: 1;
  576. width: 50%;
  577. height: 16.3rem;
  578. top:8rem;
  579. left: 15%;
  580. background-color: rgba(0, 0, 0, 0.47);
  581. // transform: translate(-50%,-0%);
  582. display: flex;
  583. flex-direction: row;
  584. // align-items: center;
  585. color:#fff;
  586. font-size:1.6rem;
  587. padding-top:2rem
  588. }
  589. .iconClass{
  590. display: none
  591. }
  592. </style>