index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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="停车位统计"/>
  15. <conferenceRoomStatistics alt="会议室统计" @postMsg="postMsg"/>
  16. <cnergyConsumptionStatistics alt="能耗统计"/>
  17. <restaurant alt="智慧餐饮" @canyinClick="canyinClick" />
  18. </el-col>
  19. </el-col>
  20. <el-col class="middleWrap">
  21. <!-- <iframe style="width:100%;height:100%;border:none;position: absolute;z-index: 9;background-color: rgba(28,33,41,1);" id="iframe" src='https://www.thingjs.com/s/ef7ee6a73896c01bda77e679?params=105b0f77fd24654d4eebc434e9'></iframe> -->
  22. </el-col>
  23. <el-col class="rightWrap">
  24. <weather alt="天气"/>
  25. <el-col class="leftR mt16">
  26. <wenyin alt="文印助手" @postMsg="postMsg"/>
  27. <iOTNetworkCard alt="文印助手"/>
  28. </el-col>
  29. <el-col class="rightR mt16 ml16">
  30. <equipmentStatus alt="设备状态" @postMsg2="postMsg2" />
  31. <fireHazard alt="消防隐患" @xfgjClick="xfgjClick" />
  32. <keepWatch alt="巡更计划" @xgClick="xgClick"/>
  33. </el-col>
  34. </el-col>
  35. </el-row>
  36. <SpringFrame v-if="springFrameState" :resInfo="springFrameItem" @close="SpringFrameClose" />
  37. <div v-if="springFrameState" class="mask"></div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import axios from 'axios'
  43. import seHeader from "@/components2/seHeader"; //头部
  44. import realTimeVideo from "@/components2/realTimeVideo"; //实时视频
  45. import populationStatistics from "@/components2/populationStatistics"; //人流量统计
  46. import equipmentAlarm from "@/components2/equipmentAlarm"; //设备告警信息
  47. import intrusionAlarm from "@/components2/intrusionAlarm"; //入侵告警信息
  48. import parkingSpace from "@/components2/parkingSpace"; //停车位统计
  49. import conferenceRoomStatistics from "@/components2/conferenceRoomStatistics"; //会议室统计
  50. import cnergyConsumptionStatistics from "@/components2/cnergyConsumptionStatistics";//能耗统计
  51. import restaurant from "@/components2/restaurant";//智慧餐饮
  52. import weather from "@/components2/weather";//天气
  53. import wenyin from "@/components2/wenyin";//文印助手
  54. import iOTNetworkCard from "@/components2/iOTNetworkCard";//物联网卡状态
  55. import equipmentStatus from "@/components2/equipmentStatus";//设备状态
  56. import fireHazard from "@/components2/fireHazard";//消防状态
  57. import keepWatch from "@/components2/keepWatch";//巡更计划
  58. import SpringFrame from "@/components2/SpringFrame";//弹框
  59. // import pie1 from "@/components2/pie1";
  60. export default {
  61. name: "index",
  62. components: {
  63. seHeader,realTimeVideo,populationStatistics,equipmentAlarm,
  64. intrusionAlarm,parkingSpace,conferenceRoomStatistics,
  65. cnergyConsumptionStatistics,restaurant,weather,iOTNetworkCard,wenyin,equipmentStatus,fireHazard,
  66. keepWatch,SpringFrame
  67. },
  68. data() {
  69. return {
  70. springFrameState:false,
  71. springFrameItem:{
  72. video:undefined,
  73. xg:undefined,
  74. hy:undefined,
  75. dyj:undefined,
  76. canyin:false,
  77. gjxx:undefined,
  78. rqgj:undefined,
  79. xfgj:undefined,
  80. }
  81. };
  82. },
  83. created(){
  84. // setTimeout(() =>{
  85. // console.log(12121212)
  86. // this.postMsg3()
  87. // },30000)
  88. },
  89. mounted(){
  90. let that = this;
  91. window.addEventListener("message",function (event) {
  92. let isDOM = typeof event.data === "object";
  93. let data = event.data;
  94. // console.log(data)
  95. if(data.param){
  96. let name = data.param.name
  97. let id = data.param.id
  98. if(name == "会议室"){
  99. that.springFrameState = true
  100. that.springFrameItem = {}
  101. that.springFrameItem.hy = 1
  102. }else if(name == "打印机"){
  103. that.springFrameState = true
  104. that.springFrameItem = {}
  105. that.springFrameItem.dyj = 1
  106. }else{
  107. axios({
  108. method: 'post',
  109. url: 'http://10.21.39.1:8082/dhController/getLocalChannel?pageNo=1&pageSize=1&uniType=1&id=' + id,
  110. timeout: 3000,
  111. }).then(res =>{
  112. if(res.data.data.pageList.length>0){
  113. let resData = res.data.data.pageList[0]
  114. that.springFrameState = true
  115. that.springFrameItem = {}
  116. that.springFrameItem.video = resData
  117. 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"
  118. }
  119. }).catch(err =>{
  120. })
  121. }
  122. }
  123. },false)
  124. },
  125. methods: {
  126. videoClick(row){//视频
  127. this.springFrameState = true
  128. this.springFrameItem = {}
  129. this.springFrameItem.video = row
  130. },
  131. xgClick(row){//巡更
  132. this.springFrameState = true
  133. this.springFrameItem = {}
  134. this.springFrameItem.xg = row
  135. },
  136. hyClick(){//会议
  137. this.springFrameState = true
  138. this.springFrameItem = {}
  139. this.springFrameItem.hy = 1
  140. },
  141. dyjClick(){//打印机
  142. this.springFrameState = true
  143. this.springFrameItem = {}
  144. this.springFrameItem.dyj = 1
  145. },
  146. canyinClick(id){//餐饮
  147. this.springFrameState = true
  148. this.springFrameItem = {}
  149. this.springFrameItem.canyin = id
  150. },
  151. gjxxClick(row){//告警信息
  152. this.springFrameState = true
  153. this.springFrameItem = {}
  154. this.springFrameItem.gjxx = row
  155. },
  156. rqgjClick(row){//入侵告警
  157. this.springFrameState = true
  158. this.springFrameItem = {}
  159. this.springFrameItem.rqgj = row
  160. },
  161. xfgjClick(row){//消防告警
  162. this.springFrameState = true
  163. this.springFrameItem = {}
  164. this.springFrameItem.xfgj = row
  165. },
  166. SpringFrameClose(){
  167. this.springFrameState = false
  168. this.springFrameItem = {}
  169. },
  170. postMsg(value) {
  171. var myframe = document.getElementById("iframe"); //获取iframe
  172. myframe.contentWindow.postMessage({ name: value }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  173. },
  174. postMsg2(value) {//视频
  175. if(value.unitType == "1"){
  176. let that = this
  177. axios({
  178. method: 'post',
  179. url: 'http://10.21.39.1:8082/dhController/getLocalChannel?pageNo=1&pageSize=1&uniType=1&id=' + value.id,
  180. timeout: 3000,
  181. }).then(res =>{
  182. if(res.data.data.pageList.length>0){
  183. let resData = res.data.data.pageList[0]
  184. that.springFrameState = true
  185. that.springFrameItem = {}
  186. that.springFrameItem.video = resData
  187. 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"
  188. }
  189. }).catch(err =>{
  190. })
  191. }else if(value.unitType == "2"){
  192. var myframe = document.getElementById("iframe"); //获取iframe
  193. myframe.contentWindow.postMessage({ name: "打印机" }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  194. }
  195. // var myframe = document.getElementById("iframe"); //获取iframe
  196. // myframe.contentWindow.postMessage({ name: '摄像头',id:value.id }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  197. },
  198. postMsg3(){//视频测试
  199. var myframe = document.getElementById("iframe"); //获取iframe
  200. myframe.contentWindow.postMessage({ name: '摄像头',id:"1000002$1$0$7" }, "*"); //childDomain是子页面的源(协议+主机+端口号)
  201. },
  202. },
  203. }
  204. </script>
  205. <style lang="scss">
  206. @import '@/assets/styles/common.scss';
  207. #main{
  208. width:100%;
  209. height:auto;
  210. margin:auto;
  211. overflow: hidden;
  212. padding:0 20px;
  213. font-family: 'MicrosoftYaHei';
  214. .containWrap{
  215. clear:both;
  216. width:100%;
  217. overflow: hidden;
  218. padding:0 !important;
  219. height:950px;
  220. margin-top:100px;
  221. .leftWrap{
  222. display: inline-block;
  223. width:1167px;
  224. position: absolute;
  225. z-index: 10;
  226. left:0;
  227. .left{
  228. width:700px;
  229. .populationStatistics{
  230. height:262px;
  231. }
  232. .equipmentAlarm,.intrusionAlarm{
  233. height:180px;
  234. }
  235. }
  236. .right{
  237. width:450px;
  238. margin-left:16px;
  239. color:$white;
  240. .parkingSpace,.conferenceRoomStatistics,.cnergyConsumptionStatistics,.restaurant{
  241. height:225px;
  242. }
  243. .restaurant{
  244. height:227px;
  245. }
  246. }
  247. }
  248. .rightWrap{
  249. position: absolute;
  250. z-index: 10;
  251. right:0;
  252. margin-left:28px;
  253. width:1166px;
  254. display: inline-block;
  255. overflow: hidden;
  256. .weather{
  257. height:9.25925vh;
  258. padding:1.57407vh 30px;
  259. overflow: hidden;
  260. }
  261. .leftR{
  262. width:449px;
  263. display: inline-block;
  264. .wenyin{
  265. height:267px;
  266. }
  267. .iOTNetworkCard{
  268. height:550px;
  269. }
  270. }
  271. .rightR{
  272. width:700px;
  273. display: inline-block;
  274. .equipmentStatus,.fireHazard,.keepWatch{
  275. height:267.8px;
  276. }
  277. }
  278. }
  279. }
  280. .mt16{
  281. margin-top:16px;
  282. }
  283. .ml16{
  284. margin-left:16px;
  285. }
  286. }
  287. .middleWrap{
  288. display: inline-block;
  289. overflow: hidden;
  290. width:100%;
  291. height:100%;
  292. border:none;
  293. position: fixed;
  294. top:0;
  295. left:0;
  296. bottom:0;
  297. right:0;
  298. z-index: 9;
  299. }
  300. .mask{
  301. position: fixed;
  302. width:100%;
  303. height:100%;
  304. background-color: rgba(0,0,0,0.5);
  305. top:0;
  306. left:0;
  307. z-index: 100;
  308. }
  309. //公共样式
  310. .modular{
  311. background:$modularBackGround;
  312. color:$white;
  313. position: relative;
  314. padding:12px 0px 0px;
  315. margin-top:1.48148vh;
  316. .title{
  317. font-size: 20px;
  318. margin-left:20px;
  319. font-family: 'MicrosoftYaHei-Bold'
  320. }
  321. .title2{
  322. margin-bottom:15px;
  323. }
  324. }
  325. .modular:nth-child(1){
  326. margin-top:0px;
  327. }
  328. </style>