index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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 class="mh-right">
  7. <img src="./img/quanping.png" alt="" @click="toggleFullscreen" v-if="!isFullscreen">
  8. <img src="./img/tuichuquanping.png" alt="" @click="toggleFullscreen" v-if="isFullscreen">
  9. </div>
  10. </div>
  11. <div class="main">
  12. <div class="left">
  13. <div class="left-top">
  14. <div class="top-left"><Left-Chart-1 /></div>
  15. <div class="top-right">
  16. <equ-map
  17. v-loading="mapLoading"
  18. @callback="initMap"
  19. height="100%"
  20. />
  21. </div>
  22. </div>
  23. <div class="left-under">
  24. <div class="under-title"><b>告警处理完成</b></div>
  25. <dv-border-box-8 class="under-box" v-if="flag">
  26. <Left-Chart-99
  27. title="SOS报警处理"
  28. :value="percentData.alarmSOS"
  29. ></Left-Chart-99>
  30. <Left-Chart-99
  31. title="电子围栏报警"
  32. :value="percentData.alarmRail"
  33. ></Left-Chart-99>
  34. <Left-Chart-99
  35. title="跌倒报警"
  36. :value="percentData.alarmFall"
  37. ></Left-Chart-99>
  38. <Left-Chart-99
  39. title="设备在线率"
  40. :value="percentData.alarmStauts"
  41. ></Left-Chart-99>
  42. <Left-Chart-99
  43. title="全部报警"
  44. :value="percentData.alarmAll"
  45. ></Left-Chart-99>
  46. </dv-border-box-8>
  47. </div>
  48. </div>
  49. <div class="right">
  50. <Left-Chart-11 />
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import LeftChart1 from "./LeftChart1";
  58. import LeftChart11 from "./LeftChart11";
  59. import LeftChart99 from "./LeftChart99";
  60. import LeftChart2 from "./LeftChart2";
  61. import LeftChart3 from "./LeftChart3";
  62. import CenterCmp from "./CenterCmp";
  63. import RightChart1 from "./RightChart1";
  64. import RightChart2 from "./RightChart2";
  65. import BottomCharts from "./BottomCharts";
  66. import equMap from "./Map.vue";
  67. import { percent, alarmList } from "@/api/system/datav";
  68. export default {
  69. name: "DataView",
  70. components: {
  71. LeftChart1,
  72. LeftChart11,
  73. LeftChart99,
  74. LeftChart2,
  75. LeftChart3,
  76. CenterCmp,
  77. RightChart1,
  78. RightChart2,
  79. BottomCharts,
  80. equMap,
  81. },
  82. data() {
  83. return {
  84. mapLoading: false,
  85. percentData: {},
  86. flag: false,
  87. isFullscreen:false,// 初始状态为非全屏
  88. };
  89. },
  90. mounted() {
  91. this.initData();
  92. },
  93. methods: {
  94. toggleFullscreen() {
  95. if (this.isFullscreen) {
  96. // 退出全屏模式
  97. if (document.exitFullscreen) {
  98. document.exitFullscreen();
  99. } else if (document.mozCancelFullScreen) {
  100. document.mozCancelFullScreen();
  101. } else if (document.webkitExitFullscreen) {
  102. document.webkitExitFullscreen();
  103. }
  104. this.isFullscreen=false;
  105. } else {
  106. // 进入全屏模式
  107. const content = document.querySelector('#data-view');
  108. // console.log(content,888);
  109. // return
  110. if (content.requestFullscreen) {
  111. content.requestFullscreen();
  112. } else if (content.mozRequestFullScreen) {
  113. content.mozRequestFullScreen();
  114. } else if (content.webkitRequestFullscreen) {
  115. content.webkitRequestFullscreen();
  116. }
  117. this.isFullscreen=true;
  118. }
  119. },
  120. initData() {
  121. percent().then((res) => {
  122. this.percentData = res.data;
  123. this.flag = true;
  124. console.log("我刚执行");
  125. });
  126. },
  127. initMap(AMap) {
  128. console.log('进来了');
  129. this.AMap = AMap;
  130. this.map = new AMap.Map("map", {
  131. // 设置地图容器id
  132. // viewMode: "3D", // 是否为3D地图模式
  133. zoom: 5, // 初始化地图级别
  134. center: [105.602725, 37.076636], // 初始化地图中心点位置
  135. });
  136. this.clickMarker = new this.AMap.Marker();
  137. alarmList().then((res) => {
  138. const data = res.data;
  139. // console.log(data, 777);
  140. this.addMapMarkers(this.AMap, data);
  141. });
  142. // this.addMapMarkers(this.AMap, {
  143. // equList: [
  144. // { lng: 105.602725, lat: 37.076636 },
  145. // { lng: 113.8098755478859, lat: 34.75219686835205 },
  146. // ],
  147. // });
  148. // this.getEquMap();
  149. // 暂时放这里
  150. // this.map.on("click", (e) => {
  151. // console.log(e, "e");
  152. // this.regeoCode(e.lnglat);
  153. // });
  154. },
  155. getCalss(type) {
  156. console.log(type, "111");
  157. let icon = "";
  158. switch (type) {
  159. case 16:
  160. icon = require(`./img/sos.png`);
  161. break;
  162. case 25:
  163. // 围栏
  164. icon = require(`./img/weilan.png`);
  165. break;
  166. }
  167. return icon;
  168. },
  169. // 地图覆盖物
  170. addMapMarkers(AMap, data) {
  171. console.log(data, "data");
  172. // // 项目中心点
  173. // const centerMarker = new AMap.Marker({
  174. // position: new AMap.LngLat(data.projectLng, data.projectLat),
  175. // offset: new AMap.Pixel(-20, -20),
  176. // icon: require(`@/assets/map-icon/center.png`),
  177. // });
  178. // 设备分布点
  179. this.markers = [];
  180. let icon = "";
  181. data.forEach((item) => {
  182. // this.getCalss(item.alarm_type);
  183. switch (item.alarm_type) {
  184. case 16:
  185. icon = require(`./img/sos.png`);
  186. break;
  187. case 17:
  188. // 跌倒
  189. icon = require(`./img/didian.png`);
  190. break;
  191. case 22:
  192. // 心率
  193. icon = require(`./img/xinlv.png`);
  194. break;
  195. case 24:
  196. icon = require(`./img/shebei.png`);
  197. break;
  198. case 25:
  199. // 围栏
  200. icon = require(`./img/weilan.png`);
  201. break;
  202. }
  203. // console.log("执行了");
  204. // console.log("icon", icon);
  205. const marker = new AMap.Marker({
  206. position: new AMap.LngLat(item.gps_long, item.gps_lat),
  207. offset: new AMap.Pixel(-13, -30),
  208. // icon: require(`./img/${item.alarm_type}-${
  209. // item.online === 0 ? "GRAY" : item.flag ? "DEFAULT" : "DANGER"
  210. // }.png`),
  211. icon: icon,
  212. extData: {
  213. id: item.id,
  214. equNo: item.equNo,
  215. netCode: data.netCode,
  216. classifyCode: item.classifyCode,
  217. flag: item.flag,
  218. online: item.online,
  219. },
  220. });
  221. this.markers.push(marker);
  222. // this.map.add(marker);
  223. });
  224. const overlayGroups = new AMap.OverlayGroup(this.markers);
  225. // 比例尺
  226. const scale = new AMap.Scale();
  227. this.map.add(overlayGroups);
  228. // this.map.add(centerMarker);
  229. this.map.addControl(scale);
  230. // 鼠标点击marker弹出自定义的信息窗体
  231. overlayGroups.eachOverlay((overlay, index, collections) => {
  232. const extData = overlay.getExtData();
  233. overlay.on("click", () => {
  234. data.forEach((item) => {
  235. console.log(item, "item");
  236. const infoWindow = new AMap.InfoWindow({
  237. content: `<div class="equ-info-box">
  238. <p class="equ-info-item"><span class="label-type">【${
  239. item.alarm_msg
  240. }】</span></p>
  241. <p class="equ-info-item"><span class="label">姓名</span><span class="value tag">${
  242. item.name ? item.name : ""
  243. }</span></p>
  244. <p class="equ-info-item"><span class="label">手机号</span><span class="value">${
  245. item.telno?item.telno:''
  246. }</span></p>
  247. <p class="equ-info-item"><span class="label">所在位置</span><span class="value">${
  248. item.address?item.address:''
  249. }</span></p>
  250. <p class="equ-info-item"><span class="label">告警时间</span><span class="value">${
  251. item.createtime?item.createtime:''
  252. }</span></p>
  253. </div>`,
  254. anchor: "top-center",
  255. });
  256. infoWindow.open(this.map, overlay.getPosition());
  257. });
  258. // const params = {
  259. // netCode: extData.netCode,
  260. // equNo: extData.equNo,
  261. // };
  262. // getEquInfo(params).then((res) => {
  263. // const info = res.data;
  264. // const id = extData.id;
  265. // const currentMarker = this.markers.find(
  266. // (item) => item._opts.extData.id === id
  267. // );
  268. // currentMarker.setIcon(
  269. // require(`@/assets/map-icon/${extData.classifyCode}-${
  270. // info.online === 0 ? "GRAY" : extData.flag ? "DEFAULT" : "DANGER"
  271. // }.png`)
  272. // );
  273. // const onlineEnum = {
  274. // 0: "离线",
  275. // 1: "在线",
  276. // };
  277. // info.projectName = data.projectName;
  278. // });
  279. });
  280. });
  281. // // 地图的3km圆
  282. // const circle = new AMap.Circle({
  283. // center: new AMap.LngLat(data.projectLng, data.projectLat), // 圆心位置
  284. // radius: data.radius * 1000, // 半径
  285. // strokeColor: "#367EF5", // 线颜色
  286. // strokeOpacity: 0.8, // 线透明度
  287. // strokeWeight: 1, // 线粗细度
  288. // fillColor: "#18FFFC", // 填充颜色
  289. // fillOpacity: 0.1, // 填充透明度
  290. // });
  291. // this.map.add(circle);
  292. // this.map.setFitView();
  293. /* this.map.on("click", (e) => {
  294. this.regeoCode(e.lnglat);
  295. }); */
  296. },
  297. },
  298. };
  299. </script>
  300. <style lang="scss" scoped>
  301. #data-view {
  302. color: #fff;
  303. width: 100%;
  304. // height: 100%;
  305. min-height: calc(100vh - 84px);
  306. background: url(../../assets/image/bg.png);
  307. background-size: 100% 100%;
  308. background-repeat: no-repeat;
  309. overflow: auto;
  310. // #dv-full-screen-container {
  311. // background-image: url("./img/bg.png");
  312. // background-size: 100% 100%;
  313. // box-shadow: 0 0 3px blue;
  314. // display: flex;
  315. // flex-direction: column;
  316. // position: static;
  317. // }
  318. .main {
  319. display: flex;
  320. width: 100%;
  321. height: 90%;
  322. min-height: calc(100vh - 84px);
  323. padding-right: 10px;
  324. .left {
  325. width: 70%;
  326. .left-top {
  327. display: flex;
  328. height: 70%;
  329. .top-left {
  330. width: 30%;
  331. }
  332. .top-right {
  333. width: 70%;
  334. }
  335. }
  336. .left-under {
  337. width: 100%;
  338. height: 30%;
  339. .under-title {
  340. flex: 1;
  341. height: 10%;
  342. font-size: 14px;
  343. margin: 10px 0;
  344. background: url(../../assets/image/title_bg.png) no-repeat;
  345. // background: url(./img/title-bg.png) no-repeat;
  346. b {
  347. font-size: 14px;
  348. color: #fff;
  349. font-style: italic;
  350. margin-left: 25px;
  351. line-height: 30px;
  352. }
  353. }
  354. .under-box {
  355. height: 90%;
  356. display: flex;
  357. }
  358. }
  359. }
  360. .right {
  361. // border: 1px solid pink;
  362. width: 30%;
  363. }
  364. }
  365. .main-header {
  366. height: 8%;
  367. width: 100%;
  368. display: flex;
  369. // justify-content: center;
  370. // align-items: flex-start;
  371. .mh-left {
  372. font-size: 20px;
  373. color: rgb(1, 134, 187);
  374. a:visited {
  375. color: rgb(1, 134, 187);
  376. }
  377. }
  378. .mh-middle {
  379. color: #1ae1e6;
  380. font-size: 24px;
  381. flex: 1;
  382. margin-left:40%;
  383. }
  384. .mh-right{
  385. width: 5%;
  386. margin-top:2%;
  387. img{
  388. width: 20px;
  389. height: 20px;
  390. }
  391. }
  392. // .mh-left,
  393. // .mh-right {
  394. // width: 450px;
  395. // }
  396. }
  397. ::v-deep.top-center {
  398. // background-color: pink;
  399. }
  400. ::v-deep.amap-info-content {
  401. // background-color: #1ae1e6;
  402. }
  403. ::v-deep.amap-info-sharp {
  404. // background-color: #1ae1e6;
  405. }
  406. ::v-deep.equ-info-box {
  407. padding: 6px 0 6px 8px;
  408. .equ-info-item {
  409. margin: 0;
  410. // margin-bottom: 8px;
  411. .label-type {
  412. color: #f00404;
  413. }
  414. &.flex {
  415. display: flex;
  416. .value {
  417. &:not(.copy) {
  418. width: 200px;
  419. }
  420. }
  421. }
  422. .label {
  423. display: inline-block;
  424. width: 60px;
  425. font-size: 13px;
  426. color: #999;
  427. }
  428. .value {
  429. color: #505050;
  430. &.link {
  431. color: #409eff;
  432. cursor: pointer;
  433. &:hover {
  434. text-decoration: underline;
  435. user-select: none;
  436. }
  437. }
  438. &.copy {
  439. padding: 0 15px;
  440. color: #409eff;
  441. cursor: pointer;
  442. }
  443. }
  444. }
  445. }
  446. // .main-container {
  447. // height: calc(~"100% - 80px");
  448. // .border-box-content {
  449. // padding: 20px;
  450. // box-sizing: border-box;
  451. // display: flex;
  452. // }
  453. // }
  454. // .left-chart-container {
  455. // width: 22%;
  456. // height: 65%;
  457. // padding: 10px;
  458. // box-sizing: border-box;
  459. // .border-box-content {
  460. // flex-direction: column;
  461. // }
  462. // }
  463. // .right-main-container {
  464. // width: 78%;
  465. // padding-left: 5px;
  466. // box-sizing: border-box;
  467. // }
  468. // .rmc-top-container {
  469. // height: 65%;
  470. // display: flex;
  471. // }
  472. // .rmctc-left-container {
  473. // width: 65%;
  474. // }
  475. // .rmctc-right-container {
  476. // width: 35%;
  477. // }
  478. // .rmc-bottom-container {
  479. // height: 35%;
  480. // }
  481. // .rmctc-chart-1,
  482. // .rmctc-chart-2 {
  483. // height: 50%;
  484. // }
  485. }
  486. </style>