index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <div class="app-container">
  3. <div id="data-view">
  4. <div class="main-header">
  5. <div class="mh-middle">数字健康社区定位系统</div>
  6. </div>
  7. <div class="main">
  8. <div class="left">
  9. <div class="left-top">
  10. <div class="top-left"><Left-Chart-1 /></div>
  11. <div class="top-right">
  12. <equ-map
  13. v-loading="mapLoading"
  14. @callback="initMap"
  15. height="400px"
  16. />
  17. </div>
  18. </div>
  19. <div class="left-under">
  20. <div class="under-title"><b>在库设备数量</b></div>
  21. <dv-border-box-8 class="under-box">
  22. <Left-Chart-99 title="我是我是"></Left-Chart-99>
  23. <Left-Chart-99 title="我是我是"></Left-Chart-99>
  24. <Left-Chart-99 title="我是我是"></Left-Chart-99>
  25. <Left-Chart-99 title="我是我是"></Left-Chart-99>
  26. </dv-border-box-8>
  27. </div>
  28. </div>
  29. <div class="right">
  30. <Left-Chart-11 />
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import LeftChart1 from "./LeftChart1";
  38. import LeftChart11 from "./LeftChart11";
  39. import LeftChart99 from "./LeftChart99";
  40. import LeftChart2 from "./LeftChart2";
  41. import LeftChart3 from "./LeftChart3";
  42. import CenterCmp from "./CenterCmp";
  43. import RightChart1 from "./RightChart1";
  44. import RightChart2 from "./RightChart2";
  45. import BottomCharts from "./BottomCharts";
  46. import equMap from "./Maps.vue";
  47. export default {
  48. name: "DataView",
  49. components: {
  50. LeftChart1,
  51. LeftChart11,
  52. LeftChart99,
  53. LeftChart2,
  54. LeftChart3,
  55. CenterCmp,
  56. RightChart1,
  57. RightChart2,
  58. BottomCharts,
  59. equMap,
  60. },
  61. data() {
  62. return {
  63. mapLoading:false,
  64. };
  65. },
  66. methods: {
  67. initMap(AMap) {
  68. this.AMap = AMap;
  69. this.map = new AMap.Map("map", {
  70. // 设置地图容器id
  71. // viewMode: "3D", // 是否为3D地图模式
  72. zoom: 3, // 初始化地图级别
  73. center: [105.602725, 37.076636], // 初始化地图中心点位置
  74. });
  75. this.clickMarker = new this.AMap.Marker();
  76. this.addMapMarkers(this.AMap, {
  77. equList: [
  78. { lng: 105.602725, lat: 37.076636 },
  79. { lng: 113.8098755478859, lat: 34.75219686835205 },
  80. ],
  81. });
  82. // this.getEquMap();
  83. // 暂时放这里
  84. this.map.on("click", (e) => {
  85. console.log(e, "e");
  86. this.regeoCode(e.lnglat);
  87. });
  88. },
  89. // 地图覆盖物
  90. addMapMarkers(AMap, data) {
  91. // console.log(data,'data');
  92. // // 项目中心点
  93. // const centerMarker = new AMap.Marker({
  94. // position: new AMap.LngLat(data.projectLng, data.projectLat),
  95. // offset: new AMap.Pixel(-20, -20),
  96. // icon: require(`@/assets/map-icon/center.png`),
  97. // });
  98. // 设备分布点
  99. this.markers = [];
  100. data.equList.forEach((item) => {
  101. const marker = new AMap.Marker({
  102. position: new AMap.LngLat(item.lng, item.lat),
  103. offset: new AMap.Pixel(-13, -30),
  104. // icon: require(`@/assets/map-icon/${item.classifyCode}-${
  105. // item.online === 0 ? "GRAY" : item.flag ? "DEFAULT" : "DANGER"
  106. // }.png`),
  107. icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
  108. anchor: "bottom-center",
  109. extData: {
  110. id: item.id,
  111. equNo: item.equNo,
  112. netCode: data.netCode,
  113. classifyCode: item.classifyCode,
  114. flag: item.flag,
  115. online: item.online,
  116. },
  117. });
  118. this.markers.push(marker);
  119. this.map.add(marker);
  120. });
  121. // console.log('this.markers',this.markers);
  122. // const overlayGroups = new AMap.OverlayGroup(this.markers);
  123. // // 比例尺
  124. // // const scale = new AMap.Scale();
  125. // this.map.add(overlayGroups);
  126. // this.map.add(centerMarker);
  127. // this.map.addControl(scale);
  128. // // 鼠标点击marker弹出自定义的信息窗体
  129. // overlayGroups.eachOverlay((overlay, index, collections) => {
  130. // const extData = overlay.getExtData();
  131. // overlay.on("click", () => {
  132. // const params = {
  133. // netCode: extData.netCode,
  134. // equNo: extData.equNo,
  135. // };
  136. // getEquInfo(params).then((res) => {
  137. // const info = res.data;
  138. // const id = extData.id;
  139. // const currentMarker = this.markers.find(
  140. // (item) => item._opts.extData.id === id
  141. // );
  142. // currentMarker.setIcon(
  143. // require(`@/assets/map-icon/${extData.classifyCode}-${
  144. // info.online === 0 ? "GRAY" : extData.flag ? "DEFAULT" : "DANGER"
  145. // }.png`)
  146. // );
  147. // const onlineEnum = {
  148. // 0: "离线",
  149. // 1: "在线",
  150. // };
  151. // info.projectName = data.projectName;
  152. // const infoWindow = new AMap.InfoWindow({
  153. // content: `<div class="equ-info-box">
  154. // <p class="equ-info-item"><span class="label">设备编号</span><span class="value" id="equNo">${
  155. // info.equNo
  156. // }</span></p>
  157. // <p class="equ-info-item"><span class="label">当前设备状态</span><span class="value tag">${
  158. // onlineEnum[info.online]
  159. // }</span></p>
  160. // <p class="equ-info-item"><span class="label">累计报警次数</span><span class="value link" onclick="goNextPage(this, 'alarmStat')" data-equNo="${
  161. // info.equNo
  162. // }" data-name="${info.projectName}">${
  163. // info.alarmTotal
  164. // }</span></p>
  165. // <p class="equ-info-item"><span class="label">最近定位时间</span><span class="value">${
  166. // info.positionTime
  167. // }</span></p>
  168. // <p class="equ-info-item"><span class="label">TBox品牌</span><span class="value">${
  169. // info.brand
  170. // }</span></p>
  171. // <p class="equ-info-item"><span class="label">TBox编号</span><span class="value">${
  172. // info.gpsId
  173. // }</span></p>
  174. // </div>`,
  175. // anchor: "top-center",
  176. // });
  177. // infoWindow.open(this.map, overlay.getPosition());
  178. // });
  179. // });
  180. // });
  181. // // 地图的3km圆
  182. // const circle = new AMap.Circle({
  183. // center: new AMap.LngLat(data.projectLng, data.projectLat), // 圆心位置
  184. // radius: data.radius * 1000, // 半径
  185. // strokeColor: "#367EF5", // 线颜色
  186. // strokeOpacity: 0.8, // 线透明度
  187. // strokeWeight: 1, // 线粗细度
  188. // fillColor: "#18FFFC", // 填充颜色
  189. // fillOpacity: 0.1, // 填充透明度
  190. // });
  191. // this.map.add(circle);
  192. // this.map.setFitView();
  193. /* this.map.on("click", (e) => {
  194. this.regeoCode(e.lnglat);
  195. }); */
  196. },
  197. },
  198. };
  199. </script>
  200. <style lang="scss" scoped>
  201. #data-view {
  202. color: #fff;
  203. width: 100%;
  204. height: 100%;
  205. background: url(../../assets/image/bg.png);
  206. background-size: 100% 100%;
  207. background-repeat: no-repeat;
  208. // #dv-full-screen-container {
  209. // background-image: url("./img/bg.png");
  210. // background-size: 100% 100%;
  211. // box-shadow: 0 0 3px blue;
  212. // display: flex;
  213. // flex-direction: column;
  214. // position: static;
  215. // }
  216. .main {
  217. display: flex;
  218. width: 100%;
  219. padding-right: 10px;
  220. .left {
  221. width: 70%;
  222. .left-top{
  223. display: flex;
  224. .top-left{
  225. width: 30%;
  226. }
  227. .top-right{
  228. width: 70%;
  229. }
  230. }
  231. .left-under {
  232. // width: 60%;
  233. height: 30%;
  234. .under-title {
  235. flex: 1;
  236. height: 28px;
  237. font-size: 14px;
  238. margin: 10px 0;
  239. background: url(../../assets/image/title_bg.png) no-repeat;
  240. // background: url(./img/title-bg.png) no-repeat;
  241. b {
  242. font-size: 14px;
  243. color: #fff;
  244. font-style: italic;
  245. margin-left: 25px;
  246. line-height: 30px;
  247. }
  248. }
  249. .under-box {
  250. height: 200px;
  251. display: flex;
  252. }
  253. }
  254. }
  255. .right {
  256. // border: 1px solid pink;
  257. width: 30%;
  258. }
  259. }
  260. .main-header {
  261. height: 80px;
  262. display: flex;
  263. justify-content: center;
  264. align-items: flex-start;
  265. .mh-left {
  266. font-size: 20px;
  267. color: rgb(1, 134, 187);
  268. a:visited {
  269. color: rgb(1, 134, 187);
  270. }
  271. }
  272. .mh-middle {
  273. color: #1ae1e6;
  274. font-size: 24px;
  275. }
  276. .mh-left,
  277. .mh-right {
  278. width: 450px;
  279. }
  280. }
  281. // .main-container {
  282. // height: calc(~"100% - 80px");
  283. // .border-box-content {
  284. // padding: 20px;
  285. // box-sizing: border-box;
  286. // display: flex;
  287. // }
  288. // }
  289. // .left-chart-container {
  290. // width: 22%;
  291. // height: 65%;
  292. // padding: 10px;
  293. // box-sizing: border-box;
  294. // .border-box-content {
  295. // flex-direction: column;
  296. // }
  297. // }
  298. // .right-main-container {
  299. // width: 78%;
  300. // padding-left: 5px;
  301. // box-sizing: border-box;
  302. // }
  303. // .rmc-top-container {
  304. // height: 65%;
  305. // display: flex;
  306. // }
  307. // .rmctc-left-container {
  308. // width: 65%;
  309. // }
  310. // .rmctc-right-container {
  311. // width: 35%;
  312. // }
  313. // .rmc-bottom-container {
  314. // height: 35%;
  315. // }
  316. // .rmctc-chart-1,
  317. // .rmctc-chart-2 {
  318. // height: 50%;
  319. // }
  320. }
  321. </style>