Home.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. <template>
  2. <div class="home">
  3. <section class="top">
  4. <div class="left">
  5. <div class="left-1">
  6. <div class="chart-tab-title">生物防控</div>
  7. <div class="charts">
  8. <E-Left1 style="height: 100%"></E-Left1>
  9. </div>
  10. </div>
  11. <div class="left-2">
  12. <div class="chart-tab-title">环保信息</div>
  13. <div class="content">
  14. <article class="item"><span class="text-white">COD:</span>{{environmentdData.hxxyl}}mg/L</article>
  15. <article class="item"><span class="text-white">氨氮:</span>{{environmentdData.ad}}mg/L</article>
  16. <article class="item"><span class="text-white">流量:</span>{{environmentdData.ws}}T/H</article>
  17. <article class="item"><span class="text-white">累计流量:</span>{{environmentdData.wslj}}T</article>
  18. <article class="item"><span class="text-white">总磷:</span>{{environmentdData.zl}}mg/L</article>
  19. <article class="item"><span class="text-white">总氮:</span>{{environmentdData.zd}}mg/L</article>
  20. <article class="item"><span class="text-white">PH:</span>{{environmentdData.ph}}</article>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="center">
  25. <div class="header_title">
  26. <span class="date">
  27. {{
  28. `${new Date().getFullYear()}-${
  29. new Date().getMonth() + 1
  30. }-${new Date().getDate()}`
  31. }}
  32. </span>
  33. <div class="title">首 页</div>
  34. <!-- <img class="icon" src="../../assets/chilun.png" />-->
  35. </div>
  36. <div class="number">
  37. <div class="item" v-for="(item, i) in listData" :key="i">
  38. <div>
  39. <span class="title">{{item.name}}:</span>
  40. <span class="num">{{item.num}}只</span>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="main_img_box">
  45. <imgDragScale :img="img" @openVideo="openVideo"></imgDragScale>
  46. </div>
  47. </div>
  48. <div class="right">
  49. <div class="right-1">
  50. <div class="chart-tab-title">机器人巡逻</div>
  51. <div class="content">
  52. <img src="../../assets/robot.gif" width="100%" />
  53. <div class="describe">
  54. <span>1号机器人巡查中</span>
  55. <span>当前位置1栋3单元</span>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="right-2">
  60. <div class="chart-tab-title">报警信息</div>
  61. <div class="msg-tab-body">
  62. <div class="cell" v-for="(item, i) in callList" :key="i">
  63. <span class="cell-default">{{item.ZSMC}}:</span>
  64. <span>{{item.gzxx}}</span>
  65. <span style="float: right;">{{item.dates}}</span>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </section>
  71. <footer class="footer">
  72. <div class="video">
  73. <div class="video-content" @click="toVideo">
  74. <div class="chart-tab-title">视频监控</div>
  75. <div class="camera">
  76. <iframe ref="iframe" :src="'static/index.html?'+'1'+'&'+ cameraOne +'&'+ cameraTwo + '&' +'100%' + '&' + '0'" style="width: 100%; height: 90%;" frameborder="0"></iframe>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="swiper">
  81. <swiperMulti @onOpen="onOpen" @openItem="openItem"></swiperMulti>
  82. </div>
  83. <div class="control-log">
  84. <div class="control-content">
  85. <div class="chart-tab-title">控制日志</div>
  86. <div class="msg-tab-body">
  87. <div class="cell">
  88. <span class="cell-default">位置</span>
  89. <span style="margin-left: 80px">照明时长</span>
  90. <span style="float: right;">开始时间</span>
  91. </div>
  92. <div class="cell" v-for="(item, i) in controlLog" :key="i">
  93. <span class="cell-default">{{item.zsmc}}</span>
  94. <span style="margin-left: 65px">{{item.durations}}分钟</span>
  95. <span style="float: right;">{{item.xgsj}}</span>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </footer>
  101. <el-dialog
  102. :title="item.position + '环境监测曲线'"
  103. :visible.sync="isShow"
  104. width="50%"
  105. >
  106. <div style="padding: 20px; height: 400px;">
  107. <e-line1 v-if="num%2 !== 0 && isShow" :id="item.lqid"></e-line1>
  108. <e-line2 v-else-if="num%2 === 0 && isShow" :id="item.lqid"></e-line2>
  109. </div>
  110. </el-dialog>
  111. <el-dialog
  112. :title="lists.position + '环境监测曲线'"
  113. :visible.sync="isQk"
  114. width="50%">
  115. <div style="padding: 20px; height: 400px;">
  116. <chartLine v-if="isQk" :echartsList="echartsList"></chartLine>
  117. </div>
  118. </el-dialog>
  119. <el-dialog
  120. :title="pList[0] + '栋' + pList[1] +'号舍视频监控'"
  121. :visible.sync="isVideo"
  122. width="60%"
  123. >
  124. <div style="padding: 20px;">
  125. <div style="width: 1100px; height: 580px;">
  126. <iframe v-if="isVideo" :src="'static/index.html?'+'0'+'&' + cameraOne +'&'+ cameraTwo + '&' + '100%' + '&' + '0'" frameborder="0" style="height: 100%; width: 100%"></iframe>
  127. </div>
  128. </div>
  129. </el-dialog>
  130. </div>
  131. </template>
  132. <script>
  133. import imgDragScale from "@/components/imgDragScale";
  134. import swiperMulti from "./swiperMulti";
  135. import ELeft1 from "./charts/ELeft1";
  136. import ELine1 from "./charts/Eline1";
  137. import ELine2 from "./charts/Eline2";
  138. import chartLine from "./charts/chartLine";
  139. import img from "@/assets/u62.png";
  140. import utils from "../../utils/utils.js";
  141. let timer, timer1, timer2
  142. export default {
  143. name: "Home",
  144. data() {
  145. return {
  146. img,
  147. isShow: false,
  148. isVideo: false,
  149. item: {
  150. position: ''
  151. },
  152. num: 0,
  153. // 栋舍
  154. pList: [],
  155. environmentdData: {
  156. hxxyl: '',
  157. ad: '',
  158. ws: '',
  159. wslj: '',
  160. zl: '',
  161. zd: '',
  162. ph: ''
  163. },
  164. // 报警信息
  165. callList: [],
  166. // 保育
  167. listData: [],
  168. cameraOne: 'ws://183.246.182.241:10080/camera_relay?tcpaddr=admin%3Atx123456%40192.168.1.25',
  169. cameraTwo: 'rtsp://admin:tx123456@192.168.1.25',
  170. screenWidth: '',
  171. // 水量
  172. echartsList: [],
  173. isQk: false,
  174. lists: {},
  175. // 控制日志
  176. logList: [],
  177. setIval: 1,
  178. controlLog: []
  179. };
  180. },
  181. components: {
  182. imgDragScale,
  183. ELeft1,
  184. swiperMulti,
  185. ELine1,
  186. ELine2,
  187. chartLine
  188. },
  189. watch: {
  190. isShow(newVal) {
  191. if(newVal == false) {
  192. clearInterval(timer);
  193. }
  194. }
  195. },
  196. created() {},
  197. methods: {
  198. onOpen(i) {
  199. this.isShow = true;
  200. this.item = i;
  201. this.setInvaler();
  202. },
  203. initList() {
  204. this.$http.post('http://122.112.252.100:8095/dpSjlrSyS/find')
  205. .then(res => {
  206. if(res.code === 10000) {
  207. this.listData= [];
  208. Object.keys(res.data).forEach(key => {
  209. this.listData.push({name: key, num: res.data[key]});
  210. });
  211. }
  212. })
  213. },
  214. init() {
  215. this.$http.get('/environment/details')
  216. .then(res => {
  217. if(res.code === 10000) {
  218. this.environmentdData = res.data;
  219. }
  220. });
  221. this.$http.get('http://122.112.252.100:8081/face/alarm')
  222. .then(res => {
  223. if(res.code === 10001) {
  224. res.data.forEach(item => {
  225. let dates = utils.resolverTime(item.FSSJ);
  226. item.dates = dates;
  227. });
  228. this.callList = res.data;
  229. }
  230. });
  231. this.$http.get('http://122.112.252.100:8085/environment/getZMInfo')
  232. .then(res => {
  233. if(res.code === 10000) {
  234. res.data.forEach(item => {
  235. let xgsj = utils.resolverTime(item.xgsj);
  236. item.xgsj = xgsj;
  237. });
  238. this.controlLog = res.data;
  239. console.log(res.data);
  240. }
  241. });
  242. },
  243. openVideo(data) {
  244. if(data.id == null) {
  245. this.$message.error('暂无该栋舍的视频信息')
  246. this.isVideo = false;
  247. } else {
  248. this.isVideo = true;
  249. this.pList = data.position.split('-');
  250. this.$http.post('http://122.112.252.100:8088/cameraInfo/getCameraDetails', {areaIds: data.id})
  251. .then(res => {
  252. if(res.status === 10000) {
  253. // this.showIfrme = true;
  254. let data = null;
  255. data = res.data[0];
  256. this.cameraOne = data.wsUrl;
  257. this.cameraTwo = data.rtspUrl;
  258. } else {
  259. this.showIfrme = false;
  260. this.$message.err(res.msg);
  261. }
  262. })
  263. }
  264. },
  265. setInvaler() {
  266. timer = setInterval(() => {
  267. this.num++;
  268. }, 8000)
  269. },
  270. setInit() {
  271. let that = this;
  272. timer1 = setInterval(() => {
  273. this.init();
  274. }, 3600000);
  275. },
  276. openItem(data) {
  277. let item = data.item;
  278. this.lists = item;
  279. let i = data.index;
  280. let arr1 = [];
  281. let arr2 = [];
  282. let arr3 = [];
  283. if(i === 1) {
  284. arr1 = Object.values(item.slLists);
  285. arr2 = Object.keys(item.slLists);
  286. arr3 = ['水量', '吨'];
  287. this.echartsList = [arr1, arr2, arr3];
  288. } else if( i === 2) {
  289. arr1 = Object.values(item.dlLists);
  290. arr2 = Object.keys(item.dlLists);
  291. arr3 = ['电量', 'kwh'];
  292. this.echartsList = [arr1, arr2, arr3];
  293. } else if(i===3) {
  294. arr1 = Object.values(item.phLists);
  295. arr2 = Object.keys(item.phLists);
  296. arr3 = ['ph', ''];
  297. this.echartsList = [arr1, arr2, arr3];
  298. } else if(i === 4) {
  299. arr1 = Object.values(item.syLists);
  300. arr2 = Object.keys(item.syLists);
  301. arr3 = ['水压', 'Mpa'];
  302. this.echartsList = [arr1, arr2, arr3];
  303. }
  304. this.isQk = true;
  305. },
  306. // 跳转到监控页面
  307. toVideo() {
  308. this.$router.push('/monitor')
  309. console.log('------------------------------');
  310. },
  311. // 首页监控轮播
  312. setInitCremar() {
  313. timer2 = setInterval(() => {
  314. if(this.setIval === 1) {
  315. this.cameraOne = "ws://183.246.182.241:10080/camera_relay?tcpaddr=admin%3Atx123456%40192.168.1.25";
  316. this.cameraTwo = "rtsp://admin:tx123456@192.168.1.25";
  317. } else if (this.setIval === 2) {
  318. this.cameraOne = "ws://183.246.182.241:10080/camera_relay?tcpaddr=admin%3Atx123456%40192.168.1.31";
  319. this.cameraTwo = "rtsp://admin:tx123456@192.168.1.31";
  320. } else if (this.setIval === 3) {
  321. this.setIval = 0;
  322. this.cameraOne = "ws://183.246.182.241:10080/camera_relay?tcpaddr=admin%3Atx123456%40192.168.1.50";
  323. this.cameraTwo = "rtsp://admin:tx123456@192.168.1.50";
  324. }
  325. this.setIval++;
  326. }, 10000)
  327. }
  328. },
  329. mounted() {
  330. this.init();
  331. this.setInit();
  332. this.initList();
  333. this.setInitCremar()
  334. },
  335. beforeRouteLeave(to, from, next) {
  336. clearInterval(timer1);
  337. clearInterval(timer);
  338. clearInterval(timer2)
  339. next();
  340. }
  341. };
  342. </script>
  343. <style lang="scss" scope>
  344. .home {
  345. box-sizing: border-box;
  346. flex-grow: 1;
  347. color: #eee;
  348. display: flex;
  349. flex-direction: column;
  350. > .top {
  351. // border: 1px solid rgb(13, 165, 212);
  352. height: 67%;
  353. display: flex;
  354. > .left {
  355. width: 21%;
  356. > div {
  357. height: calc(50% - 5px);
  358. /*background: url(../../assets/box_bg.png) no-repeat;*/
  359. /*background-size: 100% 100%;*/
  360. display: flex;
  361. flex-direction: column;
  362. border-radius: 8px;
  363. overflow: hidden;
  364. }
  365. > .left-1 {
  366. margin: 0 10px 10px 10px;
  367. .charts {
  368. flex-grow: 1;
  369. background-color: #001346;
  370. }
  371. }
  372. > .left-2 {
  373. margin: 0 10px;
  374. .content {
  375. padding: 20px;
  376. flex-grow: 1;
  377. display: flex;
  378. flex-wrap: wrap;
  379. justify-content: space-around;
  380. background-color: #001346;
  381. > .item {
  382. width: 44%;
  383. background-color: #060a2d;
  384. color: #81d3f8;
  385. padding: 5px;
  386. margin-left: 6px;
  387. height: 25px;
  388. line-height: 25px;
  389. font-size: 0.9rem;
  390. overflow: hidden;
  391. text-overflow: ellipsis;
  392. white-space: nowrap;
  393. .text-white {
  394. color: white;
  395. }
  396. }
  397. }
  398. }
  399. }
  400. > .center {
  401. // border: 1px solid rgb(212, 13, 195);
  402. width: 58%;
  403. max-width: 1250px;
  404. flex-grow: 2.6;
  405. flex-shrink: 0;
  406. display: flex;
  407. flex-direction: column;
  408. align-items: center;
  409. > .header_title {
  410. width: 90%;
  411. color: #fff;
  412. display: flex;
  413. justify-content: space-around;
  414. margin: 5px 3%;
  415. .date {
  416. vertical-align: middle;
  417. font-size: 1.2rem;
  418. // display: flex;
  419. // align-items: center;
  420. display: -webkit-box;
  421. -webkit-box-align: center;
  422. -webkit-box-pack: center;
  423. }
  424. .title {
  425. flex-grow: 1;
  426. font-size: 1.4rem;
  427. text-align: center;
  428. display: flex;
  429. align-items: center;
  430. &::before {
  431. content: "";
  432. border: 1px solid #06dfff;
  433. box-sizing: border-box;
  434. height: 0px;
  435. flex-grow: 1;
  436. margin: 0 30px;
  437. }
  438. &::after {
  439. content: "";
  440. border: 1px solid #06dfff;
  441. box-sizing: border-box;
  442. height: 0px;
  443. flex-grow: 1;
  444. margin: 0 30px;
  445. }
  446. }
  447. .icon {
  448. width: 30px;
  449. height: 30px;
  450. }
  451. }
  452. > .number {
  453. // border: 1px solid rgb(212, 13, 195);
  454. width: 92%;
  455. display: flex;
  456. justify-content: space-around;
  457. margin: 10px 0;
  458. .item {
  459. height: 50px;
  460. width: 26%;
  461. // min-width: 200px;
  462. // max-width: 280px;
  463. // flex: 1 1 10%;
  464. box-sizing: border-box;
  465. border: 2px solid #53bafd;
  466. border-radius: 12px;
  467. background-color: #001346;
  468. font-size: 1.1vw;
  469. font-weight: 600;
  470. display: flex;
  471. justify-content: center;
  472. align-items: center;
  473. .title {
  474. color: #fff;
  475. }
  476. .num {
  477. color: #53bafd;
  478. font-size: 1vw;
  479. }
  480. }
  481. }
  482. > .main_img_box {
  483. // border: 1px solid rgb(212, 13, 195);
  484. flex-grow: 1;
  485. width: 93%;
  486. }
  487. }
  488. > .right {
  489. width: 21%;
  490. flex-grow: 1;
  491. > .right-1 {
  492. height: calc(50% - 5px);
  493. /*background: url(../../assets/box_bg.png) no-repeat;*/
  494. /*background-size: 100% 100%;*/
  495. margin: 0 10px 10px 10px;
  496. border-radius: 8px;
  497. overflow: hidden;
  498. display: flex;
  499. flex-direction: column;
  500. .content {
  501. flex-grow: 1;
  502. /*margin: 10px 15px;*/
  503. overflow: hidden;
  504. background-color: #001346;
  505. padding: 10px 15px;
  506. > img {
  507. box-sizing: border-box;
  508. border: 1px solid #eee;
  509. border-radius: 10px;
  510. }
  511. > .describe {
  512. color: #04d919;
  513. display: flex;
  514. justify-content: space-around;
  515. align-items: center;
  516. height: 20%;
  517. min-height: 20px;
  518. }
  519. }
  520. }
  521. > .right-2 {
  522. height: calc(50% - 5px);
  523. /*background: url(../../assets/box_bg.png) no-repeat;*/
  524. /*background-size: 100% 100%;*/
  525. margin: 0 10px;
  526. display: flex;
  527. border-radius: 8px;
  528. overflow: hidden;
  529. flex-direction: column;
  530. .msg-tab-body {
  531. overflow-y: scroll;
  532. flex-grow: 1;
  533. padding: 15px 20px;
  534. /*overflow: hidden;*/
  535. background-color: #001346;
  536. > .cell {
  537. background-color: #060a2d;
  538. overflow: hidden;
  539. text-overflow: ellipsis;
  540. white-space: nowrap;
  541. margin: 3px 0;
  542. padding: 5px;
  543. color: #F56C6C;
  544. .cell-default {
  545. color: #81d3f8;
  546. }
  547. }
  548. }
  549. .msg-tab-body::-webkit-scrollbar {
  550. /*滚动条整体样式*/
  551. width : 5px; /*高宽分别对应横竖滚动条的尺寸*/
  552. height: 1px;
  553. }
  554. .msg-tab-body::-webkit-scrollbar-thumb {
  555. /*滚动条里面小方块*/
  556. border-radius : 8px;
  557. background-color: #535353;
  558. background-image: -webkit-linear-gradient(
  559. 45deg,
  560. rgba(255, 255, 255, 0.2) 25%,
  561. transparent 25%,
  562. transparent 50%,
  563. rgba(255, 255, 255, 0.2) 50%,
  564. rgba(255, 255, 255, 0.2) 75%,
  565. transparent 75%,
  566. transparent
  567. );
  568. }
  569. .msg-tab-body::-webkit-scrollbar-track {
  570. /*滚动条里面轨道*/
  571. box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
  572. /*background : #ededed;*/
  573. border-radius: 10px;
  574. }
  575. }
  576. }
  577. }
  578. > .footer {
  579. display: flex;
  580. margin-top: 10px;
  581. height: 33.3%;
  582. justify-content: space-between;
  583. > .video {
  584. width: 21%;
  585. height: 100%;
  586. margin: 0 10px;
  587. > .video-content {
  588. cursor: pointer;
  589. width: 100%;
  590. height: 100%;
  591. border-radius: 8px;
  592. // margin: 0 10px;
  593. background-color: #001346;
  594. // display: flex;
  595. // flex-direction: column;
  596. overflow: hidden;
  597. > .camera {
  598. padding: 35px 0;
  599. width: 100%;
  600. height: 100%;
  601. }
  602. }
  603. }
  604. > .swiper {
  605. width: 61%;
  606. }
  607. > .control-log {
  608. width: 21%;
  609. height: 100%;
  610. margin: 0 10px;
  611. > .control-content {
  612. display: flex;
  613. border-radius: 8px;
  614. overflow: hidden;
  615. flex-direction: column;
  616. background-color: #001346;
  617. width: 100%;
  618. height: 100%;
  619. overflow: auto;
  620. .msg-tab-body {
  621. overflow-y: scroll;
  622. flex-grow: 1;
  623. padding: 15px 20px;
  624. /*overflow: hidden;*/
  625. background-color: #001346;
  626. > .cell {
  627. background-color: #060a2d;
  628. overflow: hidden;
  629. text-overflow: ellipsis;
  630. white-space: nowrap;
  631. margin: 3px 0;
  632. padding: 5px;
  633. color: #F56C6C;
  634. .cell-default {
  635. color: #81d3f8;
  636. }
  637. }
  638. }
  639. .msg-tab-body::-webkit-scrollbar {
  640. /*滚动条整体样式*/
  641. width : 5px; /*高宽分别对应横竖滚动条的尺寸*/
  642. height: 1px;
  643. }
  644. .msg-tab-body::-webkit-scrollbar-thumb {
  645. /*滚动条里面小方块*/
  646. border-radius : 8px;
  647. background-color: #535353;
  648. background-image: -webkit-linear-gradient(
  649. 45deg,
  650. rgba(255, 255, 255, 0.2) 25%,
  651. transparent 25%,
  652. transparent 50%,
  653. rgba(255, 255, 255, 0.2) 50%,
  654. rgba(255, 255, 255, 0.2) 75%,
  655. transparent 75%,
  656. transparent
  657. );
  658. }
  659. .msg-tab-body::-webkit-scrollbar-track {
  660. /*滚动条里面轨道*/
  661. box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2);
  662. /*background : #ededed;*/
  663. border-radius: 10px;
  664. }
  665. }
  666. }
  667. }
  668. }
  669. .chart-tab-title {
  670. position: relative;
  671. padding: 5px 0 5px 90px ;
  672. background-color: rgb(14,30,81);
  673. }
  674. .chart-tab-title:before {
  675. content: "";
  676. width: 14px;
  677. height: 14px;
  678. border-radius: 50%;
  679. position: absolute;
  680. left: 70px;
  681. top: 50%;
  682. background-color: #fff;
  683. transform: translateY(-50%);
  684. -ms-transform: translateY(-50%);
  685. -moz-transform: translateY(-50%);
  686. -webkit-transform: translateY(-50%);
  687. -o-transform: translateY(-50%);
  688. }
  689. .footer {
  690. overflow: hidden;
  691. }
  692. .my-swipe .van-swipe-item {
  693. color: #fff;
  694. font-size: 20px;
  695. line-height: 150px;
  696. text-align: center;
  697. background-color: #39a9ed;
  698. }
  699. .el-dialog {
  700. background-color: #021429 !important;
  701. }
  702. .el-dialog__title {
  703. color: white !important;
  704. }
  705. </style>