index.vue 13 KB

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