index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div style="width:100%;height:100%;position:relative">
  3. <div style="width:100%;height:100%;padding-top:5.1rem;position:absolute">
  4. <mapdiv ref="mapdiv" style=""></mapdiv>
  5. <!-- <zhgl></zhgl> -->
  6. <!-- <introduction></introduction> -->
  7. </div>
  8. <headerdiv ref="headerDiv" :currentindexP = currentindexNew></headerdiv>
  9. <div class="bottombg">
  10. <div class="item item2" @click="changeMapTab(1)"><div class="num">{{staticCount}}</div><div>静态资源</div></div>
  11. <div class="item item1 item2" @click="changeMapTab(2)"><div class="num">{{dynamicCount}}</div><div>动态资源</div></div>
  12. <div class="item item1 " @click="changeMapTab(3)"><div class="num">{{areaCount}}</div><div>重点区域</div></div>
  13. <!-- <div class="item"><div class="num" @click="changeMapTab(4)">16</div><div>实时告警</div></div> -->
  14. </div>
  15. <!-- <videodiv :cameracode="ccode" style="width:700px;height:300px;position:absolute;top:100px;left:100px"></videodiv> -->
  16. </div>
  17. </template>
  18. <script>
  19. import moment from "moment";
  20. import mapdiv from "../../components/map/index.vue"
  21. import introduction from './introduction.vue'
  22. import zhgl from "../../components/zhgl/index.vue"
  23. import headerdiv from '@/components/HeaderDiv/index.vue'
  24. import { httpRequest } from "@/api/data/http";
  25. import { getLineData,getResource } from "@/api/qdtl/data";
  26. import videodiv from "../../components/Videoplayer/index.vue"
  27. export default {
  28. name: "big",
  29. data() {
  30. return {
  31. currenttime: moment().format("YYYY-MM-DD HH:mm:ss"),
  32. currentindexNew:1,
  33. ccode:"32068166001320000235",
  34. videoParams:{
  35. url:'http://2.90.220.252:9017/artemis-web/debug',
  36. 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"}'
  37. },
  38. staticCount:0,
  39. dynamicCount:0,
  40. areaCount:0
  41. };
  42. },
  43. components:{
  44. mapdiv,
  45. zhgl,
  46. headerdiv,
  47. videodiv,
  48. introduction
  49. },
  50. mounted() {
  51. // this.getTrain();
  52. this.getResource();
  53. this.getvideoList();
  54. // this.$$refs.headerDiv.currentindex = 1;
  55. setInterval(() => {
  56. this.currenttime = moment().format("YYYY-MM-DD HH:mm:ss");
  57. }, 1000);
  58. },
  59. methods:{
  60. changeMapTab(index){
  61. this.$refs.mapdiv.iconSelect = index
  62. },
  63. getTrain(){
  64. this.$refs.mapdiv.addPoint('video.png');
  65. },
  66. getResource(){
  67. getResource({date:'2022-03-12'}).then(response =>{
  68. console.log(response.data);
  69. var trainArry = [];
  70. var bridgeArry = [];
  71. var railArry = [];
  72. var stationLocation = [];
  73. var areaList = [];
  74. for(var index in response.data.staticLocation){
  75. var obj = response.data.staticLocation[index]
  76. obj.fence = obj.lnglat
  77. obj.name = obj.locationName
  78. stationLocation.push(obj)
  79. }
  80. for(var index in response.data.area){
  81. var obj = response.data.area[index]
  82. if(obj.areaType == '1'){
  83. areaList.push(obj);
  84. }else if(obj.areaType == '2'){
  85. obj.name = obj.areaName
  86. trainArry.push(obj);
  87. }else if(obj.areaType == '3'){
  88. obj.name = obj.areaName
  89. bridgeArry.push(obj);
  90. }else if(obj.areaType == '4'){
  91. obj.name = obj.areaName
  92. railArry.push(obj);
  93. }
  94. }
  95. for(var index in areaList){
  96. var json = JSON.parse(areaList[index].fence)
  97. this.$refs.mapdiv.addPolygon(json);
  98. }
  99. for(var key in response.data.deviceTrail){
  100. var jsonStr = '['
  101. for(var index in response.data.deviceTrail[key]){
  102. var obj = response.data.deviceTrail[key][index]
  103. if(index == response.data.deviceTrail[key].length - 1){
  104. var location = '['+obj.fence.split(',')[0]+','+obj.fence.split(',')[1]+']'
  105. }else{
  106. var location = '['+obj.fence.split(',')[0]+','+obj.fence.split(',')[1]+'],'
  107. }
  108. jsonStr += location
  109. // deviceArry.push(obj.fence.split(','));
  110. }
  111. jsonStr += ']'
  112. var json = JSON.parse(jsonStr);
  113. this.$refs.mapdiv.addPoints(response.data.deviceTrail[key],'device.png',0.6,'device');
  114. this.$refs.mapdiv.addline(json,'device');
  115. }
  116. this.$refs.mapdiv.addPoints(response.data.drone,'wrj.png',0.6,'wrj');
  117. this.$refs.mapdiv.addPoints(trainArry,'train.png',0.6,'train');
  118. this.$refs.mapdiv.addPoints(bridgeArry,'bridge.png',0.6,'bridge');
  119. this.$refs.mapdiv.addPoints(railArry,'rail.png',0.6,'rail');
  120. this.$refs.mapdiv.addPoints(stationLocation,'location.png',0.6,'location');
  121. this.areaCount += response.data.area.length
  122. this.staticCount += response.data.drone.length + stationLocation.length;
  123. // this.dynamicCount += response.data.deviceTrail.length
  124. this.dynamicCount += Object.getOwnPropertyNames(response.data.deviceTrail).length
  125. })
  126. },
  127. getvideoList(){
  128. httpRequest(this.videoParams).then(data =>{
  129. var json = JSON.parse(data.data);
  130. // console.log(json.data.list);
  131. // console.log(json.data.length)
  132. this.staticCount += json.data.list.length
  133. this.$refs.mapdiv.addPoints(json.data.list,'video.png',0.6,'video');
  134. });
  135. }
  136. }
  137. };
  138. </script>
  139. <style rel="stylesheet/scss" lang="scss">
  140. .bottombg{
  141. background: url("../../assets/images/底部菜单bg@2x.png");
  142. position: absolute;
  143. background-size: 100% 100%;
  144. z-index: 1;
  145. width: 85.1rem;
  146. height: 16.3rem;
  147. bottom: 0;
  148. left: 50%;
  149. transform: translate(-50%,-0%);
  150. display: flex;
  151. flex-direction: row;
  152. align-items: center;
  153. color:#fff;
  154. font-size:1.6rem;
  155. .item:hover{
  156. cursor: pointer;
  157. }
  158. .item{
  159. width: 33%;
  160. text-align: center;
  161. justify-content: center;
  162. position: relative;
  163. .num{
  164. font-size:3rem;
  165. color:#25f8bd;
  166. }
  167. }
  168. .item1{
  169. width: 33%;
  170. }
  171. .item2::after{
  172. content: "";
  173. background: url("../../assets/images/图层\ 2@2x.png");
  174. background-size: 100% 100%;
  175. width: 0.2rem;
  176. height: 7.3rem;
  177. position: absolute;
  178. top: 0;
  179. right: 0;
  180. }
  181. }
  182. .ol-zoom-in,.ol-zoom-out{
  183. display: none !important;
  184. }
  185. </style>