index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <div class="app-container home" >
  3. <div id="main" >
  4. <seHeader />
  5. <el-row class="containWrap">
  6. <el-col class="leftWrap">
  7. <el-col class="left">
  8. <realTimeVideo alt="实时视频"/>
  9. <populationStatistics alt="人流量"/>
  10. <equipmentAlarm alt="设备告警信息" @gjxxClick="gjxxClick" />
  11. <intrusionAlarm alt="入侵告警信息" @rqgjClick="rqgjClick" />
  12. </el-col>
  13. <el-col class="right">
  14. <parkingSpace alt="停车位统计" :resInfo="data.tingche" />
  15. <conferenceRoomStatistics alt="会议室统计" @postMsg="postMsg" :resInfo="data.huiyi"/>
  16. <cnergyConsumptionStatistics alt="能耗统计" :resInfo="data.nenghao"/>
  17. <restaurant alt="智慧餐饮" @canyinClick="canyinClick" :resInfo="data.canyin"/>
  18. </el-col>
  19. </el-col>
  20. <el-col id="middleWrap" >
  21. <!-- <iframe style="width:100%;height:100%;border:none;" id="iframe" src='http://www.thingjs.com/s/ef7ee6a73896c01bda77e679?params=105b0f77fd24654d4eebc434e9'></iframe> -->
  22. <iframe style="width:100%;height:100%;border:none;" id="iframe" src='http://10.21.39.6:9000/'></iframe>
  23. </el-col>
  24. <el-col class="rightWrap">
  25. <weather alt="天气"/>
  26. <el-col class="leftR mt16">
  27. <wenyin alt="文印助手" @postMsg="postMsg" :resInfo="data.wenyin" />
  28. <iOTNetworkCard alt="物联网卡" />
  29. </el-col>
  30. <el-col class="rightR mt16 ml16">
  31. <equipmentStatus alt="设备状态" @postMsg2="postMsg2" />
  32. <fireHazard alt="消防隐患" @xfgjClick="xfgjClick" />
  33. <keepWatch alt="巡更计划" @xgClick="xgClick"/>
  34. </el-col>
  35. </el-col>
  36. </el-row>
  37. <SpringFrame v-if="springFrameState" :resInfo="springFrameItem" @close="SpringFrameClose" />
  38. <div v-if="springFrameState" class="mask"></div>
  39. <div id="loader-wrapper2" v-if="sanwei">
  40. <div id="loader2"></div>
  41. <div class="loader-section section-left"></div>
  42. <div class="loader-section section-right"></div>
  43. <div class="load_title">三维模型加载中...</div>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import axios from 'axios'
  50. import seHeader from "@/components2/seHeader"; //头部
  51. import realTimeVideo from "@/components2/realTimeVideo"; //实时视频
  52. import populationStatistics from "@/components2/populationStatistics"; //人流量统计
  53. import equipmentAlarm from "@/components2/equipmentAlarm"; //设备告警信息
  54. import intrusionAlarm from "@/components2/intrusionAlarm"; //入侵告警信息
  55. import parkingSpace from "@/components2/parkingSpace"; //停车位统计
  56. import conferenceRoomStatistics from "@/components2/conferenceRoomStatistics"; //会议室统计
  57. import cnergyConsumptionStatistics from "@/components2/cnergyConsumptionStatistics";//能耗统计
  58. import restaurant from "@/components2/restaurant";//智慧餐饮
  59. import weather from "@/components2/weather";//天气
  60. import wenyin from "@/components2/wenyin";//文印助手
  61. import iOTNetworkCard from "@/components2/iOTNetworkCard";//物联网卡状态
  62. import equipmentStatus from "@/components2/equipmentStatus";//设备状态
  63. import fireHazard from "@/components2/fireHazard";//消防状态
  64. import keepWatch from "@/components2/keepWatch";//巡更计划
  65. import SpringFrame from "@/components2/SpringFrame";//弹框
  66. // import pie1 from "@/components2/pie1";
  67. export default {
  68. name: "index",
  69. components: {
  70. seHeader,realTimeVideo,populationStatistics,equipmentAlarm,
  71. intrusionAlarm,parkingSpace,conferenceRoomStatistics,
  72. cnergyConsumptionStatistics,restaurant,weather,iOTNetworkCard,wenyin,equipmentStatus,fireHazard,
  73. keepWatch,SpringFrame
  74. },
  75. data() {
  76. return {
  77. sanwei:true,
  78. springFrameState:false,
  79. springFrameItem:{
  80. video:undefined,
  81. xg:undefined,
  82. hy:undefined,
  83. dyj:undefined,
  84. canyin:false,
  85. gjxx:undefined,
  86. rqgj:undefined,
  87. xfgj:undefined,
  88. },
  89. Pshow:false,
  90. //数据
  91. data:{
  92. tingche:{},
  93. huiyi:{},
  94. nenghao:{},
  95. canyin:{},
  96. wenyin:{}
  97. }
  98. };
  99. },
  100. created(){
  101. setTimeout(() =>{
  102. document.getElementById("middleWrap").style.zIndex= "9"
  103. this.sanwei = false
  104. },5000)
  105. axios({
  106. method: 'get',
  107. url: 'https://smartpark.caih.com/dxapi/system/config/configKey/large.json.config',
  108. timeout: 10000,
  109. }).then(res =>{
  110. this.data = JSON.parse(res.data.data)
  111. })
  112. setInterval(()=>{
  113. axios({
  114. method: 'get',
  115. url: 'https://smartpark.caih.com/dxapi/system/config/configKey/large.json.config',
  116. timeout: 10000,
  117. }).then(res =>{
  118. this.data = JSON.parse(res.data.data)
  119. })
  120. },1000*60*10)
  121. },
  122. mounted(){
  123. let that = this;
  124. window.addEventListener("message",function (event) {
  125. let isDOM = typeof event.data === "object";
  126. let data = event.data;
  127. // console.log(data)
  128. if(data.param){
  129. let name = data.param.name
  130. let id = data.param.id
  131. if(name == "会议室"){
  132. that.springFrameState = true
  133. that.springFrameItem = {}
  134. that.springFrameItem.hy = 1
  135. }else if(name == "打印机"){
  136. that.springFrameState = true
  137. that.springFrameItem = {}
  138. that.springFrameItem.dyj = 1
  139. }else{
  140. axios({
  141. method: 'post',
  142. url: 'http://10.21.39.1:8082/dhController/getLocalChannel?pageNo=1&pageSize=1&uniType=1&id=' + id,
  143. timeout: 3000,
  144. }).then(res =>{
  145. if(res.data.data.pageList.length>0){
  146. let resData = res.data.data.pageList[0]
  147. that.springFrameState = true
  148. that.springFrameItem = {}
  149. that.springFrameItem.video = resData
  150. that.springFrameItem.video.url = "http://" + resData.nvr_ip + ":" + resData.hls_port + "/live/cameraid/" + resData.deviceId + "%24" + resData.id.split("$")[(resData.id.split("$")).length-1] + "/substream/1.m3u8"
  151. }
  152. }).catch(err =>{
  153. })
  154. }
  155. }
  156. },false)
  157. },
  158. methods: {
  159. videoClick(row){//视频
  160. this.springFrameState = true
  161. this.springFrameItem = {}
  162. this.springFrameItem.video = row
  163. },
  164. xgClick(row){//巡更
  165. this.springFrameState = true
  166. this.springFrameItem = {}
  167. this.springFrameItem.xg = row
  168. },
  169. hyClick(){//会议
  170. this.springFrameState = true
  171. this.springFrameItem = {}
  172. this.springFrameItem.hy = 1
  173. },
  174. dyjClick(){//打印机
  175. this.springFrameState = true
  176. this.springFrameItem = {}
  177. this.springFrameItem.dyj = 1
  178. },
  179. canyinClick(id){//餐饮
  180. this.springFrameState = true
  181. this.springFrameItem = {}
  182. this.springFrameItem.canyin = id
  183. },
  184. gjxxClick(row){//告警信息
  185. this.springFrameState = true
  186. this.springFrameItem = {}
  187. this.springFrameItem.gjxx = row
  188. },
  189. rqgjClick(row){//入侵告警
  190. this.springFrameState = true
  191. this.springFrameItem = {}
  192. this.springFrameItem.rqgj = row
  193. },
  194. xfgjClick(row){//消防告警
  195. this.springFrameState = true
  196. this.springFrameItem = {}
  197. this.springFrameItem.xfgj = row
  198. },
  199. SpringFrameClose(){
  200. this.springFrameState = false
  201. this.springFrameItem = {}
  202. },
  203. postMsg(value) {
  204. var myframe = document.getElementById("iframe"); //获取iframe
  205. myframe.contentWindow.postMessage({ name: value }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  206. },
  207. postMsg2(value) {//视频
  208. if(value.unitType == "1"){
  209. let that = this
  210. axios({
  211. method: 'post',
  212. url: 'http://10.21.39.1:8082/dhController/getLocalChannel?pageNo=1&pageSize=1&uniType=1&id=' + value.id,
  213. timeout: 3000,
  214. }).then(res =>{
  215. if(res.data.data.pageList.length>0){
  216. let resData = res.data.data.pageList[0]
  217. that.springFrameState = true
  218. that.springFrameItem = {}
  219. that.springFrameItem.video = resData
  220. that.springFrameItem.video.url = "http://" + resData.nvr_ip + ":" + resData.hls_port + "/live/cameraid/" + resData.deviceId + "%24" + resData.id.split("$")[(resData.id.split("$")).length-1] + "/substream/1.m3u8"
  221. }
  222. }).catch(err =>{
  223. })
  224. }else if(value.unitType == "2"){
  225. var myframe = document.getElementById("iframe"); //获取iframe
  226. myframe.contentWindow.postMessage({ name: "打印机" }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  227. }
  228. // var myframe = document.getElementById("iframe"); //获取iframe
  229. // myframe.contentWindow.postMessage({ name: '摄像头',id:value.id }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  230. },
  231. postMsg3(){//视频测试
  232. var myframe = document.getElementById("iframe"); //获取iframe
  233. myframe.contentWindow.postMessage({ name: '摄像头',id:"1000002$1$0$7" }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  234. },
  235. },
  236. }
  237. </script>
  238. <style lang="scss">
  239. @import '@/assets/styles/common.scss';
  240. #main{
  241. width:100%;
  242. height:auto;
  243. margin:auto;
  244. overflow: hidden;
  245. padding:0 20px;
  246. font-family: 'MicrosoftYaHei';
  247. .containWrap{
  248. clear:both;
  249. width:100%;
  250. overflow: hidden;
  251. padding:0 !important;
  252. height:950px;
  253. margin-top:100px;
  254. .leftWrap{
  255. display: inline-block;
  256. width:1167px;
  257. position: absolute;
  258. z-index: 10;
  259. left:0;
  260. .left{
  261. width:700px;
  262. .populationStatistics{
  263. height:262px;
  264. }
  265. .equipmentAlarm,.intrusionAlarm{
  266. height:180px;
  267. }
  268. }
  269. .right{
  270. width:450px;
  271. margin-left:16px;
  272. color:$white;
  273. .parkingSpace,.conferenceRoomStatistics,.cnergyConsumptionStatistics,.restaurant{
  274. height:225px;
  275. }
  276. .restaurant{
  277. height:227px;
  278. }
  279. }
  280. }
  281. .rightWrap{
  282. position: absolute;
  283. z-index: 10;
  284. right:0;
  285. margin-left:28px;
  286. width:1166px;
  287. display: inline-block;
  288. overflow: hidden;
  289. .weather{
  290. height:9.25925vh;
  291. padding:1.57407vh 30px;
  292. overflow: hidden;
  293. }
  294. .leftR{
  295. width:449px;
  296. display: inline-block;
  297. .wenyin{
  298. height:267px;
  299. }
  300. .iOTNetworkCard{
  301. height:560px;
  302. }
  303. }
  304. .rightR{
  305. width:700px;
  306. display: inline-block;
  307. .equipmentStatus{
  308. height:267.8px;
  309. }
  310. .fireHazard,.keepWatch{
  311. height:272.8px;
  312. }
  313. }
  314. }
  315. }
  316. .mt16{
  317. margin-top:16px;
  318. }
  319. .ml16{
  320. margin-left:16px;
  321. }
  322. }
  323. #middleWrap{
  324. display: inline-block;
  325. overflow: hidden;
  326. width:100%;
  327. height:100%;
  328. border:none;
  329. position: fixed;
  330. top:0;
  331. left:0;
  332. bottom:0;
  333. right:0;
  334. z-index: -1;
  335. }
  336. .mask{
  337. position: fixed;
  338. width:100%;
  339. height:100%;
  340. background-color: rgba(0,0,0,0.5);
  341. top:0;
  342. left:0;
  343. z-index: 100;
  344. }
  345. //公共样式
  346. .modular{
  347. background:$modularBackGround;
  348. color:$white;
  349. position: relative;
  350. padding:12px 0px 0px;
  351. margin-top:1.48148vh;
  352. .title{
  353. font-size: 20px;
  354. margin-left:20px;
  355. font-family: 'MicrosoftYaHei-Bold'
  356. }
  357. .title2{
  358. margin-bottom:15px;
  359. }
  360. }
  361. .modular:nth-child(1){
  362. margin-top:0px;
  363. }
  364. #loader-wrapper2 {
  365. position: fixed;
  366. top: 0;
  367. left: 0;
  368. width: 200px;
  369. margin:0 calc(50vw - 100px);
  370. height: 100%;
  371. z-index: 0;
  372. }
  373. #loader2 {
  374. display: block;
  375. position: fixed;
  376. left: 50%;
  377. top: 50%;
  378. width: 150px;
  379. height: 150px;
  380. margin: -75px 0 0 -75px;
  381. border-radius: 50%;
  382. border: 3px solid transparent;
  383. border-top-color: #FFF;
  384. -webkit-animation: spin 2s linear infinite;
  385. -ms-animation: spin 2s linear infinite;
  386. -moz-animation: spin 2s linear infinite;
  387. -o-animation: spin 2s linear infinite;
  388. animation: spin 2s linear infinite;
  389. z-index: 1001;
  390. }
  391. #loader2:before {
  392. content: "";
  393. position: absolute;
  394. top: 5px;
  395. left: 5px;
  396. right: 5px;
  397. bottom: 5px;
  398. border-radius: 50%;
  399. border: 3px solid transparent;
  400. border-top-color: #FFF;
  401. -webkit-animation: spin 3s linear infinite;
  402. -moz-animation: spin 3s linear infinite;
  403. -o-animation: spin 3s linear infinite;
  404. -ms-animation: spin 3s linear infinite;
  405. animation: spin 3s linear infinite;
  406. }
  407. #loader2:after {
  408. content: "";
  409. position: absolute;
  410. top: 15px;
  411. left: 15px;
  412. right: 15px;
  413. bottom: 15px;
  414. border-radius: 50%;
  415. border: 3px solid transparent;
  416. border-top-color: #FFF;
  417. -moz-animation: spin 1.5s linear infinite;
  418. -o-animation: spin 1.5s linear infinite;
  419. -ms-animation: spin 1.5s linear infinite;
  420. -webkit-animation: spin 1.5s linear infinite;
  421. animation: spin 1.5s linear infinite;
  422. }
  423. @-webkit-keyframes spin {
  424. 0% {
  425. -webkit-transform: rotate(0deg);
  426. -ms-transform: rotate(0deg);
  427. transform: rotate(0deg);
  428. }
  429. 100% {
  430. -webkit-transform: rotate(360deg);
  431. -ms-transform: rotate(360deg);
  432. transform: rotate(360deg);
  433. }
  434. }
  435. @keyframes spin {
  436. 0% {
  437. -webkit-transform: rotate(0deg);
  438. -ms-transform: rotate(0deg);
  439. transform: rotate(0deg);
  440. }
  441. 100% {
  442. -webkit-transform: rotate(360deg);
  443. -ms-transform: rotate(360deg);
  444. transform: rotate(360deg);
  445. }
  446. }
  447. #loader-wrapper2 .loader-section {
  448. position: fixed;
  449. top: 0;
  450. width: 51%;
  451. height: 100%;
  452. z-index: 0;
  453. -webkit-transform: translateX(0);
  454. -ms-transform: translateX(0);
  455. transform: translateX(0);
  456. }
  457. #loader-wrapper2 .loader-section.section-left {
  458. left: 0;
  459. }
  460. #loader-wrapper2 .loader-section.section-right {
  461. right: 0;
  462. }
  463. .loaded #loader-wrapper2 .loader-section.section-left {
  464. -webkit-transform: translateX(-100%);
  465. -ms-transform: translateX(-100%);
  466. transform: translateX(-100%);
  467. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  468. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  469. }
  470. .loaded #loader-wrapper2 .loader-section.section-right {
  471. -webkit-transform: translateX(100%);
  472. -ms-transform: translateX(100%);
  473. transform: translateX(100%);
  474. -webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  475. transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  476. }
  477. .loaded #loader2 {
  478. opacity: 0;
  479. -webkit-transition: all 0.3s ease-out;
  480. transition: all 0.3s ease-out;
  481. }
  482. .loaded #loader-wrapper2 {
  483. visibility: hidden;
  484. -webkit-transform: translateY(-100%);
  485. -ms-transform: translateY(-100%);
  486. transform: translateY(-100%);
  487. -webkit-transition: all 0.3s 1s ease-out;
  488. transition: all 0.3s 1s ease-out;
  489. }
  490. .no-js #loader-wrapper2 {
  491. display: none;
  492. }
  493. .no-js h1 {
  494. color: #222222;
  495. }
  496. #loader-wrapper2 .load_title {
  497. font-family: 'Open Sans';
  498. color: #FFF;
  499. font-size: 19px;
  500. width: 100%;
  501. text-align: center;
  502. z-index: 9999999999999;
  503. position: fixed;
  504. top: 60%;
  505. left:0;
  506. opacity: 1;
  507. line-height: 30px;
  508. }
  509. #loader-wrapper2 .load_title span {
  510. font-weight: normal;
  511. font-style: italic;
  512. font-size: 13px;
  513. color: #FFF;
  514. opacity: 0.5;
  515. }
  516. </style>