Home.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. <template>
  2. <div class="home">
  3. <!-- 导航栏 -->
  4. <div class="content">
  5. <div class="content-left">
  6. <div class="left" @click="prev">
  7. <div class="left-mini"></div>
  8. </div>
  9. </div>
  10. <div class="content-center">
  11. <ul class="carousel" :style="{width: width + 'px', left: leftNum + 'px'}">
  12. <template v-for="(item, i) in list">
  13. <li class="carousel-li" :key="item.id" @click="jump(item.url)" @mouseover="onChange(i)" @mouseout="initData">
  14. <div class="box">
  15. <div class="box-line box-top-right"></div>
  16. <div class="box-line box-bottom-right"></div>
  17. <div class="box-line box-bottom-left"></div>
  18. <div class="box-line box-top-left"></div>
  19. <span>{{item.title}}</span>
  20. <div v-show="i === selectId" class="box-fixed"></div>
  21. </div>
  22. <div class="line">
  23. <div class="line-content">
  24. <div class="line-1 line-2"></div>
  25. <div :class="['line-1', line > 0 ? 'line-2' : '']"></div>
  26. <div :class="['line-1', line > 1 ? 'line-2' : '']"></div>
  27. <div :class="['line-1', line > 2 ? 'line-2' : '']"></div>
  28. <div :class="['line-1', line > 3 ? 'line-2' : '']"></div>
  29. <div :class="['line-1', line > 4 ? 'line-2' : '']"></div>
  30. </div>
  31. </div>
  32. </li>
  33. </template>
  34. </ul>
  35. </div>
  36. <div class="content-right">
  37. <div class="right" @click="next">
  38. <div class="right-mini"></div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="parent">
  43. <div class="case" v-show="selectId === 0">
  44. <div class="case-box case-left">
  45. <div class="case-title">人员管控</div>
  46. <div class="case-content">
  47. <div class="case-one">
  48. <span style=" padding-left: 20px;padding-right: 50px">正常</span>
  49. <span><strong class="sign">79</strong>人次</span>
  50. </div>
  51. <div class="case-one">
  52. <span style=" padding-left: 20px; padding-right: 50px">异常</span>
  53. <span><strong class="sign">79</strong>人次</span>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="case-center">
  58. <div class="case-title">车辆管控</div>
  59. <div class="case-content">
  60. <div class="case-one">
  61. <span style="padding-left: 20px; padding-right: 50px">洗消次数</span>
  62. <span><strong class="sign">19</strong>次</span>
  63. </div>
  64. <div class="case-one">
  65. <span style="padding-left: 20px; padding-right: 50px">平均时常</span>
  66. <span><strong class="sign">34</strong>分钟</span>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="case-center">
  71. <div class="case-title">熏蒸监管</div>
  72. <div class="case-content">
  73. <div class="case-one">
  74. <span style="padding-left: 20px; padding-right: 50px">熏蒸次数</span>
  75. <span><strong class="sign">4</strong>次</span>
  76. </div>
  77. <div class="case-one">
  78. <span style="padding-left: 20px; padding-right: 50px">平均时常</span>
  79. <span><strong class="sign">3.4</strong>小时</span>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="case-box case-right">
  84. <div class="case-title">死猪监管</div>
  85. <div class="case-content">
  86. <div class="case-one">
  87. <span style="padding-right: 40px">抓取次数</span>
  88. <span><strong class="sign">79</strong>人次</span>
  89. </div>
  90. <div class="case-one">
  91. <span style=" padding-right: 40px">最近抓取</span>
  92. <span><strong class="sign">07/01</strong></span>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="case" v-show="selectId === 1">
  98. <div class="case-box case-left">
  99. <div class="case-title">猪舍温度</div>
  100. <div class="case-content">
  101. <div class="case-one">
  102. <span style=" padding-left: 20px;padding-right: 50px">最高</span>
  103. <span><strong class="sign">{{env.maxTem}}</strong>℃</span>
  104. </div>
  105. <div class="case-one">
  106. <span style=" padding-left: 20px; padding-right: 50px">最低</span>
  107. <span><strong class="sign">{{env.minTem}}</strong>℃</span>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="case-center">
  112. <div class="case-title">猪舍湿度</div>
  113. <div class="case-content">
  114. <div class="case-one">
  115. <span style="padding-left: 40px; padding-right: 50px">最高</span>
  116. <span><strong class="sign">{{env.maxHum}}</strong>RH</span>
  117. </div>
  118. <div class="case-one">
  119. <span style="padding-left: 40px; padding-right: 50px">最低</span>
  120. <span><strong class="sign">{{env.minHum}}</strong>RH</span>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="case-center">
  125. <div class="case-title">猪场耗电量</div>
  126. <div class="case-content">
  127. <div class="case-one">
  128. <span style="padding-left: 20px; padding-right: 40px">今日累计</span>
  129. <span><strong class="sign">325</strong>kw/h</span>
  130. </div>
  131. <div class="case-one">
  132. <span style="padding-left: 20px; padding-right: 40px">本月累计</span>
  133. <span><strong class="sign">9325</strong>kw/h</span>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="case-box case-right">
  138. <div class="case-title">猪舍用水量</div>
  139. <div class="case-content">
  140. <div class="case-one">
  141. <span style="padding-right: 5px">今日累计</span>
  142. <span><strong class="sign">{{env.dayWater}}</strong>吨</span>
  143. </div>
  144. <div class="case-one">
  145. <span style=" padding-right: 5px">本月累计</span>
  146. <span><strong class="sign">{{env.monthWater}}</strong>吨</span>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="case" v-show="selectId === 2">
  152. <div class="case-box case-left">
  153. <div class="case-title">总存栏</div>
  154. <div class="case-content">
  155. <div class="case-two">
  156. <span><strong class="sign">{{pro.total ? pro.total : '设备暂无数据'}}</strong>{{pro.total ? '头' : ''}}</span>
  157. </div>
  158. </div>
  159. </div>
  160. <div class="case-center">
  161. <div class="case-title">下月预计可出栏</div>
  162. <div class="case-content">
  163. <div class="case-two">
  164. <span><strong class="sign">2354</strong>头</span>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="case-center">
  169. <div class="case-title">本月累计销售额度</div>
  170. <div class="case-content">
  171. <div class="case-two">
  172. <span><strong class="sign">{{pro.money ? pro.money : '设备暂无数据'}}</strong>{{pro.money ? '元' : ''}}</span>
  173. </div>
  174. </div>
  175. </div>
  176. <div class="case-box case-right">
  177. <div class="case-title">今日任务</div>
  178. <div class="case-content">
  179. <div class="case-two">
  180. <span><strong class="sign">{{pro.task ? pro.task : '设备暂无数据'}}</strong>{{pro.task ? '个' : ''}}</span>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. <div class="case" v-show="selectId === 3">
  186. <div class="case-box case-left">
  187. <div class="case-title">COD</div>
  188. <div class="case-content">
  189. <div class="case-two">
  190. <span><strong class="sign">7.54</strong>mg/L</span>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="case-center">
  195. <div class="case-title">累计流量</div>
  196. <div class="case-content">
  197. <div class="case-two">
  198. <span><strong class="sign">123.57</strong>T</span>
  199. </div>
  200. </div>
  201. </div>
  202. <div class="case-center">
  203. <div class="case-title">总磷</div>
  204. <div class="case-content">
  205. <div class="case-two">
  206. <span><strong class="sign">0.323</strong>mg/L</span>
  207. </div>
  208. </div>
  209. </div>
  210. <div class="case-box case-right">
  211. <div class="case-title">氨氮</div>
  212. <div class="case-content">
  213. <div class="case-two">
  214. <span><strong class="sign">0.619</strong>mg/L</span>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="case" v-show="selectId === 4">
  220. <div class="case-box case-left">
  221. <div class="case-title">今日报警</div>
  222. <div class="case-content">
  223. <div class="case-two">
  224. <span><strong class="sign">9</strong>次</span>
  225. </div>
  226. </div>
  227. </div>
  228. <div class="case-center">
  229. <div class="case-title">平均相应时间</div>
  230. <div class="case-content">
  231. <div class="case-two">
  232. <span><strong class="sign">34</strong>分钟</span>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="case-center">
  237. <div class="case-title">今日时间提醒</div>
  238. <div class="case-content">
  239. <div class="case-two">
  240. <span><strong class="sign">27</strong>次</span>
  241. </div>
  242. </div>
  243. </div>
  244. <div class="case-box case-right">
  245. <div class="case-title">未处理事件</div>
  246. <div class="case-content">
  247. <div class="case-two">
  248. <span><strong class="sign">7</strong>件</span>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <div class="home-footer">
  255. <div class="home-footer-blue"></div>
  256. <div class="home-footer-map"></div>
  257. <div class="home-footer-scatter"></div>
  258. <div :class="['home-footer-flash', isFlash ? 'flash1': '']"></div>
  259. </div>
  260. </div>
  261. </template>
  262. <script>
  263. import {getScreen, getListLargeScreen} from "@/utils/api";
  264. export default {
  265. name: "Home",
  266. data() {
  267. return {
  268. width: '',
  269. list: [
  270. {
  271. id: 1,
  272. title: '生物安全',
  273. url: '/bioSafety',
  274. },
  275. {
  276. id: 2,
  277. title: '生态监测',
  278. url: '/zoology',
  279. },
  280. {
  281. id: 3,
  282. title: '生产经营',
  283. url: '/production',
  284. },
  285. {
  286. id: 4,
  287. title: '环境监测',
  288. url: '/environment',
  289. },
  290. {
  291. id: 5,
  292. title: '报警信息',
  293. url: '/alarm',
  294. },
  295. {
  296. id: 6,
  297. title: '视频监控',
  298. url: '/monit',
  299. },
  300. ],
  301. num: 0,
  302. leftNum: 0,
  303. line: 0,
  304. // 进度条定时器
  305. timer: null,
  306. // 下面数据定时器
  307. timer2: null,
  308. selectId: 0,
  309. // 闪光
  310. isFlash: true,
  311. timer3: null,
  312. //获取当前时间
  313. timer4: null,
  314. currentTime: new Date(),
  315. env: {},
  316. pro: {},
  317. }
  318. },
  319. methods: {
  320. init() {
  321. getScreen({}).then(res => {
  322. if(res.code === 10000) {
  323. this.env = res.data;
  324. }
  325. })
  326. getListLargeScreen({}).then(res => {
  327. if(res.code === 10000) {
  328. this.pro = res.data;
  329. }
  330. })
  331. },
  332. prev() {
  333. if(this.num > 0) {
  334. this.num--;
  335. this.leftNum += 310;
  336. } else {
  337. this.num = 0;
  338. this.leftNum = 0;
  339. }
  340. },
  341. next() {
  342. if(this.num >= this.list.length - 5) {
  343. return;
  344. } else {
  345. this.num++;
  346. this.leftNum -= 310;
  347. }
  348. },
  349. initLine() {
  350. let that = this;
  351. this.timer = setInterval(() => {
  352. setTimeout(() => {
  353. if(that.line >= 5) {
  354. that.line = 0;
  355. } else {
  356. that.line++;
  357. }
  358. })
  359. }, 500)
  360. },
  361. onChange(i) {
  362. clearInterval(this.timer2);
  363. if(i > 4) {
  364. this.selectId = 4;
  365. } else {
  366. this.selectId = i;
  367. }
  368. },
  369. initData() {
  370. let that = this;
  371. this.timer2 = setInterval(() => {
  372. setTimeout(() => {
  373. if(that.selectId >= 4) {
  374. that.selectId = 0;
  375. } else {
  376. that.selectId++;
  377. }
  378. })
  379. }, 3000)
  380. },
  381. initFalsh() {
  382. let that = this;
  383. this.timer3 = setInterval(() => {
  384. setTimeout(() => {
  385. that.isFlash = !that.isFlash
  386. })
  387. }, 500)
  388. },
  389. jump(url) {
  390. this.$router.push(url);
  391. },
  392. },
  393. mounted() {
  394. this.init()
  395. this.width = this.list.length * (220 + 180) - 90;
  396. this.initLine()
  397. this.initData();
  398. this.initFalsh();
  399. },
  400. beforeDestroy() {
  401. clearInterval(this.timer);
  402. clearInterval(this.timer2);
  403. clearInterval(this.timer3);
  404. }
  405. }
  406. </script>
  407. <style scoped>
  408. .home {
  409. box-sizing: border-box;
  410. width: 100%;
  411. height: 100%;
  412. padding: 40px 0 0 0;
  413. }
  414. .left {
  415. width: 38px;
  416. height: 42px;
  417. background: url('../../assets/Home/u446.svg') no-repeat;
  418. background-size: 100% 100%;
  419. transform: rotate(180deg);
  420. position: relative;
  421. cursor: pointer;
  422. }
  423. .left-mini {
  424. width: 18px;
  425. height: 20px;
  426. background: url('../../assets/Home/u447.svg') no-repeat;
  427. background-size: 100% 100%;
  428. position: absolute;
  429. top: 11px;
  430. left: 6px;
  431. }
  432. .content {
  433. width: 100%;
  434. height: 150px;
  435. box-sizing: border-box;
  436. padding: 0 50px;
  437. display: flex;
  438. justify-content: space-between;
  439. align-items: center;
  440. }
  441. .content-center {
  442. width: 1500px;
  443. height: 100%;
  444. overflow: hidden;
  445. position: relative;
  446. }
  447. .right {
  448. width: 38px;
  449. height: 42px;
  450. background: url('../../assets/Home/u446.svg') no-repeat;
  451. background-size: 100% 100%;
  452. position: relative;
  453. cursor: pointer;
  454. }
  455. .right-mini {
  456. width: 18px;
  457. height: 20px;
  458. background: url('../../assets/Home/u447.svg') no-repeat;
  459. background-size: 100% 100%;
  460. position: absolute;
  461. top: 11px;
  462. left: 6px;
  463. }
  464. .carousel {
  465. padding: 0 10px;
  466. margin: 0;
  467. list-style: none;
  468. height: 100%;
  469. position: absolute;
  470. top: 0;
  471. left: 0;
  472. transition: left ease-in .5s;
  473. }
  474. .carousel-li {
  475. width: 220px;
  476. height: 150px;
  477. margin-right: 90px;
  478. float: left;
  479. cursor: pointer;
  480. }
  481. .carousel-li:last-child {
  482. margin-right: 0;
  483. }
  484. .box {
  485. width: 210px;
  486. height: 120px;
  487. background: url("../../assets/Home/u66.svg") no-repeat;
  488. background-size: 100% 100%;
  489. margin: 0 auto;
  490. line-height: 120px;
  491. font-size: 24px;
  492. text-align: center;
  493. font-weight: 600;
  494. color: white;
  495. position: relative;
  496. }
  497. .box-fixed {
  498. width: 205px;
  499. height: 114px;
  500. position: absolute;
  501. top: 3px;
  502. left: 3px;
  503. background: #58a;
  504. background: linear-gradient(-32deg,transparent 12px,#58a 0) bottom right,
  505. linear-gradient(32deg,transparent 12px,#58a 0) bottom left,
  506. linear-gradient(150deg,transparent 12px,#58a 0) top left,
  507. linear-gradient(-150deg,transparent 12px,#58a 0) top right;
  508. background-size: 50% 50%;
  509. background-repeat: no-repeat;
  510. opacity: .5;
  511. }
  512. .line {
  513. width: 150px;
  514. height: 17px;
  515. margin: 10px auto;
  516. border: 2px solid #218FA0;
  517. box-sizing: border-box;
  518. padding: 2px;
  519. }
  520. .line-content {
  521. width: 100%;
  522. height: 100%;
  523. display: flex;
  524. justify-content: space-around;
  525. }
  526. .line-1 {
  527. width: 19px;
  528. height: 100%;
  529. background-color: #20909E;
  530. }
  531. .line-2 {
  532. background-color: #47E7FD;
  533. }
  534. .box-line {
  535. width: 16px;
  536. height: 27px;
  537. position: absolute;
  538. }
  539. .box-top-right {
  540. background: url("../../assets/Home/u64.svg") no-repeat;
  541. background-size: 100% 100%;
  542. top: 0;
  543. right: -15px;
  544. }
  545. .box-bottom-right {
  546. background: url("../../assets/Home/u65.svg") no-repeat;
  547. background-size: 100% 100%;
  548. bottom: 0;
  549. right: -15px;
  550. }
  551. .box-bottom-left {
  552. background: url("../../assets/Home/u63.svg") no-repeat;
  553. background-size: 100% 100%;
  554. bottom: 0;
  555. left: -15px;
  556. }
  557. .box-top-left {
  558. background: url("../../assets/Home/u62.svg") no-repeat;
  559. background-size: 100% 100%;
  560. top: 0;
  561. left: -15px;
  562. }
  563. .parent {
  564. animation: flip-horizontal-bck 1.2s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
  565. }
  566. @keyframes flip-horizontal-bck {
  567. 0% {
  568. -webkit-transform: translateZ(-260px) rotateX(190deg);
  569. transform: translateZ(-260px) rotateX(190deg);
  570. }
  571. 100% {
  572. -webkit-transform: translateZ(0) rotateX(0);
  573. transform: translateZ(0) rotateX(0);
  574. }
  575. }
  576. .case {
  577. width: 1200px;
  578. height: 360px;
  579. margin: 40px auto;
  580. display: flex;
  581. justify-content: space-between;
  582. /*transition: ;*/
  583. animation: anim 1s;
  584. z-index: 999;
  585. }
  586. @keyframes anim {
  587. 0% {
  588. opacity: 0;
  589. }
  590. 100% {
  591. opacity: 1;
  592. }
  593. }
  594. .case-box {
  595. width: 240px;
  596. height: 320px;
  597. background-color: #0B5B6C;
  598. position: relative;
  599. top: 20px;
  600. box-sizing: border-box;
  601. padding: 20px;
  602. }
  603. .case-center {
  604. width: 300px;
  605. height: 320px;
  606. background-color: #0B5B6C;
  607. box-sizing: border-box;
  608. padding: 20px;
  609. }
  610. .case-left {
  611. transform: skew(0, -8deg);
  612. }
  613. .case-right {
  614. transform: skew(0, 8deg);
  615. }
  616. .case-title {
  617. background-color: #0D3952;
  618. width: 100%;
  619. height: 60px;
  620. line-height: 60px;
  621. font-size: 20px;
  622. text-align: center;
  623. font-weight: 600;
  624. color: #5DEBED;
  625. }
  626. .case-content {
  627. width: 100%;
  628. height: calc(100% - 80px);
  629. margin-top: 20px;
  630. /*text-align: center;*/
  631. }
  632. .case-one {
  633. width: 100%;
  634. line-height: 80px;
  635. font-weight: 600;
  636. font-size: 18px;
  637. color: #5DEBED;
  638. text-align: left;
  639. }
  640. .sign {
  641. font-size: 30px;
  642. }
  643. .case-two {
  644. width: 100%;
  645. line-height: 160px;
  646. font-size: 18px;
  647. color: #5DEBED;
  648. text-align: center;
  649. }
  650. .home-footer {
  651. width: 761px;
  652. height: 190px;
  653. background: url("../../assets/Home/u458.svg") no-repeat;
  654. margin: auto;
  655. background-size: 100% 100%;
  656. position: relative;
  657. }
  658. .home-footer-map {
  659. width: 658px;
  660. height: 121px;
  661. background: url("../../assets/Home/u460.svg") no-repeat;
  662. background-size: 100% 100%;
  663. position: absolute;
  664. top: 25px;
  665. left: 60px;
  666. }
  667. .home-footer-blue {
  668. width: 706px;
  669. height: 149px;
  670. background: url("../../assets/Home/u459.svg") no-repeat;
  671. background-size: 100% 100%;
  672. position: absolute;
  673. top: 13px;
  674. left: 35px;
  675. }
  676. .home-footer-scatter {
  677. width: 894px;
  678. height: 468px;
  679. background: url("../../assets/Home/u461.svg") no-repeat;
  680. background-size: 100% 100%;
  681. position: absolute;
  682. left: 52%;
  683. top: -40%;
  684. transform: translate(-50%, -50%);
  685. opacity: .1;
  686. z-index: 99;
  687. }
  688. .home-footer-flash {
  689. width: 640px;
  690. height: 500px;
  691. position: absolute;
  692. top: -80%;
  693. left: 50%;
  694. transform: translate(-50%, -50%);
  695. background: linear-gradient(to bottom, rgba(4, 5, 26, .1), rgba(4, 5, 26, .3));
  696. }
  697. .flash1 {
  698. background: linear-gradient(to bottom, rgba(102, 255, 255, .1), rgba(102, 255, 255, .3));
  699. /*background-color: rgba(102, 255, 255, .2);*/
  700. }
  701. </style>