index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <div id="data-view">
  3. <top-header />
  4. <div class="main">
  5. <div class="left">
  6. <div class="left-top">
  7. <dv-border-box-13 class="left-border">
  8. <Border-Item title="设备总览1"> <aaa /></Border-Item>
  9. </dv-border-box-13>
  10. </div>
  11. <div class="left-content">
  12. <dv-border-box-13 class="left-border">
  13. <Border-Item title="设备总览2"><middleLeftChart /></Border-Item>
  14. </dv-border-box-13>
  15. </div>
  16. <div class="left-under">
  17. <dv-border-box-13 class="left-border">
  18. <Border-Item title="设备总览3"><Left-Chart-3 /></Border-Item>
  19. </dv-border-box-13>
  20. </div>
  21. </div>
  22. <div class="content">
  23. <!-- 22 -->
  24. <div>
  25. <equ-map v-loading="mapLoading" @callback="initMap" height="400px" />
  26. </div>
  27. <div class="left-under">
  28. <dv-border-box-13 class="left-border">
  29. <Border-Item title="设备总览4"><Left-Chart-4 /></Border-Item>
  30. </dv-border-box-13>
  31. </div>
  32. </div>
  33. <div class="right">
  34. <div class="left-top">
  35. <dv-border-box-13 class="left-border">
  36. <Border-Item title="设备总览5"> <aaa /></Border-Item>
  37. </dv-border-box-13>
  38. </div>
  39. <div class="left-content">
  40. <dv-border-box-13 class="left-border">
  41. <Border-Item title="设备总览6"><Left-Chart-2 /></Border-Item>
  42. </dv-border-box-13>
  43. </div>
  44. <div class="left-under">
  45. <dv-border-box-13 class="left-border">
  46. <Border-Item title="设备总览7"
  47. ><dv-scroll-board :config="config" />></Border-Item
  48. >
  49. </dv-border-box-13>
  50. </div>
  51. </div>
  52. </div>
  53. <!-- <dv-border-box-3 class="left-chart-container">
  54. </dv-border-box-3> -->
  55. <!-- <div class="right-main-container">
  56. <div class="rmc-top-container">
  57. <dv-border-box-3 class="rmctc-left-container">
  58. <Center-Cmp />
  59. </dv-border-box-3>
  60. <div class="rmctc-right-container">
  61. <dv-border-box-3 class="rmctc-chart-1">
  62. <Right-Chart-1 />
  63. </dv-border-box-3>
  64. <dv-border-box-4 class="rmctc-chart-2" :reverse="true">
  65. <Right-Chart-2 />
  66. </dv-border-box-4>
  67. </div>
  68. </div>
  69. <dv-border-box-4 class="rmc-bottom-container">
  70. <Bottom-Charts />
  71. </dv-border-box-4>
  72. </div> -->
  73. </div>
  74. </template>
  75. <script>
  76. import topHeader from "./topHeader";
  77. import LeftChart1 from "./LeftChart1";
  78. import LeftChart2 from "./LeftChart2";
  79. import LeftChart3 from "./LeftChart3";
  80. import LeftChart4 from "./LeftChart4";
  81. import middleLeftChart from "./middleLeftChart.vue";
  82. import aaa from "./aaa";
  83. import equMap from "./Maps";
  84. import CenterCmp from "./CenterCmp";
  85. import RightChart1 from "./RightChart1";
  86. import RightChart2 from "./RightChart2";
  87. import BottomCharts from "./BottomCharts";
  88. import BorderItem from "./BottomCharts";
  89. export default {
  90. name: "DataView",
  91. components: {
  92. topHeader,
  93. LeftChart1,
  94. LeftChart2,
  95. LeftChart3,
  96. LeftChart4,
  97. CenterCmp,
  98. RightChart1,
  99. RightChart2,
  100. BottomCharts,
  101. BorderItem,
  102. equMap,
  103. aaa,
  104. middleLeftChart,
  105. },
  106. data() {
  107. return {
  108. mapLoading: false,
  109. config: {
  110. data: [
  111. ["行1列1", "行1列2", "行1列3"],
  112. ["行2列1", "行2列2", "行2列3"],
  113. ["行3列1", "行3列2", "行3列3"],
  114. ["行4列1", "行4列2", "行4列3"],
  115. ["行5列1", "行5列2", "行5列3"],
  116. ["行6列1", "行6列2", "行6列3"],
  117. ["行7列1", "行7列2", "行7列3"],
  118. ["行8列1", "行8列2", "行8列3"],
  119. ["行9列1", "行9列2", "行9列3"],
  120. ["行10列1", "行10列2", "行10列3"],
  121. ],
  122. index: true,
  123. rowNum: 3, // 表行数
  124. columnWidth: [50],
  125. align: ["center"],
  126. },
  127. };
  128. },
  129. methods: {
  130. initMap(AMap) {
  131. this.AMap = AMap;
  132. this.map = new AMap.Map("map", {
  133. // 设置地图容器id
  134. // viewMode: "3D", // 是否为3D地图模式
  135. zoom: 3, // 初始化地图级别
  136. center: [105.602725, 37.076636], // 初始化地图中心点位置
  137. });
  138. this.clickMarker = new this.AMap.Marker();
  139. this.addMapMarkers(this.AMap, {
  140. equList: [
  141. { lng: 105.602725, lat: 37.076636 },
  142. { lng: 113.8098755478859, lat: 34.75219686835205 },
  143. ],
  144. });
  145. // this.getEquMap();
  146. // 暂时放这里
  147. this.map.on("click", (e) => {
  148. console.log(e, "e");
  149. this.regeoCode(e.lnglat);
  150. });
  151. },
  152. // 地图覆盖物
  153. addMapMarkers(AMap, data) {
  154. // console.log(data,'data');
  155. // // 项目中心点
  156. // const centerMarker = new AMap.Marker({
  157. // position: new AMap.LngLat(data.projectLng, data.projectLat),
  158. // offset: new AMap.Pixel(-20, -20),
  159. // icon: require(`@/assets/map-icon/center.png`),
  160. // });
  161. // 设备分布点
  162. this.markers = [];
  163. data.equList.forEach((item) => {
  164. const marker = new AMap.Marker({
  165. position: new AMap.LngLat(item.lng, item.lat),
  166. offset: new AMap.Pixel(-13, -30),
  167. // icon: require(`@/assets/map-icon/${item.classifyCode}-${
  168. // item.online === 0 ? "GRAY" : item.flag ? "DEFAULT" : "DANGER"
  169. // }.png`),
  170. icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
  171. anchor: "bottom-center",
  172. extData: {
  173. id: item.id,
  174. equNo: item.equNo,
  175. netCode: data.netCode,
  176. classifyCode: item.classifyCode,
  177. flag: item.flag,
  178. online: item.online,
  179. },
  180. });
  181. this.markers.push(marker);
  182. this.map.add(marker);
  183. });
  184. // console.log('this.markers',this.markers);
  185. // const overlayGroups = new AMap.OverlayGroup(this.markers);
  186. // // 比例尺
  187. // // const scale = new AMap.Scale();
  188. // this.map.add(overlayGroups);
  189. // this.map.add(centerMarker);
  190. // this.map.addControl(scale);
  191. // // 鼠标点击marker弹出自定义的信息窗体
  192. // overlayGroups.eachOverlay((overlay, index, collections) => {
  193. // const extData = overlay.getExtData();
  194. // overlay.on("click", () => {
  195. // const params = {
  196. // netCode: extData.netCode,
  197. // equNo: extData.equNo,
  198. // };
  199. // getEquInfo(params).then((res) => {
  200. // const info = res.data;
  201. // const id = extData.id;
  202. // const currentMarker = this.markers.find(
  203. // (item) => item._opts.extData.id === id
  204. // );
  205. // currentMarker.setIcon(
  206. // require(`@/assets/map-icon/${extData.classifyCode}-${
  207. // info.online === 0 ? "GRAY" : extData.flag ? "DEFAULT" : "DANGER"
  208. // }.png`)
  209. // );
  210. // const onlineEnum = {
  211. // 0: "离线",
  212. // 1: "在线",
  213. // };
  214. // info.projectName = data.projectName;
  215. // const infoWindow = new AMap.InfoWindow({
  216. // content: `<div class="equ-info-box">
  217. // <p class="equ-info-item"><span class="label">设备编号</span><span class="value" id="equNo">${
  218. // info.equNo
  219. // }</span></p>
  220. // <p class="equ-info-item"><span class="label">当前设备状态</span><span class="value tag">${
  221. // onlineEnum[info.online]
  222. // }</span></p>
  223. // <p class="equ-info-item"><span class="label">累计报警次数</span><span class="value link" onclick="goNextPage(this, 'alarmStat')" data-equNo="${
  224. // info.equNo
  225. // }" data-name="${info.projectName}">${
  226. // info.alarmTotal
  227. // }</span></p>
  228. // <p class="equ-info-item"><span class="label">最近定位时间</span><span class="value">${
  229. // info.positionTime
  230. // }</span></p>
  231. // <p class="equ-info-item"><span class="label">TBox品牌</span><span class="value">${
  232. // info.brand
  233. // }</span></p>
  234. // <p class="equ-info-item"><span class="label">TBox编号</span><span class="value">${
  235. // info.gpsId
  236. // }</span></p>
  237. // </div>`,
  238. // anchor: "top-center",
  239. // });
  240. // infoWindow.open(this.map, overlay.getPosition());
  241. // });
  242. // });
  243. // });
  244. // // 地图的3km圆
  245. // const circle = new AMap.Circle({
  246. // center: new AMap.LngLat(data.projectLng, data.projectLat), // 圆心位置
  247. // radius: data.radius * 1000, // 半径
  248. // strokeColor: "#367EF5", // 线颜色
  249. // strokeOpacity: 0.8, // 线透明度
  250. // strokeWeight: 1, // 线粗细度
  251. // fillColor: "#18FFFC", // 填充颜色
  252. // fillOpacity: 0.1, // 填充透明度
  253. // });
  254. // this.map.add(circle);
  255. // this.map.setFitView();
  256. /* this.map.on("click", (e) => {
  257. this.regeoCode(e.lnglat);
  258. }); */
  259. },
  260. },
  261. };
  262. </script>
  263. <style lang="less">
  264. #data-view {
  265. width: 100%;
  266. height: 100%;
  267. background-color: #030409;
  268. color: #fff;
  269. overflow: hidden;
  270. background-image: url("./img/bg.png");
  271. background-size: 100%;
  272. background-repeat: no-repeat;
  273. // #dv-full-screen-container {
  274. // background-image: url("./img/bg.png");
  275. // background-size: 100% 100%;
  276. // box-shadow: 0 0 3px blue;
  277. // display: flex;
  278. // flex-direction: column;
  279. // }
  280. .main {
  281. display: flex;
  282. padding: 0 10px 10px 10px;
  283. box-sizing: border-box;
  284. .left {
  285. width: 30%;
  286. // box-sizing: border-box;
  287. .left-top {
  288. margin-top: 10px;
  289. .left-border {
  290. height: 200px;
  291. }
  292. }
  293. .left-content {
  294. margin-top: 10px;
  295. .left-border {
  296. height: 200px;
  297. }
  298. }
  299. .left-under {
  300. margin-top: 10px;
  301. .left-border {
  302. height: 200px;
  303. }
  304. }
  305. }
  306. // .content {
  307. // flex: 1;
  308. // }
  309. .content {
  310. // width: 30%;
  311. flex: 1;
  312. // box-sizing: border-box;
  313. .left-top {
  314. margin-top: 10px;
  315. .left-border {
  316. height: 200px;
  317. }
  318. }
  319. .left-content {
  320. margin-top: 10px;
  321. .left-border {
  322. height: 200px;
  323. }
  324. }
  325. .left-under {
  326. margin-top: 10px;
  327. .left-border {
  328. height: 200px;
  329. }
  330. }
  331. }
  332. .right {
  333. width: 30%;
  334. // box-sizing: border-box;
  335. .left-top {
  336. margin-top: 10px;
  337. .left-border {
  338. height: 200px;
  339. }
  340. }
  341. .left-content {
  342. margin-top: 10px;
  343. .left-border {
  344. height: 200px;
  345. }
  346. }
  347. .left-under {
  348. margin-top: 10px;
  349. .left-border {
  350. height: 200px;
  351. }
  352. }
  353. .datav-cell {
  354. text-overflow: ellipsis;
  355. overflow: hidden;
  356. white-space: nowrap;
  357. }
  358. }
  359. }
  360. .main-header {
  361. height: 80px;
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: flex-end;
  365. .mh-left {
  366. font-size: 20px;
  367. color: rgb(1, 134, 187);
  368. a:visited {
  369. color: rgb(1, 134, 187);
  370. }
  371. }
  372. .mh-middle {
  373. font-size: 30px;
  374. }
  375. .mh-left,
  376. .mh-right {
  377. width: 450px;
  378. }
  379. }
  380. .main-container {
  381. height: calc(~"100% - 80px");
  382. .border-box-content {
  383. padding: 20px;
  384. box-sizing: border-box;
  385. display: flex;
  386. }
  387. }
  388. .left-chart-container {
  389. width: 22%;
  390. padding: 10px;
  391. box-sizing: border-box;
  392. .border-box-content {
  393. flex-direction: column;
  394. }
  395. }
  396. .right-main-container {
  397. width: 78%;
  398. padding-left: 5px;
  399. box-sizing: border-box;
  400. }
  401. .rmc-top-container {
  402. height: 65%;
  403. display: flex;
  404. }
  405. .rmctc-left-container {
  406. width: 65%;
  407. }
  408. .rmctc-right-container {
  409. width: 35%;
  410. }
  411. .rmc-bottom-container {
  412. height: 35%;
  413. }
  414. .rmctc-chart-1,
  415. .rmctc-chart-2 {
  416. height: 50%;
  417. }
  418. }
  419. </style>