sensor.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <div class="sensor-page">
  3. <header>
  4. <div :class="activeId===item.id?'active item':'item'" v-for="item in items" :key="item.id" @click="changeHead(item)">{{ item.name }}</div>
  5. </header>
  6. <div class="tab">
  7. <el-select v-model="conditions.goafOrebelt" placeholder="矿带" @change="changeArea(1)" style="width:120px" clearable>
  8. <el-option v-for="(item,index) in goafOrebelts" :key="index" :value="item" :label="item" />
  9. </el-select>
  10. <el-select v-model="conditions.goafOrebody" placeholder="矿体" @change="changeArea(2)" style="width:120px;margin:0 12px;">
  11. <el-option v-for="(item,index) in goafOrebodys" :key="index" :value="item.goafOrebody" :label="item.goafOrebody" />
  12. </el-select>
  13. <el-select v-model="conditions.goafOreheight" placeholder="中段" @change="changeArea(3)" style="width:120px">
  14. <el-option v-for="(item,index) in goafOreheights" :key="index" :value="item.goafOreheight" :label="item.goafOreheight" />
  15. </el-select>
  16. <el-select v-model="conditions.goafId" placeholder="采空区编号" @change="changeArea(4)" style="width:210px;margin:0 12px;">
  17. <el-option v-for="item in goafNames" :key="item.goafId" :value="item.goafId" :label="item.goafName" />
  18. </el-select>
  19. </div>
  20. <div class="container">
  21. <div class="lf">
  22. <div class="search-container">
  23. <div class="search-item">
  24. <el-input v-model="conditions.goafDevName" class="input" placeholder="请输入传感器名称" />
  25. </div>
  26. <div class="search-item">
  27. <span>预警等级:</span>
  28. <el-select v-model="conditions.hdangerLevel" placeholder="全部" style="width:120px;margin-right:14px;" clearable>
  29. <el-option
  30. v-for="item in hdangerLevels"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value"
  34. />
  35. </el-select>
  36. </div>
  37. <!-- <div class="search-item">
  38. <span>状态:</span>
  39. <el-select v-model="conditions.status" class="select" placeholder="全部">
  40. <el-option
  41. v-for="item in options"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value"
  45. />
  46. </el-select>
  47. </div> -->
  48. <div class="search-item">
  49. <!-- <span>预警开始时间:</span> -->
  50. <el-date-picker
  51. v-model="conditions.expectedStartDate"
  52. type="datetime"
  53. placeholder="预警开始时间"
  54. format="YYYY-MM-DD HH:mm:ss"
  55. value-format="YYYY-MM-DD HH:mm:ss"
  56. style="width:200px;margin-right: 14px;"
  57. />
  58. </div>
  59. <div class="search-item">
  60. <!-- <span>预警结束时间:</span> -->
  61. <el-date-picker
  62. v-model="conditions.expectedEndDate"
  63. type="datetime"
  64. placeholder="预警结束时间"
  65. style="width:200px;margin-right: 14px;"
  66. format="YYYY-MM-DD HH:mm:ss"
  67. value-format="YYYY-MM-DD HH:mm:ss"
  68. />
  69. </div>
  70. <div class="search-item">
  71. <span>数值范围:</span>
  72. <el-input-number v-model="conditions.start" :max="conditions.end" class="input" placeholder="开始" :controls="false" style="width:100px;" />
  73. <span>-</span>
  74. <el-input-number v-model="conditions.end" :min="conditions.start" placeholder="结束" :controls="false" style="width:100px;margin:0 10px;" />
  75. </div>
  76. <div class="bt search" @click="searchSubmit">查询</div>
  77. <div class="bt" @click="resetSubmit">重置</div>
  78. </div>
  79. <div class="lf-container">
  80. <div class="card-container">
  81. <div class="card" v-for="(item,index) in dataList" :key="index">
  82. <div class="title">{{item.goafDevTypename}}</div>
  83. <div class="info">
  84. <p>设备编号:{{item.goafDevName}}</p>
  85. <p>安装区域:{{ NumConvertLM(item.goafOrebelt) }}/{{ item.goafOrebody }}/{{ item.goafOreheight }}/{{ item.goafName }}</p>
  86. <p>安装位置:{{ item.goafDevLocation }}</p>
  87. <p>阈值:{{item.goafAlarmThreshold}}</p>
  88. <!-- <p>是否在线:{{item.status}}</p> -->
  89. </div>
  90. <footer :class="'status-'+item.hdangerLevel">{{hdangerLevel(item.hdangerLevel)}}</footer>
  91. </div>
  92. </div>
  93. <div class="el-pagination-wrap">
  94. <el-pagination small layout="prev, pager, next"
  95. :total="total"
  96. @size-change="handleSizeChange"
  97. @current-change="handleCurrentChange" />
  98. </div>
  99. </div>
  100. </div>
  101. <div class="rt">
  102. <div class="head">
  103. <div class="name">传感器数据统计</div>
  104. <div class="number">123</div>
  105. </div>
  106. <div class="head-info">
  107. <div class="item total">
  108. <div class="name">总数</div>
  109. <div class="number">123</div>
  110. </div>
  111. <div class="item normal">
  112. <div class="name">正常</div>
  113. <div class="number">120</div>
  114. </div>
  115. <div class="item error">
  116. <div class="name">异常</div>
  117. <div class="number">3</div>
  118. </div>
  119. </div>
  120. <div class="chart-wrap">
  121. <div class="title">报警统计</div>
  122. <alert-chart ref="alert-chart" />
  123. </div>
  124. <div class="chart-wrap">
  125. <div class="title">预警处理情况</div>
  126. <warn-chart ref="warn-chart" />
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. </template>
  132. <script>
  133. import AlertChart from './components/AlertChart.vue'
  134. import WarnChart from './components/WarnChart.vue'
  135. import { getSensorByPage } from '@/api/goaf/sensor'
  136. import { getGoafBaseInfo } from '@/api/goaf/info'
  137. import { NumConvertLM } from '@/utils'
  138. export default {
  139. name:"sensor",
  140. components:{
  141. AlertChart,
  142. WarnChart
  143. },
  144. data(){
  145. return{
  146. activeId:'1',
  147. activetab:'1',
  148. conditions: {
  149. page: 1,
  150. limit: 8,
  151. goafId: '',
  152. goafOrebelt: '',
  153. goafOrebody: '',
  154. goafOreheight: '',
  155. goafName:"",
  156. goafDevName:"",
  157. hdangerLevel:"",
  158. start:0,
  159. end:0
  160. },
  161. goafList: [],
  162. goafOrebelts: [],
  163. goafOrebodys: [],
  164. goafOreheights: [],
  165. goafNames: [],
  166. items:[
  167. {name:"首页",id:"1",path:"/particulars/sensor"},
  168. {name:"压力传感器",id:"2",path:"/particulars/check"},
  169. {name:"位移传感器",id:"3",path:"/particulars/goaf-info"},
  170. {name:"有害气体传感器",id:"4",path:"/particulars/goaf-info"},
  171. {name:"视频监控",id:"5",path:"/particulars/goaf-info"},
  172. ],
  173. tabs:[
  174. {name:"Ⅲ号",id:"1"},
  175. {name:"770",id:"2"},
  176. {name:"32001",id:"3"},
  177. ],
  178. options:[
  179. {label:1,value:2},
  180. {label:2,value:3},
  181. {label:3,value:4}
  182. ] ,
  183. hdangerLevels:[
  184. {label:"异常",value:0},
  185. {label:"威胁",value:1},
  186. {label:"危险",value:2},
  187. {label:"危急",value:3}
  188. ],
  189. dataList:[],
  190. total:0
  191. }
  192. },
  193. created(){
  194. this.init()
  195. },
  196. methods:{
  197. NumConvertLM,
  198. hdangerLevel(val){
  199. let status=["异常","威胁","危险","危急"]
  200. return status[val]||'正常'
  201. },
  202. init(){
  203. this.$nextTick(()=>{
  204. this.$refs['alert-chart'].init();
  205. this.$refs['warn-chart'].init();
  206. })
  207. this.getData()
  208. getGoafBaseInfo().then((res) => {
  209. const goafOrebelts = res.data.map(item => item.goafOrebelt)
  210. this.goafOrebelts = [...new Set(goafOrebelts)]
  211. this.goafList = res.data
  212. })
  213. },
  214. getData(){
  215. for(let key in this.conditions){
  216. if(this.conditions[key]===undefined||this.conditions[key]==="undefined"||this.conditions[key]===""){
  217. delete this.conditions[key]
  218. }
  219. }
  220. getSensorByPage(this.conditions).then((resp) => {
  221. this.listLoading = false
  222. const {data, total } = resp
  223. this.dataList = data
  224. this.total = total
  225. })
  226. },
  227. changeHead(item){
  228. this.activeId=item.id
  229. if(item.id==='5'){
  230. this.$router.push('/particulars/particulars-video')
  231. }
  232. },
  233. changeTab(item){
  234. this.activetab=item.id
  235. },
  236. searchSubmit(){
  237. this.getData()
  238. },
  239. resetSubmit(){
  240. this.conditions={
  241. page: 1,
  242. limit: 8,
  243. goafId: '',
  244. goafOrebelt: '',
  245. goafOrebody: '',
  246. goafOreheight: '',
  247. goafName:"",
  248. goafDevName:"",
  249. hdangerLevel:"",
  250. start:0,
  251. end:0
  252. }
  253. this.getData()
  254. },
  255. handleSizeChange(limit){
  256. this.conditions.limit=limit
  257. this.getData()
  258. },
  259. handleCurrentChange(pageNumber){
  260. this.conditions.page=pageNumber
  261. },
  262. changeArea(type) {
  263. const goafs = this.deeepClone(this.goafList)
  264. let goafOrebodys = this.deeepClone(this.goafOrebodys)
  265. let goafOreheights = this.deeepClone(this.goafOreheights)
  266. let goafNames = this.deeepClone(this.goafNames)
  267. if (type === 1) {
  268. goafOrebodys = goafs.filter(item => item.goafOrebelt === this.conditions.goafOrebelt)
  269. this.goafOrebodys = goafOrebodys
  270. this.goafOreheights = []
  271. this.goafNames = []
  272. this.conditions.goafOrebody = ''
  273. this.conditions.goafOreheight = ''
  274. this.conditions.goafName = ''
  275. this.conditions.goafId = ''
  276. } else if (type === 2) {
  277. goafOreheights = goafs.filter(item => (item.goafOrebody === this.conditions.goafOrebody) && (item.goafOrebelt === this.conditions.goafOrebelt))
  278. this.goafOreheights = goafOreheights
  279. this.goafNames = []
  280. this.conditions.goafOreheight = ''
  281. this.conditions.goafName = ''
  282. this.conditions.goafId = ''
  283. } else if (type === 3) {
  284. goafNames = goafs.filter(item => (item.goafOreheight === this.conditions.goafOreheight) && (item.goafOrebody === this.conditions.goafOrebody) && (item.goafOrebelt === this.conditions.goafOrebelt))
  285. this.goafNames = goafNames
  286. this.conditions.goafName = ''
  287. this.conditions.goafId = ''
  288. } else {
  289. for (let i = 0; i < goafNames.length; i++) {
  290. if (this.conditions.goafId === goafNames[i].goafId) {
  291. this.conditions.goafName = goafNames[i].goafName
  292. }
  293. }
  294. }
  295. this.$forceUpdate()
  296. },
  297. deeepClone(params) {
  298. return JSON.parse(JSON.stringify(params))
  299. }
  300. }
  301. }
  302. </script>
  303. <style lang="scss" scoped>
  304. .sensor-page{
  305. .search-item{
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. margin-bottom: 14px;
  310. span{
  311. font-family: 'Ping Hei';
  312. font-size: 14px;
  313. line-height: 1;
  314. color: rgba(255, 255, 255, 0.7);
  315. }
  316. }
  317. .input,.select,.el-date-editor{
  318. width: 180px;
  319. margin-right:16px;
  320. color: #fff;
  321. }
  322. ::v-deep{
  323. .el-input__wrapper{
  324. background-color: rgba(8, 128, 255, 0.2);
  325. border: 0;
  326. box-shadow: none;
  327. }
  328. .el-input__inner{
  329. color: #fff;
  330. }
  331. }
  332. header{
  333. display: flex;
  334. justify-content: center;
  335. align-items: center;
  336. padding-top: 0.5vh;
  337. .item{
  338. width: 188px;
  339. height: 36px;
  340. line-height: 36px;
  341. text-align: center;
  342. background-image: url(@/assets/sensor/head.png);
  343. background-size: 100% 100%;
  344. background-repeat: no-repeat;
  345. margin-right: 12px;
  346. max-width: 20%;
  347. color: #7FCFF4;
  348. cursor: pointer;
  349. &.active{
  350. background-image: url(@/assets/sensor/head_active.png);
  351. color: #2AFFFF;
  352. }
  353. }
  354. }
  355. .tab{
  356. padding-top: 1.5vh;
  357. .item{
  358. display: inline-block;
  359. padding: 5px 10px;
  360. color: #fff;
  361. font-size: 16px;
  362. background: #003B7A;
  363. border: 1px solid #004EA2;
  364. letter-spacing: 0.6px;
  365. margin-right: 24px;
  366. border-radius: 4px 15px 8px 4px;
  367. cursor: pointer;
  368. &.active{
  369. background: #0083CF;
  370. border: 1px solid #0097DD;
  371. }
  372. }
  373. }
  374. .container{
  375. display: flex;
  376. .lf{
  377. width: 60%;
  378. padding-left: 100px;
  379. .search-container{
  380. padding:4.4vh 0 5vh 0;
  381. box-sizing: border-box;
  382. display: flex;
  383. flex-wrap: wrap;
  384. .bt{
  385. width: 100px;
  386. height: 36px;
  387. line-height: 36px;
  388. text-align: center;
  389. color: #fff;
  390. font-size: 14px;
  391. background: rgba(8, 128, 255, 0.2);
  392. border-radius: 4px;
  393. margin-top: 14px;
  394. cursor: pointer;
  395. margin-top: 0;
  396. &.search{
  397. background: linear-gradient(rgba(94, 226, 255, 1),rgba(79, 175, 255, 1));
  398. margin:0 10px 0 0;
  399. }
  400. }
  401. }
  402. .lf-container{
  403. .card-container{
  404. display: flex;
  405. justify-content: flex-start;
  406. flex-wrap: wrap;
  407. padding-left: 50px;
  408. .card{
  409. width: 22%;
  410. height: 25vh;
  411. background: rgba(35, 229, 254, 0.06);
  412. border: 1px solid #115C7C;
  413. margin:0 4% 10px 0;
  414. box-sizing: border-box;
  415. overflow: hidden;
  416. padding: 14px;
  417. color: #fff;
  418. position: relative;
  419. &:nth-child(4n){
  420. margin-right: 0;
  421. }
  422. .title{
  423. font-size: 18px;
  424. font-weight: bold;
  425. padding-bottom: 12px;
  426. text-align: center;
  427. }
  428. .info{
  429. font-size: 14px;
  430. p{
  431. line-height: 22px;
  432. word-break: break-all;
  433. }
  434. }
  435. footer{
  436. width: 100%;
  437. height: 36px;
  438. line-height: 36px;
  439. position: absolute;
  440. bottom: 0;
  441. left: 0;
  442. text-align: center;
  443. background: #0C6ECF;
  444. &.status-1{
  445. background: #DCBA3D;
  446. }
  447. &.status-2{
  448. background: #EC6B1D;
  449. }
  450. &.status-3{
  451. background: #F33737;
  452. }
  453. }
  454. }
  455. }
  456. .el-pagination-wrap{
  457. float: right;
  458. margin-top: 5vh;
  459. ::v-deep{
  460. .el-pager li,button{
  461. background-color: #00539F;
  462. margin-left: 10px;
  463. color: rgba(255, 255, 255, 0.75);
  464. &.is-active{
  465. background-color: rgba(0, 131, 207, 1);
  466. }
  467. }
  468. }
  469. }
  470. }
  471. }
  472. .rt{
  473. flex: 1;
  474. padding-left: 5%;
  475. box-sizing: border-box;
  476. .head{
  477. height: 32px;
  478. background-image: url(@/views/home/images/home/title.png);
  479. background-size: 100% 100%;
  480. background-repeat: no-repeat;
  481. color: #2affff;
  482. font-size: 20px;
  483. display: flex;
  484. justify-content: space-between;
  485. align-items: center;
  486. text-indent: 24px;
  487. padding: 0 14px;
  488. font-family: "YouSheBiaoTiHei";
  489. letter-spacing: 1px;
  490. margin-top: 4.8vh;
  491. }
  492. .head-info{
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. padding-top: 20px;
  497. .item{
  498. width: 33.33%;
  499. display: flex;
  500. justify-content: center;
  501. align-items: center;
  502. flex-direction: column;
  503. color: #fff;
  504. font-size: 12px;
  505. &.total{
  506. display: block;
  507. font-weight: bold;
  508. text-align: left;
  509. .name{
  510. font-size: 14px;
  511. line-height: 20px;
  512. }
  513. .number{
  514. font-size: 20px;
  515. line-height: 38px;
  516. font-weight: 700;
  517. background: rgba(108, 128, 151, 0.1)
  518. }
  519. }
  520. &.normal{
  521. border-left:1px solid rgba(255, 255, 255, 0.12);
  522. border-right:1px solid rgba(255, 255, 255, 0.12);
  523. margin: 0 2%;
  524. height: 100%;
  525. .number{
  526. font-size: 20px;
  527. line-height: 28px;
  528. color: #3CD495;
  529. font-weight: 500;
  530. }
  531. }
  532. &.error{
  533. .number{
  534. font-size: 20px;
  535. line-height: 28px;
  536. color: #D4603C;
  537. font-weight: 500;
  538. }
  539. }
  540. }
  541. }
  542. .chart-wrap{
  543. padding-top: 0.8vh;
  544. .title{
  545. color: #fff;
  546. font-size: 18px;
  547. line-height: 20px;
  548. padding: 10px;
  549. position: relative;
  550. font-family: "YouSheBiaoTiHei";
  551. letter-spacing: 1px;
  552. margin-bottom: 2vh;
  553. &::after{
  554. display: block;
  555. content: "";
  556. width: 100%;
  557. height: 3px;
  558. position: absolute;
  559. bottom: 0;
  560. left: 0;
  561. background-image: url('./images/line.png');
  562. background-repeat: no-repeat;
  563. background-size: 100% 100%;
  564. }
  565. }
  566. }
  567. }
  568. }
  569. }
  570. </style>