SensorInfoStatistics.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div class="item SensorInfoStatistics">
  3. <div class="title">
  4. <span class="name">区域入侵预警<span class="number" style="padding-left:10px;">{{total}}</span></span>
  5. <span class="detail" @click="linkTo">详情>></span>
  6. </div>
  7. <div class="container">
  8. <!-- <div id="sensor-info-chart" v-if="status"></div> -->
  9. <!-- <div class="warn-item" @click="showWarnModel">
  10. <div class="tag" v-if="warnInfo.goafName">{{NumConvertLM(warnInfo.goafOrebelt)}}-{{warnInfo.goafOrebody}}-{{warnInfo.goafOreheight}}-{{warnInfo.goafName}}</div>
  11. </div> -->
  12. <el-carousel trigger="click" height="120px" indicator-position="none" arrow="always" :autoplay="false" :loop="false">
  13. <el-carousel-item v-for="(items,index) in warnList" :key="index" >
  14. <div class="warn-item-box">
  15. <div class="warn-item warning" @click="showWarnModel(item)" v-for="(item,_index) in items" :key="_index">
  16. <div class="tag">{{NumConvertLM(item.goafOrebelt)}}-{{item.goafOrebody}}-{{item.goafOreheight}}-{{item.goafName}}</div>
  17. </div>
  18. </div>
  19. </el-carousel-item>
  20. </el-carousel>
  21. </div>
  22. <div class="video-dialog" v-if="videoDialogVisible">
  23. <div class="video-dialog-container">
  24. <div class="header">
  25. <div class="name">
  26. <!-- <span v-if="warnInfo.goafName">{{NumConvertLM(warnInfo.goafOrebelt)}}-{{warnInfo.goafOrebody}}-{{warnInfo.goafOreheight}}-{{warnInfo.goafName}}</span> -->
  27. <span>区域入侵预警</span>
  28. </div>
  29. <div class="close" @click="videoDialogVisible=false"><el-icon><Close /></el-icon></div>
  30. </div>
  31. <!-- <video :src="video.src" id="video" controls></video> -->
  32. <div class="demo-image__preview" v-if="capturePhotos.length>0">
  33. <el-image
  34. style="width: 100px; height: 100px"
  35. :src="capturePhotos[0]"
  36. :zoom-rate="1.2"
  37. :preview-src-list="capturePhotos"
  38. :initial-index="4"
  39. fit="cover"
  40. />
  41. </div>
  42. <HkwsVideo ref="HkwsVideo"></HkwsVideo>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import * as echarts from 'echarts';
  49. import { goafdevstatis,goafCameraAlarmNumber,goafCameraAlarm} from '@/api/goaf/sensor'
  50. import { NumConvertLM } from '@/utils'
  51. import HkwsVideo from '@/components/HkwsVideo/iframe.vue'
  52. export default {
  53. name:"SensorInfoStatistics",
  54. components:{
  55. HkwsVideo
  56. },
  57. data(){
  58. return{
  59. status:true,
  60. warn_status:0,
  61. total:0,
  62. videoDialogVisible:false,
  63. warnList:[],
  64. warnInfo:{
  65. "goafOrebody": "",
  66. "goafOrebelt": "",
  67. "goafOreheight": "",
  68. "fileUrl": "",
  69. "goafDevIp": "",
  70. "ocId": undefined,
  71. "goafName": ""
  72. },
  73. capturePhotos:[],
  74. option :{
  75. title:[
  76. {
  77. text:"压力",
  78. textStyle:{
  79. color:'#fff',
  80. fontSize:12
  81. },
  82. left:'26%',
  83. bottom:'2px'
  84. },
  85. {
  86. text:"位移",
  87. textStyle:{
  88. color:'#fff',
  89. fontSize:12
  90. },
  91. left:'52%',
  92. bottom:'2px'
  93. }
  94. // ,{
  95. // text:"有害气体",
  96. // textStyle:{
  97. // color:'#fff',
  98. // fontSize:12
  99. // },
  100. // left:'74%',
  101. // bottom:'2px'
  102. // }
  103. ],
  104. tooltip: {
  105. trigger: 'item'
  106. },
  107. legend: {
  108. top: '1%',
  109. left: 'center',
  110. textStyle:{
  111. color:'#fff'
  112. }
  113. },
  114. series: [
  115. {
  116. name: '压力',
  117. type: 'pie',
  118. radius: ['35%', '50%'],
  119. center:['30%', '52%'],
  120. avoidLabelOverlap: false,
  121. itemStyle: {
  122. borderRadius: 1,
  123. borderColor: '#fff',
  124. borderWidth: 1
  125. },
  126. label: {
  127. show: false,
  128. color:'#fff',
  129. position: 'center'
  130. },
  131. emphasis: {
  132. label: {
  133. show: true,
  134. fontSize: 10,
  135. fontWeight: 'bold'
  136. }
  137. },
  138. labelLine: {
  139. show: false
  140. },
  141. data: [
  142. { value: 0, name: '异常',itemStyle:{color:'#D4603C'} },
  143. { value: 0, name: '正常' ,itemStyle:{color:'#3CD495'}}
  144. ]
  145. },
  146. {
  147. name: '位移',
  148. type: 'pie',
  149. radius: ['35%', '50%'],
  150. center:['55%', '52%'],
  151. avoidLabelOverlap: false,
  152. itemStyle: {
  153. borderRadius: 1,
  154. borderColor: '#fff',
  155. borderWidth: 1
  156. },
  157. label: {
  158. show: false,
  159. color:'#fff',
  160. position: 'center'
  161. },
  162. emphasis: {
  163. label: {
  164. show: true,
  165. fontSize: 10,
  166. fontWeight: 'bold'
  167. }
  168. },
  169. labelLine: {
  170. show: false
  171. },
  172. data: [
  173. { value: 0, name: '异常',itemStyle:{color:'#D4603C'} },
  174. { value: 0, name: '正常' ,itemStyle:{color:'#3CD495'}}
  175. ]
  176. },
  177. {
  178. name: '有害气体',
  179. type: 'pie',
  180. radius: ['35%', '50%'],
  181. center:['80%', '52%'],
  182. avoidLabelOverlap: false,
  183. itemStyle: {
  184. borderRadius: 1,
  185. borderColor: '#fff',
  186. borderWidth: 1
  187. },
  188. label: {
  189. show: false,
  190. color:'#fff',
  191. position: 'center'
  192. },
  193. emphasis: {
  194. label: {
  195. show: true,
  196. fontSize: 10,
  197. fontWeight: 'bold'
  198. }
  199. },
  200. labelLine: {
  201. show: false
  202. },
  203. data: [
  204. { value: 0, name: '异常',itemStyle:{color:'#D4603C'} },
  205. { value: 0, name: '正常' ,itemStyle:{color:'#3CD495'}}
  206. ]
  207. }
  208. ]
  209. }
  210. }
  211. },
  212. created(){
  213. this.$nextTick(()=>{
  214. this.reload()
  215. })
  216. },
  217. methods:{
  218. NumConvertLM,
  219. init(){
  220. // var chartDom = document.getElementById('sensor-info-chart');
  221. // var myChart = echarts.init(chartDom);
  222. // this.option && myChart.setOption(this.option);
  223. // myChart.on('click', (params)=> {
  224. // // console.log("SensorInfoStatistics",params)
  225. // this.$router.push({
  226. // path: '/particulars/sensor',
  227. // query: {
  228. // id: '1'
  229. // }
  230. // })
  231. // });
  232. }
  233. ,reload(){
  234. this.$nextTick(()=>{
  235. this.goafCameraAlarmNumber()
  236. this.goafCameraAlarm()
  237. })
  238. },
  239. warn(data){
  240. // this.warnInfo=data
  241. // $('.SensorInfoStatistics').find('.warn-item').addClass('warning')
  242. this.goafCameraAlarm()
  243. this.goafCameraAlarmNumber()
  244. },
  245. showWarnModel(item){
  246. this.videoDialogVisible=true
  247. if(item){
  248. let warn_info=JSON.parse(JSON.stringify(item))
  249. this.warnInfo=warn_info
  250. this.warnInfo.fileUrl=warn_info.goafSnapPicurl
  251. }
  252. this.capturePhotos=[this.warnInfo.fileUrl]
  253. let warnInfo=item?item:this.warnInfo
  254. let state=true
  255. if(this.isNull(warnInfo.goafDevSocketAddr)){
  256. state="未配置推流地址"
  257. console.error('未配置推流地址')
  258. return
  259. }
  260. if(this.isNull(this.warnInfo.goafDevIp)){
  261. state="未配置设备IP"
  262. console.error(state)
  263. return
  264. }
  265. if(this.isNull(this.warnInfo.goafDevPort)){
  266. state="未配置设备端口"
  267. console.error(state)
  268. return
  269. }
  270. if(this.isNull(this.warnInfo.goafDevAccount)){
  271. state="未配置设备账号"
  272. console.error(state)
  273. return
  274. }
  275. if(this.isNull(this.warnInfo.goafDevPwd)){
  276. state="未配置设备密码"
  277. console.error(state)
  278. return
  279. }
  280. this.$nextTick(()=>{
  281. this.$refs.HkwsVideo.loadData({
  282. streamServeUrl:this.warnInfo.goafDevSocketAddr,
  283. szIP: this.warnInfo.goafDevIp, // protocol ip
  284. szPort: this.warnInfo.goafDevPort, // protocol port
  285. szUsername:this.warnInfo.goafDevAccount, // device username
  286. szPassword: this.warnInfo.goafDevPwd, // device password
  287. })
  288. })
  289. },
  290. // 获取所有采空区摄像头告警数量
  291. goafCameraAlarmNumber(){
  292. goafCameraAlarmNumber({
  293. goafAlarmStatus:0
  294. }).then((res)=>{
  295. this.total=res.data
  296. })
  297. },
  298. //获取所有采空区摄像头告警信息
  299. goafCameraAlarm(){
  300. goafCameraAlarm({
  301. goafAlarmStatus:0
  302. }).then((res)=>{
  303. this.warnList=this.getDataSource(res.data)
  304. })
  305. },
  306. goafdevstatis(){
  307. let option =JSON.parse(JSON.stringify(this.option))
  308. goafdevstatis().then((res)=>{
  309. this.total=res.data.goafDevTotalNum
  310. })
  311. },
  312. linkTo(){
  313. this.$router.push({
  314. path: '/goafCameraAlarm'
  315. })
  316. },
  317. getDataSource(dataList=[],n=4) {
  318. let newDataList = []
  319. let current = 0
  320. if(dataList && dataList.length>0){
  321. for(let i=0;i<=dataList.length-1;i++){
  322. if(i%n !== 0 || i === 0 ){
  323. if(!newDataList[current]){
  324. newDataList.push([dataList[i]])
  325. }else{
  326. newDataList[current].push(dataList[i])
  327. }
  328. }else{
  329. current++
  330. newDataList.push([dataList[i]])
  331. }
  332. }
  333. }
  334. return [...newDataList]
  335. },
  336. isNull(val){
  337. if(val===undefined||val==="undefined"||val===null||val===""){
  338. return true
  339. }
  340. return false
  341. },
  342. },
  343. destroyed() {
  344. this.status=false
  345. },
  346. }
  347. </script>
  348. <style lang="scss" scoped>
  349. .container{
  350. height: 12vh;
  351. #sensor-info-chart{
  352. width: 95%;
  353. height: 100%;
  354. }
  355. }
  356. .demo-image__preview{
  357. padding:0 0 10px 20px;
  358. }
  359. .video-dialog{
  360. position: fixed;
  361. z-index: 9999;
  362. left: 10px;
  363. top: 0;
  364. right: 10px;
  365. bottom: 0;
  366. background-color: rgba(222, 229, 236, 0.45);
  367. display: flex;
  368. justify-content: center;
  369. align-items: center;
  370. .video-dialog-container{
  371. width: 860px;
  372. height: 70%;
  373. max-width: 80%;
  374. background-color: #051933;
  375. border-radius: 20px;
  376. margin: 20px auto;
  377. }
  378. .name{
  379. color: #fff;
  380. font-size: 20px;
  381. line-height:1 ;
  382. text-indent: 20px;
  383. }
  384. .header{
  385. display: flex;
  386. justify-content: space-between;
  387. align-items: center;
  388. .close{
  389. height: 50px;
  390. line-height: 50px;
  391. display: inline-block;
  392. padding: 10px 20px;
  393. cursor: pointer;
  394. color: #fff;
  395. font-size: 36px;
  396. }
  397. }
  398. #video{
  399. display: block;
  400. width: 80%;
  401. max-height: 80vh;
  402. box-shadow: 2px 2px 4px rgba(0,0,0,0.6);
  403. margin: 10px auto;
  404. }
  405. }
  406. .warn-item-box{
  407. display: flex;
  408. align-items: center;
  409. .warn-item{
  410. width: 100px;
  411. height: 100px;
  412. position: relative;
  413. margin-left: 15px;
  414. display: none;
  415. .tag{
  416. width: 110px;
  417. display: inline-block;
  418. background: #21649c;
  419. overflow:hidden;
  420. text-overflow:ellipsis;
  421. white-space:nowrap;
  422. color: #fff;
  423. text-align: center;
  424. z-index: 9;
  425. position: absolute;
  426. bottom: -4px;
  427. font-size: 12px;
  428. line-height: 1;
  429. padding: 2px 0;
  430. }
  431. &::after{
  432. display: block;
  433. content: "";
  434. height: 60%;
  435. width: 60%;
  436. border-radius: 50% 50% 10% 10%;
  437. position: absolute;
  438. transform: translate(-50%,-50%);
  439. left: 50%;
  440. top: 50%;
  441. z-index: 9;
  442. background-image: radial-gradient(#dee7f6, #797878);
  443. box-shadow: 0 0 20px #fff;
  444. }
  445. }
  446. .warning {
  447. display: block;
  448. &::after{
  449. background-image: radial-gradient(yellow,red);
  450. animation: twinkle 0.5s infinite alternate;
  451. box-shadow: 0 0 20px red;
  452. }
  453. }
  454. }
  455. /*动画*/
  456. @keyframes twinkle {
  457. 0% {opacity: 0.9;}
  458. 50% {opacity: 0.5;}
  459. 100% {opacity: 0;}
  460. }
  461. </style>